@e-llm-studio/instant-learning 1.3.0-alpha.300 → 1.3.0-alpha.301

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.
Files changed (24) hide show
  1. package/dist/cjs/features/IL-OTJ/_components/ChatComponents/ChatComponent.js +1 -1
  2. package/dist/cjs/features/IL-OTJ/_components/ChatComponents/NormalChat.js +1 -1
  3. package/dist/features/IL-OTJ/_components/ChatComponents/ChatComponent.js +1 -1
  4. package/dist/features/IL-OTJ/_components/ChatComponents/NormalChat.js +1 -1
  5. package/dist/types/src/features/IL-OTJ/_components/ChatComponents/ChatComponent.d.ts.map +1 -1
  6. package/dist/types/src/features/IL-OTJ/_components/ChatComponents/NormalChat.d.ts.map +1 -1
  7. package/dist/types/src/features/LearningManagement/LearningManagementTest.d.ts.map +1 -1
  8. package/package.json +1 -1
  9. package/dist/cjs/features/IL-OTJ/_components/templates/BaseTemplate/BaseTemplate.js +0 -2
  10. package/dist/cjs/features/IL-OTJ/_components/templates/BaseTemplate/BaseTemplate.js.map +0 -1
  11. package/dist/cjs/features/IL-OTJ/_components/templates/CreateCategory/CreateCategory.js +0 -2
  12. package/dist/cjs/features/IL-OTJ/_components/templates/CreateCategory/CreateCategory.js.map +0 -1
  13. package/dist/cjs/features/IL-OTJ/_components/templates/WorkflowComposer/WorkflowComposer.js +0 -2
  14. package/dist/cjs/features/IL-OTJ/_components/templates/WorkflowComposer/WorkflowComposer.js.map +0 -1
  15. package/dist/features/IL-OTJ/_components/templates/BaseTemplate/BaseTemplate.js +0 -2
  16. package/dist/features/IL-OTJ/_components/templates/BaseTemplate/BaseTemplate.js.map +0 -1
  17. package/dist/features/IL-OTJ/_components/templates/CreateCategory/CreateCategory.js +0 -2
  18. package/dist/features/IL-OTJ/_components/templates/CreateCategory/CreateCategory.js.map +0 -1
  19. package/dist/features/IL-OTJ/_components/templates/WorkflowComposer/WorkflowComposer.js +0 -2
  20. package/dist/features/IL-OTJ/_components/templates/WorkflowComposer/WorkflowComposer.js.map +0 -1
  21. package/dist/types/src/routes/ErrorBoundary.d.ts +0 -22
  22. package/dist/types/src/routes/ErrorBoundary.d.ts.map +0 -1
  23. package/dist/types/src/routes/Routes.d.ts +0 -3
  24. package/dist/types/src/routes/Routes.d.ts.map +0 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("react"),r=require("@mui/material"),a=require("@mui/material/Tooltip"),s=require("react-markdown"),i=require("rehype-raw"),o=require("../../../../api/transport.js"),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"),g=require("../atoms/SkeletonLoader/SkeletonLoader.js"),h=require("../MessageRendering/ClickableChatComponents.js"),f=require("../AudioWaveform.js"),m=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"),b=require("../../../LearningManagement/store/useAuthStore.js");function w(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var k,j=w(a),I=w(s),E=w(i);exports.autoGeneratePrompt=function(e,t){return o.http.post("".concat(e||"https://devllmstudio.creativeworkspace.ai","/api/chat/chatResponse"),{name:"ilggcautopromptgen",organizationName:"techolution",prompt:t||"Generate a query"},{headers:{"Content-Type":"application/json"},withCredentials:!0}).then(function(e){return e.data}).catch(function(e){throw console.error("Error calling auto-generate API:",e),e})},exports.default=function(a){var s=a.chatAssistantName,i=a.organizationName,w=a.baseUrl,T=a.baseWebsocketUrl,R=a.setIsNewChatClicked;a.ThinkingBulbIconComponent;var M=a.isFormSaveClicked,q=a.setIsFormSavedClicked,A=a.onResetLearningData,D=a.sendMessageInChat,N=a.setSendMessageInChat,F=a.isFormValidating,L=a.chatTitle,W=a.customMetaData,B=a.headerMessageHandlers;a.aiResponse;var P=a.setAIResponse,z=a.onResetChat,O=a.initialChatMessage,H=void 0===O?"":O,U=a.onSave,G=a.chatSize,Z=a.setChatSize,K=a.movingTowards,V=a.setCitations,Q=a.textareaPlaceholder,J=void 0===Q?"Tell me more about this learning...":Q,$=a.setCurrentRequestId,X=a.showSavedMessage,Y=void 0!==X&&X,ee=a.savedMessage,te=a.isError,ne=void 0!==te&&te,re=a.errorMessage,ae=void 0===re?"There was an error saving your changes.":re;a.isSaving;var se=a.isHighlighted,ie=void 0!==se&&se,oe=a.onStreamingStateChange,le=a.onViewComparison;a.isCopyEnabled;var ue=a.onComparisonLinkClick,de=a.onSubmitFeedback,ce=a.userDetails,ve=a.isGlobalEditActive,ge=a.socketTimeOutInMilliSeconds,he=a.initialDraftMessage,fe=void 0===he?"":he,me=a.onValidateSession,pe=a.onCloseSessionModal,_e=a.fieldLabelMap,Ce=a.enableChatLogs,xe=void 0!==Ce&&Ce,ye=b.default().user,Se=s,be=n.useRef("".concat(Se,"-").concat(i,"-").concat(l.v4())),we=n.useRef("".concat(l.v4())),ke=w,je=n.useRef(null),Ie=n.useRef(!0),Ee=n.useRef(null),Te=n.useRef(null),Re=n.useState(fe),Me=Re[0],qe=Re[1],Ae=n.useState([]),De=Ae[0],Ne=Ae[1],Fe=n.useState(!1),Le=Fe[0],We=Fe[1],Be=n.useState(!1);Be[0];var Pe=Be[1],ze=n.useState(!0),Oe=ze[0],He=ze[1],Ue=n.useState(!0);Ue[0];var Ge=Ue[1],Ze=n.useState("");Ze[0];var Ke=Ze[1],Ve=n.useState(""),Qe=Ve[0],Je=Ve[1],$e=n.useState(!1),Xe=$e[0],Ye=$e[1],et=n.useState(!1),tt=et[0],nt=et[1],rt=n.useState(!0),at=rt[0],st=rt[1],it=n.useState("100%");it[0];var ot=it[1],lt=n.useState(null),ut=lt[0],dt=lt[1],ct=n.useState(!1);ct[0];var vt=ct[1],gt=n.useState(!1),ht=gt[0],ft=gt[1],mt=n.useRef(null),pt=n.useRef(new Set),_t=n.useState(null),Ct=_t[0],xt=_t[1],yt=n.useState(!1),St=yt[0],bt=yt[1],wt=n.useState(!1);wt[0],wt[1];var kt=n.useState(null);kt[0],kt[1],n.useRef(null),n.useRef(null);var jt=n.useRef(new Map),It=n.useRef(""),Et=n.useRef(new Set),Tt=n.useRef(0),Rt=n.useRef(!0),Mt=n.useRef(new Map),qt=n.useRef(!1),At=n.useRef(0),Dt=n.useRef(new Map),Nt=n.useRef(null),Ft=n.useState(!1),Lt=Ft[0],Wt=Ft[1];r.keyframes(k||(k=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 Bt=n.useMemo(function(){return""===(null==Me?void 0:Me.trim())||Xe},[Me,Xe]),Pt=n.useMemo(function(){return F},[F]),zt=n.useMemo(function(){var e;return De.length>0&&"user"===(null===(e=De[De.length-1])||void 0===e?void 0:e.role)},[De]),Ot=n.useMemo(function(){return Bt||F||!!ve||zt},[Bt,F,ve,zt]);n.useEffect(function(){fe&&!Me&&(qe(fe),nt(!0),setTimeout(function(){if(Te.current){Te.current.focus();var e=fe.length;Te.current.setSelectionRange(e,e)}},400))},[fe]),n.useEffect(function(){null==oe||oe(Xe)},[Xe,oe]),n.useEffect(function(){return Rt.current=!0,function(){Rt.current=!1,Tt.current+=1,Dt.current.forEach(function(e){return clearTimeout(e)}),Dt.current.clear(),It.current&&T&&u.stopStreaming(It.current,T,!1)}},[T]),n.useEffect(function(){var e=je.current,t=function(){if(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;st(n-t-r<=20)}};return e&&(e.addEventListener("scroll",t),t()),function(){e&&e.removeEventListener("scroll",t)}},[De]);var Ht=C.useHeaderObserver({handlers:B,setResult:P}).processHeaderMessage;n.useEffect(function(){Y&&ft(!0)},[Y]),n.useEffect(function(){if(St){var e=setTimeout(function(){bt(!1)},3e3);return function(){return clearTimeout(e)}}},[St]),n.useEffect(function(){M&&!ve&&(Xt(new KeyboardEvent("keydown",{key:"Enter"}),!1,"Save this Learning"),q(!1))},[M]),n.useEffect(function(){if(D)try{if(D.startsWith("__SKELETON__:")){var t=D.split(":"),n=t[1],r=t.slice(2).join(":"),a={role:"user",content:"",id:n,time:new Date,isSkeleton:!0,skeletonContent:r};return Ne(function(t){return e.__spreadArray(e.__spreadArray([],t,!0),[a],!1)}),Xt(new KeyboardEvent("keydown",{key:"Enter"}),!1,r,!1,n),xt(n),N&&N(""),void setTimeout(function(){xt(null)},2e3)}if(D.startsWith("__SKELETON_END__::")){var s=D.split("::")[1]||"";return Ne(function(t){return t.map(function(t){return t.isSkeleton?e.__assign(e.__assign({},t),{isSkeleton:!1,content:t.skeletonContent||s}):t})}),void(N&&N(""))}var i=l.v4();Xt(new KeyboardEvent("keydown",{key:"Enter"}),!1,D,!1,i),xt(i),N&&N(""),setTimeout(function(){return xt(null)},2e3)}catch(e){console.error("Error handling sendMessageInChat signal",e)}},[D]),n.useEffect(function(){Gt(),Zt();var e=function(){var e,t=(null===(e=null==mt?void 0:mt.current)||void 0===e?void 0:e.clientHeight)||0,n="calc(100% - ".concat(t,"px - 10px)");ot(n)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var Ut=n.useCallback(function(e){var t="string"==typeof e?e:"smooth";Ee.current&&Ee.current.scrollIntoView({behavior:t,block:"end"}),Ie.current&&setTimeout(function(){Ee.current&&Ie.current&&Ee.current.scrollIntoView({behavior:t,block:"end"})},100)},[]);n.useEffect(function(){if(!Xe){var t="";if(ht?t=ee||"Thank you teacher for teaching me, your rule has been saved successfully.":ne&&(t=ae||"I'm sorry, I couldn't save your changes. Please try again."),t){var n={role:"assistant",content:t,id:l.v4(),citations:[],time:new Date};Ne(function(t){return e.__spreadArray(e.__spreadArray([],t,!0),[n],!1)}),ft(!1),setTimeout(function(){return Ut("smooth")},100)}}},[ht,ne,Xe,ee,ae,Ut]),n.useEffect(function(){Ie.current&&Ut("smooth")},[Ut]);var Gt=function(){var e={method:"get",maxBodyLength:1/0,url:"".concat(ke,"/api/chatbot/getChatSettings?name=").concat(Se,"&organizationName=").concat(i),headers:{}};o.http.request(e).then(function(e){var t,n,r;(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.chatSettings)&&""!==(null===(r=null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.chatSettings)||void 0===r?void 0:r.chatInitialMessage)&&Ge(!0)}).catch(function(e){console.error(e)})},Zt=function(){return e.__awaiter(void 0,void 0,void 0,function(){var t,n;return e.__generator(this,function(e){t="".concat(ke,"/api/chat/history?name=").concat(Se,"&organizationName=").concat(i);try{n={method:"GET",params:{guestSessionId:be.current},withCredentials:!0},o.http.get(t,n).then(function(e){var t=e.data;t.length>0?(Ne(t),Ut()):Ge(!0)}).catch(function(e){console.error(e)})}catch(e){We(!1),console.error(e)}return[2]})})},Kt=function(){var e="".concat(ke,"/api/chat/resetHistory?name=").concat(Se,"&organizationName=").concat(i);try{var t={method:"GET",params:{guestSessionId:be.current},withCredentials:!0};o.http.get(e,t).then(function(){R(!0),Ke(""),dt(null),pt.current.clear(),Mt.current.clear(),we.current="".concat(l.v4()),Ne([]),Ge(!0),Nt.current=null,null==z||z(),A&&A()}).catch(function(e){console.error(e)}).finally(function(){be.current="".concat(Se,"-").concat(i,"-").concat(l.v4())})}catch(e){We(!1),console.error(e)}};function Vt(e){return null==e?void 0:e.replace(/<a [^>]*>.*?<\/a>/g,function(e){return null==e?void 0:e.replace(/\*/g,"&ast;")})}var Qt=function(t,n,r,a,s,i,o){var u,d,c,v,g,h,f,m,p,_,C,x,y,S,b,w,k,j,I,E,T,R,M,q,A,D,N,F,L,W;if(null===(d=null===(u=null==t?void 0:t.chatStream)||void 0===u?void 0:u.continueChatResult)||void 0===d?void 0:d.header_message){var B={header_message:t.chatStream.continueChatResult.header_message,responsedata:null===(g=null===(v=null===(c=null==t?void 0:t.chatStream)||void 0===c?void 0:c.continueChatResult)||void 0===v?void 0:v.message)||void 0===g?void 0:g.content};Ht(B)}var P=null===(h=null==t?void 0:t.chatStream)||void 0===h?void 0:h.continueChatResult,z=null==P?void 0:P.isEnd,O=(null===(f=null==P?void 0:P.message)||void 0===f?void 0:f.citations)||[];z&&O.length>0&&V&&V(O);var H={role:"assistant",content:"",id:l.v4()};if(null===(C=null===(_=null===(p=null===(m=null==t?void 0:t.chatStream)||void 0===m?void 0:m.continueChatResult)||void 0===p?void 0:p.message)||void 0===_?void 0:_.content)||void 0===C?void 0:C.includes("WaitMessage: "))Pe(!0),H.content=function(e){var t="WaitMessage: ",n=e.indexOf(t);if(-1!==n){var r=e.substring(n+13);return null==r?void 0:r.replaceAll("WaitMessage: ","")}return""}((null===(S=null===(y=null===(x=null==t?void 0:t.chatStream)||void 0===x?void 0:x.continueChatResult)||void 0===y?void 0:y.message)||void 0===S?void 0:S.content)+"\n\n"),""!==H.content&&(We(!1),Ne(e.__spreadArray(e.__spreadArray([],De,!0),[{role:"user",content:s,time:a,isFirstQuestionSent:i||!1,id:o||(null===(w=null===(b=null==t?void 0:t.chatStream)||void 0===b?void 0:b.continueChatResult)||void 0===w?void 0:w.requestId)||"",reply:""},H],!1)));else{Pe(!1);var U=null===(j=null===(k=null==t?void 0:t.chatStream)||void 0===k?void 0:k.continueChatResult)||void 0===j?void 0:j.requestId;"string"==typeof U&&U&&$&&$(U);var G=function(t,n,r,a){var s,i,o,u,d,c,v,g={role:"assistant",content:"",id:l.v4(),time:new Date,citations:[]},h=(null===(s=null==t?void 0:t.chatStream)||void 0===s?void 0:s.continueChatResult)||{},f=null==h?void 0:h.requestId,m=null==h?void 0:h.preserve_message,p=null==h?void 0:h.isEnd,_=(null===(i=null==h?void 0:h.message)||void 0===i?void 0:i.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&&m&&_&&!p){var S=a.current.get(f)||[];S[S.length-1]!==_&&(S.push(_),a.current.set(f,S))}var b=(f&&a.current.get(f)||[]).join("\n\n"),w="";if(p)w=b&&""!==b.trim()?b:_;else if(m)w=b;else{var k=_.replace(/<!--(?![\s\S]*-->)[\s\S]*$/,"").trimEnd(),j=!1===C||x||0!==y.length?"":k;w=b?"".concat(b,"\n\n").concat(j):j}if(g.content=Vt(w),!0===(null==h?void 0:h.thinking_break)&&!0===(null==h?void 0:h.is_orchestrator)&&!1===(null==h?void 0:h.isEnd)&&n.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 I=h.explainability_id,E=h.responded_by;r.has(I)||r.set(I,{responded_by:E,index:n.length})}r.has(h.explainability_id)?n[null==(T=r.get(h.explainability_id))?void 0:T.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}:n=e.__spreadArray(e.__spreadArray([],n,!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 T;h.explainability_id&&h.responded_by&&(I=h.explainability_id,E=h.responded_by,r.has(I)||r.set(I,{responded_by:E,index:n.length})),r.has(h.explainability_id)?n[null==(T=r.get(h.explainability_id))?void 0:T.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}:n.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:n},g)}(t,r,n,Mt);G.time=new Date,G.citations=O,G.isEnd=null===(E=null===(I=null==t?void 0:t.chatStream)||void 0===I?void 0:I.continueChatResult)||void 0===E?void 0:E.isEnd,G.requestId=null===(R=null===(T=null==t?void 0:t.chatStream)||void 0===T?void 0:T.continueChatResult)||void 0===R?void 0:R.requestId,G.sessionId=be.current,null===(M=G.orchestratorAndAgentsMessages)||void 0===M||M.forEach(function(e){e&&e.header_message&&Ht(e)}),(""!==(null==G?void 0:G.content)||(null==G?void 0:G.orchestratorAndAgentsMessages)&&(null==G?void 0:G.orchestratorAndAgentsMessages.length)>0)&&(We(!1),Ne(e.__spreadArray(e.__spreadArray([],De,!0),[{role:"user",content:s||"",time:a,isFirstQuestionSent:i||!1,id:o||(null===(A=null===(q=null==t?void 0:t.chatStream)||void 0===q?void 0:q.continueChatResult)||void 0===A?void 0:A.requestId)||"",requestId:null!==(F=null===(N=null===(D=null==t?void 0:t.chatStream)||void 0===D?void 0:D.continueChatResult)||void 0===N?void 0:N.requestId)&&void 0!==F?F:""},G],!1))),He(null===(W=null===(L=null==t?void 0:t.chatStream)||void 0===L?void 0:L.continueChatResult)||void 0===W?void 0:W.isEnd)}},Jt=n.useCallback(function(t,n){void 0===n&&(n="inactivity"),console.error("🛑 Stream failed or timed out due to:reason=".concat(n," requestId=").concat(t," at ").concat((new Date).toISOString()));var r=Dt.current.get(t);r&&(clearTimeout(r),Dt.current.delete(t)),t&&T&&(u.stopStreaming(t,T,!1),Mt.current.delete(t)),t===It.current?(qt.current=!1,He(!0),Ye(!1),vt(!1),We(!1),Pe(!1),Ne(function(t){var r=e.__spreadArray([],t,!0).reverse().find(function(e){return"user"===e.role}),a=((null==r?void 0:r.content)||"").replace(/"/g,"&quot;"),s=e.__spreadArray([],t,!0),i=s[s.length-1];i&&"assistant"===i.role&&!i.isEnd&&s.pop();var o="I ran into an unexpected issue while trying to process this learning.";return"inactivity"===n?o="Something went wrong—teaching is taking longer than expected.":"websocket_error"===n&&(o="I lost connection to the server while working on that."),e.__spreadArray(e.__spreadArray([],s,!0),[{role:"assistant",content:"".concat(o,' Please try again.\n\n<button class="clickable-button" data-value="').concat(a,'">Retry</button>'),id:l.v4(),time:new Date,isEnd:!0,citations:[]}],!1)})):console.warn("🛑 [handleStreamTimeout] Ignoring stale timeout for superseded requestId=".concat(t,"; active=").concat(It.current))},[ge,T]),$t=n.useCallback(function(e){var t=Dt.current.get(e);if(t&&clearTimeout(t),ge&&ge>0){console.log("⏱️ [Timeout armed] requestId=".concat(e," timeout=").concat(ge,"ms at ").concat((new Date).toISOString()));var n=setTimeout(function(){console.warn("⏱️ [Timeout FIRED — auto stop] requestId=".concat(e," at ").concat((new Date).toISOString())),Jt(e,"inactivity")},ge);Dt.current.set(e,n)}},[Jt,ge]),Xt=function(t,n,r,a,s,o){return e.__awaiter(void 0,void 0,void 0,function(){var a,d,c,v,g,h,f,m,p,_,C,x,y,S,b,w,k;return e.__generator(this,function(j){switch(j.label){case 0:if(a=(void 0!==r?r:Me||"").trim(),(d="Enter"===(null==t?void 0:t.key)&&!(null==t?void 0:t.shiftKey)&&!ve)&&(null===(x=null==t?void 0:t.preventDefault)||void 0===x||x.call(t)),c="user"===(null===(y=De[De.length-1])||void 0===y?void 0:y.role),!a||Xe||qt.current||c||(null==t?void 0:t.key)&&!d)return[2];if(Nt.current||(Nt.current=(new Date).toISOString(),console.log("Session start time set to ".concat(Nt.current))),!me)return[3,5];We(!0),Je("Validating session..."),j.label=1;case 1:return j.trys.push([1,3,,4]),[4,me(Nt.current)];case 2:return j.sent()?[3,4]:(Wt(!0),We(!1),o&&o(!1),[2]);case 3:return v=j.sent(),console.error("Validation error:",v),Wt(!0),We(!1),o&&o(!1),[2];case 4:We(!1),j.label=5;case 5:return qt.current=!0,"I want to add a rule description"===a?(He(!1),Ie.current=!0,Ye(!0),!ut&&a&&dt(r||"manual_entry"),g=new Date,Ne(function(t){return e.__spreadArray(e.__spreadArray([],t.map(function(t,n){var r;return e.__assign(e.__assign({},t),{content:null===(r=Vt(t.content))||void 0===r?void 0:r.replace("WaitMessage: ","")})}),!0),[{role:"user",content:a,time:g,isFirstQuestionSent:!1,id:s||l.v4()}],!1)}),Ut("smooth"),setTimeout(function(){Ne(function(t){return e.__spreadArray(e.__spreadArray([],t,!0),[{role:"assistant",content:"I'd be happy to help you set up a new rule! To get started, could you tell me what kind of behavior or logic you would like this rule to follow?",id:l.v4(),citations:[],time:new Date}],!1)}),Ut("smooth"),setTimeout(function(){Ye(!1),He(!0)},500)},500),[2]):(He(!1),Ie.current=!0,Ye(!0),!ut&&a&&dt(r||"manual_entry"),h=new Date,f=Tt.current,Ne(function(t){var n=t.map(function(t){var n;return e.__assign(e.__assign({},t),{content:null===(n=Vt(t.content))||void 0===n?void 0:n.replace("WaitMessage: ","")})});return s&&n.some(function(e){return e.id===s})?n.map(function(t){return t.id===s?e.__assign(e.__assign({},t),{content:a}):t}):e.__spreadArray(e.__spreadArray([],n,!0),[{role:"user",content:a,time:h,isFirstQuestionSent:!1,id:s||l.v4()}],!1)}),Ut("smooth"),m=new Map,p=[],_=function(e){var t;if(!e)return{};var n=Object.keys(e);return 1===n.length&&"current"===n[0]?null!==(t=e.current)&&void 0!==t?t:{}:e},C={WEBSOCKET_URL:T,organizationName:i,chatAssistantName:Se,selectedAIModel:"gpt-4",replyMessage:"",userName:null!==(S=null==ce?void 0:ce.name)&&void 0!==S?S:"Guest User",userEmailId:null!==(b=null==ce?void 0:ce.email)&&void 0!==b?b:"guestUser@example.com",userId:null!==(w=null==ce?void 0:ce.id)&&void 0!==w?w:"Guest User",query:a,requestId:"requestId-".concat(l.v4()),customPrompt:"",enableForBackend:!1,guestSessionId:be.current,chatPreviewId:we.current,customMetaData:_(W),aiModel:"",enableLogs:!0,logControls:{infoLogs:xe,debugLogs:xe},additionalHeaders:(null==ye?void 0:ye.accessToken)?{Authorization:"Bearer ".concat(ye.accessToken)}:void 0,onStreamEvent:function(e){var t,r,i,o,l,u;if(Rt.current&&Tt.current===f){var d=null===(r=null===(t=null==e?void 0:e.chatStream)||void 0===t?void 0:t.continueChatResult)||void 0===r?void 0:r.requestId,c=null===(o=null===(i=null==e?void 0:e.chatStream)||void 0===i?void 0:i.continueChatResult)||void 0===o?void 0:o.header_message;console.log("📦 [Stream Chunk Received] With RequestID and header_message: ".concat(d,",").concat(c)),$t(C.requestId);var v=null===(u=null===(l=null==e?void 0:e.chatStream)||void 0===l?void 0:l.continueChatResult)||void 0===u?void 0:u.error_state;if(Array.isArray(v)&&v.length>0)return console.error("⚠️ Agent returned an error_state during stream:",{requestId:d,errorState:v}),void Jt(C.requestId,"agent_error");Qt(e,m,p,h,a,n,s)}},onStreamEnd:function(t){var n,r;if(Rt.current&&Tt.current===f){var a=null===(r=null===(n=null==t?void 0:t.chatStream)||void 0===n?void 0:n.continueChatResult)||void 0===r?void 0:r.requestId;Et.current.add(C.requestId),console.log("✅ [Stream Completed] RequestID: ".concat(a));var s=Dt.current.get(C.requestId);s&&(clearTimeout(s),Dt.current.delete(C.requestId)),qt.current=!1,He(!0),Ye(!1),vt(!1);var i=Date.now(),o=jt.current.get(C.requestId);if(o){var l=Math.round((i-o)/1e3).toFixed(1);Ne(function(t){var n=e.__spreadArray([],t,!0).reverse().findIndex(function(e){return"assistant"===e.role});if(-1===n)return t;var r=t.length-1-n;return t.map(function(t,n){return n===r?e.__assign(e.__assign({},t),{finalTimeTaken:l}):t})})}}},onError:function(e){if(Rt.current&&Tt.current===f){var t=Dt.current.get(C.requestId);if(t&&(clearTimeout(t),Dt.current.delete(C.requestId)),Et.current.has(C.requestId))return console.warn("Ignoring post-completion error for already-finished request:",C.requestId),void Et.current.delete(C.requestId);console.error("Stream error:",e),Jt(C.requestId,"websocket_error")}}},a&&(We(!0),null===(k=Te.current)||void 0===k||k.blur(),qe(""),Ut(),Je(s?"Just a moment, processing your request...":"Okay, got it. Let me take a moment to work on this and I'll get back to you shortly."),jt.current.set(C.requestId,Date.now()),It.current=C.requestId,console.log("Chat Stream Params:",C),$t(C.requestId),At.current+=1,console.log("🚀 [UI Action] stream started (Total UI invocations: ".concat(At.current,") | RequestID: ").concat(C.requestId,' | Query: "').concat(a,'"')),u.startChatStream(C)),o&&o(!1),[2])}})})},Yt=n.useRef(null);n.useLayoutEffect(function(){Yt.current=Xt});var en=n.useCallback(function(){for(var t,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return null===(t=Yt.current)||void 0===t?void 0:t.call.apply(t,e.__spreadArray([Yt],n,!1))},[]),tn=n.useMemo(function(){return{p:function(n){n.node;var r=n.children;return e.__rest(n,["node","children"]),t.jsx("div",e.__assign({style:{margin:0,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"10px",fontFamily:"inherit"}},{children:r}))},button:function(n){n.node;var r=n.className,a=n.children,s=e.__rest(n,["node","className","children"]),i=C.extractTextFromChildren(a),o=s["data-value"],l=ut===i||ut===o,u=!!ut||!!ve,d="Tester Genie"===i;return t.jsx(h.ActionableButton,e.__assign({},s,{className:r,handleStream:en,isStreamEnd:Oe,disabled:u,isLastMessage:!0,style:{margin:0},isTesterGenie:d,"data-selected":l?"true":ut?"false":void 0},{children:t.jsxs("span",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[a,d&&t.jsxs("svg",e.__assign({width:"16",height:"20",viewBox:"0 0 16 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[t.jsx("path",{d:"M7.20368 8.94768e-06C7.48895 -0.00208639 7.69331 0.364327 7.83856 0.57465C8.14381 1.01633 8.38012 1.87909 7.71077 2.14118C8.57167 2.21011 9.70406 2.93098 10.1785 3.64699C10.5932 4.27286 10.4559 5.16037 9.80301 5.56007L9.9502 7.16593C9.97671 7.44871 10.0265 7.87092 10.0299 8.14457C10.4213 8.23046 11.0787 8.55391 11.326 8.87592C11.5979 8.75656 11.9189 8.76963 12.1688 8.93469C12.3563 8.67751 12.5598 8.41456 12.7507 8.15787C12.3283 7.45155 12.5047 6.57745 13.2143 6.13784C13.5375 5.9377 13.9264 5.87277 14.2971 5.95705C14.0961 6.30964 13.8775 6.72182 13.6593 7.05857C13.7906 7.2436 13.9184 7.44225 14.044 7.63194L14.8022 7.63198C15.0349 7.30106 15.2515 6.90827 15.4835 6.59349C15.8623 7.0712 15.8156 7.79671 15.4734 8.28241C15.1318 8.76741 14.4886 8.9899 13.9118 8.88251C13.758 9.12108 13.5577 9.39243 13.3941 9.63201C13.7143 9.9316 13.7725 10.364 13.4067 10.6594C13.5231 10.8889 13.5309 11.1613 13.447 11.402C13.1502 12.2523 12.1724 12.5645 11.3474 12.5025C11.1171 12.4852 10.939 12.4698 10.7197 12.3953C10.8724 13.1271 10.7744 14.2031 10.5132 14.9051C10.1688 15.8304 9.43632 16.5569 8.54503 16.9655C7.90465 17.2706 7.21222 17.3607 6.50472 17.4505C5.74445 17.5471 4.75801 17.4362 4.08533 17.825C3.9327 17.9132 3.86566 18.0173 3.82943 18.1792C3.94996 18.5982 4.47858 18.6063 4.78474 18.8897C5.20191 19.2758 4.90716 19.9663 4.36611 19.9908C4.31476 19.9931 4.26867 19.9867 4.23186 19.9493C4.23089 19.8303 4.47587 19.7199 4.49787 19.5262C4.55075 19.0604 3.70014 19.0078 3.37835 18.8374C3.13013 18.706 2.99537 18.6309 2.82242 18.4021C2.63795 18.1579 2.58428 17.835 2.63138 17.5392C2.74868 16.7847 3.47123 16.393 4.12184 16.1497C4.61314 15.9659 5.46304 15.7158 5.52019 15.0793C5.58589 14.348 4.97543 13.5523 4.57739 12.9807C4.44275 12.7875 4.3039 12.579 4.16309 12.3919C4.18987 12.365 4.21049 12.3463 4.23916 12.3212C4.59619 12.6218 5.21209 12.6421 5.55038 12.2979C5.70457 12.144 5.78974 11.9342 5.78642 11.7164C5.78121 11.4493 5.63382 11.2002 5.4454 11.019C5.44704 10.9932 5.44824 10.9676 5.449 10.9419C5.4566 10.6648 5.37505 10.4902 5.1892 10.2943C5.18398 10.2538 5.17776 10.2134 5.17053 10.1732C5.08123 9.69297 4.71708 9.34182 4.23415 9.27108C4.16418 9.26083 3.96108 9.26105 3.92071 9.23344C3.90485 9.1828 3.9059 9.20792 3.91904 9.15527C4.22103 8.90139 4.14407 8.78214 4.31107 8.4846C4.42301 8.28513 4.73047 8.15239 4.95452 8.10701C4.96167 7.51076 5.03684 6.88562 5.10036 6.29144C5.12451 6.0655 5.12531 5.75046 5.1511 5.55257C4.11108 4.86747 4.39091 3.75946 5.25465 3.06391C5.84978 2.58469 6.34496 2.31002 7.10143 2.14517C7.01589 2.10416 6.93842 2.04811 6.87269 1.97972C6.77021 1.87349 6.70248 1.73857 6.67853 1.59293C6.60568 1.12096 7.04104 0.914625 7.18759 0.526392C7.26428 0.323403 7.03925 0.146075 7.20368 8.94768e-06Z",fill:"#475569"}),t.jsx("path",{d:"M7.459 4.5C7.48797 4.50312 7.71949 4.61154 7.76205 4.63061C8.27062 4.85835 8.87051 5.09164 9.35658 5.3582C9.36602 6.03495 9.37016 6.56625 8.70573 6.91519C8.6633 6.80883 8.63019 6.72409 8.56332 6.63044C8.43786 6.45568 8.24656 6.33963 8.03354 6.30909C7.8434 6.28211 7.65146 6.3197 7.49586 6.43503C7.21897 6.21256 6.76265 6.28197 6.5229 6.52486C6.39308 6.65639 6.34815 6.75074 6.28902 6.92344C5.59702 6.5957 5.58761 6.04267 5.60583 5.35582C5.89882 5.23844 6.21318 5.0724 6.50153 4.941C6.82145 4.79522 7.14482 4.6574 7.459 4.5Z",fill:"#D1EDFD"}),t.jsx("path",{d:"M11.0756 10.6406C11.1037 10.6701 11.1324 10.7706 11.1535 10.8145C11.2818 11.0817 11.4922 11.1945 11.7498 11.2977C11.5607 11.63 11.4567 11.8797 11.1034 12.0466L11.0839 12.0517C10.9262 12.0927 10.7996 12.0968 10.651 12.0135C10.4755 11.915 10.3807 11.6614 10.4792 11.478C10.6388 11.1809 10.8877 10.9272 11.0756 10.6406Z",fill:"#D1EDFD"}),t.jsx("path",{d:"M11.6036 9.1377C11.6993 9.11763 11.8391 9.16378 11.9294 9.19593C11.6952 9.50644 11.4706 9.81614 11.2327 10.1261L11.1572 10.2255C10.7581 9.73539 11.0333 9.24481 11.6036 9.1377Z",fill:"#D1EDFD"}),t.jsx("path",{d:"M7.49681 0.882812C7.53691 0.925159 7.61244 1.08523 7.63598 1.14156C7.74243 1.39673 7.75769 1.76908 7.38596 1.77504C7.28236 1.75599 7.15628 1.68938 7.13517 1.5783C7.0843 1.3107 7.35609 1.09964 7.48737 0.897583L7.49681 0.882812Z",fill:"#D1EDFD"}),t.jsx("path",{d:"M1.68305 6.17249C1.71659 6.1673 1.8134 6.16478 1.84892 6.16432C2.34052 6.15616 2.81496 6.34495 3.16655 6.68866C3.50847 7.01806 3.70349 7.47119 3.70765 7.94596C3.70896 8.42345 3.54045 8.85284 3.20281 9.19025C3.34033 9.28068 3.5321 9.52219 3.6543 9.65748C4.17158 9.39073 4.91447 9.69339 4.79675 10.3444C5.08751 10.5485 5.19656 10.8288 5.0585 11.1674C5.15418 11.2375 5.25595 11.3205 5.32383 11.4186C5.40228 11.5303 5.4309 11.6695 5.40291 11.8031C5.32228 12.1857 4.90085 12.3286 4.57669 12.1236C4.51367 12.0838 4.42258 11.9595 4.35299 11.9431C4.30669 11.9557 4.28453 11.9584 4.23644 11.9644C4.22885 11.9742 4.22118 11.9841 4.21343 11.9938C3.93597 12.3413 3.49234 12.4682 3.06933 12.5157C2.85285 12.518 2.70432 12.5146 2.49066 12.4609C1.80785 12.2892 1.50808 11.6167 1.70723 10.9639C1.829 10.5648 2.11891 10.2506 2.48939 10.0518C2.54655 10.132 2.57559 10.2191 2.64066 10.303C2.73571 10.2223 2.82048 10.1482 2.92363 10.0773C2.81023 9.95313 2.66811 9.7693 2.55817 9.63584C2.38871 9.6878 2.23026 9.72879 2.05298 9.74653C1.54239 9.80228 1.03118 9.64711 0.637735 9.31695C0.269964 9.01018 0.0453493 8.54827 0.00544736 8.07322C-0.0309495 7.60988 0.116099 7.15077 0.414918 6.79478C0.742554 6.41198 1.18728 6.21393 1.68305 6.17249Z",fill:"#475569"}),t.jsx("path",{d:"M1.79616 6.5951C2.54894 6.5619 3.18687 7.14364 3.22301 7.8963C3.25915 8.64894 2.67989 9.28913 1.92739 9.3282C1.17073 9.3675 0.526231 8.78435 0.489885 8.02753C0.45354 7.27071 1.03921 6.62849 1.79616 6.5951Z",fill:"#D1EDFD"}),t.jsx("path",{d:"M4.93607 11.4844C5.12839 11.6261 5.22049 11.9085 4.91876 11.9419C4.8067 11.8805 4.78491 11.8646 4.71094 11.7561C4.81572 11.6752 4.862 11.5925 4.93607 11.4844Z",fill:"#FEFEFD"}),t.jsx("path",{d:"M12.5164 3.58594L12.5715 3.59466C12.6589 3.65863 12.6908 3.94434 12.7882 4.05193C12.8789 4.15216 12.9155 4.17816 13.0326 4.24929C13.1363 4.31224 13.3325 4.34025 13.384 4.43124C13.3643 4.56218 13.0693 4.54857 12.9127 4.69344C12.6903 4.89898 12.7114 5.06971 12.5892 5.28622C12.5669 5.28439 12.5368 5.2868 12.5261 5.27346C12.4336 5.15843 12.4072 4.9308 12.3099 4.81465C12.1627 4.63903 11.9972 4.60054 11.7981 4.51372C11.7544 4.49467 11.7266 4.47099 11.7129 4.42649C11.7867 4.31876 12.0509 4.34309 12.2376 4.14892C12.43 3.94901 12.4155 3.72208 12.5164 3.58594Z",fill:"#475569"}),t.jsx("path",{d:"M2.13644 3.72656C2.24401 3.77084 2.29712 4.1268 2.431 4.25226C2.60327 4.41371 2.7311 4.41949 2.93246 4.52449C2.96024 4.53897 2.97173 4.56042 2.97671 4.58878C2.89584 4.6981 2.61854 4.70721 2.4596 4.85659C2.26275 5.04156 2.27341 5.29132 2.17022 5.42088C2.16192 5.41849 2.11671 5.40232 2.1156 5.40043C2.01291 5.21216 1.9836 5.04909 1.84812 4.87273C1.73599 4.72675 1.36534 4.69959 1.32812 4.56939C1.3835 4.47941 1.67823 4.44211 1.82291 4.30563C2.02737 4.11274 2.0042 3.8372 2.13644 3.72656Z",fill:"#475569"})]}))]}))}))}}},[en,Oe,ut,ve]),nn=n.useMemo(function(){return De.some(function(e){return e.isSkeleton})},[De]),rn=function(t){return e.__awaiter(void 0,void 0,void 0,function(){return e.__generator(this,function(n){switch(n.label){case 0:return de?[4,de(t)]:[3,2];case 1:n.sent(),Ne(function(t){return e.__spreadArray(e.__spreadArray([],t,!0),[{role:"assistant",content:"Thanks for your feedback — this will help improve future suggestions.",id:l.v4(),citations:[],time:new Date,isEnd:!0}],!1)}),setTimeout(function(){return Ut("smooth")},100),n.label=2;case 2:return[2]}})})};return t.jsxs("div",e.__assign({className:"".concat(p.default.customFont," ").concat(m.default.chatContainer),style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:ie&&!nn?"0 0 20px 5px rgba(37, 99, 235, 0.5)":"none"}},{children:[t.jsxs("div",e.__assign({ref:je,className:m.default.scrollWrapper},{children:[t.jsx("div",e.__assign({ref:mt,className:m.default.stickyHeader},{children:t.jsx(c.default,{resetChatHistory:Kt,isStreamEnd:Oe,chatTitle:L,onResize:Z,chatSize:G,movingTowards:K})})),t.jsxs("div",e.__assign({className:m.default.messagesList},{children:[t.jsxs("div",e.__assign({className:m.default.initialMessageRow},{children:[t.jsx("div",e.__assign({className:m.default.iconWrapper},{children:t.jsx(y.default,{})})),t.jsx("div",e.__assign({className:m.default.welcomeTextWrapper},{children:t.jsx("div",e.__assign({className:m.default.welcomeMarkdownWrapper},{children:t.jsx("span",{children:t.jsx(I.default,e.__assign({rehypePlugins:[E.default],components:tn},{children:H}))})}))}))]})),De.length>0&&De.map(function(n,r){var a,s;return t.jsxs("div",e.__assign({className:m.default.messageRow},{children:["assistant"===n.role?t.jsx("div",e.__assign({className:m.default.assistantIconContainer},{children:t.jsx(y.default,{})})):t.jsx("div",{className:m.default.userSpacer}),t.jsx("div",e.__assign({className:m.default.messageContent},{children:"assistant"===n.role?t.jsxs(t.Fragment,{children:[n.orchestratorAndAgentsMessages&&n.orchestratorAndAgentsMessages.length>0&&t.jsx(d.WatchMeWork,{orchestratorAndAgentsMessages:null==n?void 0:n.orchestratorAndAgentsMessages,isStreamEnd:Oe,finalTimeTaken:null==n?void 0:n.finalTimeTaken},null!==(a=null==n?void 0:n.finalTimeTaken)&&void 0!==a?a:null==n?void 0:n.id),t.jsx(v.default,{index:r,content:null==n?void 0:n.content,role:null==n?void 0:n.role,messages:De,handleStream:en,isLastMessage:r===De.length-1,onSave:U,citations:null==n?void 0:n.citations,setChatSize:Z,chatSize:G,isStreamEnd:Oe,messageIsEnd:null==n?void 0:n.isEnd,onViewComparison:le,onTypeResponseClick:function(){var e;bt(!0),null===(e=Te.current)||void 0===e||e.focus()},onComparisonLinkClick:ue,baseURL:ke,onFeedbackSubmit:rn,isGlobalEditActive:ve,fieldLabelMap:_e}),n.hasOwnProperty("isEnd")&&!(null==n?void 0:n.isEnd)&&(null===(s=null==n?void 0:n.content)||void 0===s?void 0:s.length)>0&&t.jsxs(t.Fragment,{children:[t.jsx(g.Skeleton,{variant:"text",width:"50%",height:20}),t.jsx("div",{style:{marginTop:"10px"}}),t.jsx(g.Skeleton,{variant:"text",width:"100%",height:40})]}),t.jsx("div",e.__assign({className:m.default.timestamp},{children:n.time&&!isNaN(new Date(n.time).getTime())?new Date(n.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}):t.jsxs("div",e.__assign({className:m.default.userMessageWrapper},{children:[t.jsxs("div",e.__assign({className:m.default.userMessageBubble,style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:n.isSkeleton||nn||n.id!==Ct?"none":"0 0 15px 3px rgba(37, 99, 235, 0.6)"}},{children:[n.isSkeleton?t.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:"12px",minWidth:"280px",padding:"8px 0"}},{children:[t.jsx(g.Skeleton,{variant:"text",width:"100%",height:16}),t.jsx(g.Skeleton,{variant:"text",width:"80%",height:16})]})):t.jsx(v.default,{index:r,content:null==n?void 0:n.content,role:null==n?void 0:n.role,messages:De,handleStream:en,isLastMessage:r===De.length-1,onSave:U,citations:null==n?void 0:n.citations,isStreamEnd:Oe,isGlobalEditActive:ve,messageIsEnd:null==n?void 0:n.isEnd,onViewComparison:le,onComparisonLinkClick:ue,baseURL:ke,onFeedbackSubmit:rn,fieldLabelMap:_e}),t.jsx("div",e.__assign({style:{marginTop:"0.5rem"}},{children:t.jsx(S.UserIcon,{})}))]})),t.jsx("div",e.__assign({className:m.default.userTimestamp},{children:new Date(n.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}))}))]}),n.id)}),Le&&t.jsxs("div",e.__assign({className:m.default.loadingRow},{children:[t.jsx("div",e.__assign({className:m.default.iconWrapper,style:{marginTop:"0.2rem"}},{children:t.jsx(y.default,{})})),t.jsx("div",e.__assign({className:m.default.loadingTextWrapper},{children:t.jsx("span",{children:Qe})}))]})),t.jsx("div",{ref:Ee,style:{float:"left",clear:"both"}})]}))]})),t.jsx("div",e.__assign({className:m.default.inputAreaWrapper},{children:t.jsx(j.default,e.__assign({title:F?"Please wait for the validation to be completed.":""},{children:t.jsxs("div",e.__assign({className:"".concat(m.default.inputBoxContainer," ").concat(Pt?m.default.disabled:""),style:St?{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:[De.length>0&&!at&&t.jsx("div",e.__assign({onMouseDown:function(e){e.preventDefault(),Ut("smooth")},className:m.default.scrollToBottomBtn},{children:t.jsx(_.ScrollToBottom,{})})),t.jsxs("div",e.__assign({style:{width:"100%",display:"flex"}},{children:[t.jsx("textarea",{ref:Te,placeholder:J,value:Me||"",onChange:function(e){qe(e.target.value)},onFocus:function(){return nt(!0)},onBlur:function(){return nt(!1)},onKeyDown:function(e){return Xt(e)},disabled:Pt,className:"no-scrollbar ".concat(m.default.chatTextarea),style:{minHeight:tt||Me&&Me.length>40?"120px":"50px",height:tt||Me&&Me.length>40?"120px":"50px",maxHeight:"120px"}}),t.jsx("span",e.__assign({className:m.default.sendButtonWrapper},{children:t.jsx("button",e.__assign({onClick:function(e){Ot||Xt(new KeyboardEvent("keydown",{key:"Enter"}))},disabled:Ot,className:"".concat(m.default.sendButton," ").concat(Ot?m.default.disabled:m.default.active)},{children:t.jsx(x.SendButton,{})}))}))]}))]}))}))})),t.jsxs("div",e.__assign({className:m.default.footerTools},{children:[t.jsx(j.default,e.__assign({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:t.jsx("span",e.__assign({className:m.default.footerToolItem},{children:t.jsx(f.default,{amplitude:1,variant:"speaker",isActive:!1,onClick:function(){return null},disabled:!1})}))})),t.jsx(j.default,e.__assign({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:t.jsx("span",e.__assign({className:m.default.footerToolItem},{children:t.jsx(f.default,{amplitude:1,variant:"microphone",isActive:!1,onClick:function(){return null},disabled:!1})}))}))]})),t.jsx(r.Dialog,e.__assign({open:Lt,onClose:function(){},PaperProps:{sx:{borderRadius:"12px",padding:"8px",maxWidth:"400px",backgroundColor:"var(--il-surface, #ffffff)",color:"var(--il-foreground, #0F172A)"}}},{children:t.jsxs(r.Box,e.__assign({sx:{p:3,textAlign:"center",fontFamily:"'Plus Jakarta Sans', sans-serif"}},{children:[t.jsx("h3",e.__assign({style:{fontSize:"18px",fontWeight:600,color:"var(--il-foreground, #0F172A)",marginBottom:"10px"}},{children:"Session Expired"})),t.jsx("p",e.__assign({style:{fontSize:"14px",color:"var(--il-muted, #64748B)",lineHeight:"1.5",marginBottom:"20px"}},{children:"Changes were made to the learnings in this scope while you were editing. To avoid conflicts, concurrent edits aren’t allowed."})),t.jsxs(r.Box,e.__assign({sx:{display:"flex",gap:2,justifyContent:"center"}},{children:[t.jsx("button",e.__assign({onClick:function(){Wt(!1),Kt()},style:{flex:1,padding:"10px 16px",cursor:"pointer",backgroundColor:"var(--il-secondary-bg, white)",border:"1px solid var(--il-border, #E2E8F0)",borderRadius:"8px",fontSize:"14px",fontWeight:500,color:"var(--il-secondary-fg, #475569)",transition:"all 0.2s"},onMouseOver:function(e){return e.currentTarget.style.backgroundColor="var(--il-hover, #F8FAFC)"},onMouseOut:function(e){return e.currentTarget.style.backgroundColor="var(--il-secondary-bg, white)"}},{children:"Reset Session"})),t.jsx("button",e.__assign({onClick:function(){Wt(!1),null==pe||pe()},style:{flex:1,padding:"10px 16px",backgroundColor:"var(--il-danger, #EF4444)",color:"var(--il-primary-fg, white)",border:"none",borderRadius:"8px",fontSize:"14px",fontWeight:500,cursor:"pointer",transition:"background-color 0.2s"},onMouseOver:function(e){return e.currentTarget.style.backgroundColor="var(--il-danger-hover, #DC2626)"},onMouseOut:function(e){return e.currentTarget.style.backgroundColor="var(--il-danger, #EF4444)"}},{children:"Discard & Close"}))]}))]}))}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("react"),r=require("@mui/material"),a=require("@mui/material/Tooltip"),s=require("react-markdown"),i=require("rehype-raw"),o=require("../../../../api/transport.js"),l=require("uuid"),u=require("@e-llm-studio/streaming-response"),d=require("@e-llm-studio/watch-me-work"),c=require("./ChatHeader.js"),v=require("../MessageRendering/MessageRendering.js"),h=require("../atoms/SkeletonLoader/SkeletonLoader.js"),g=require("../MessageRendering/ClickableChatComponents.js"),f=require("../AudioWaveform.js"),m=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"),b=require("../../../LearningManagement/store/useAuthStore.js");function w(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var k,j=w(a),I=w(s),E=w(i);exports.autoGeneratePrompt=function(e,t){return o.http.post("".concat(e||"https://devllmstudio.creativeworkspace.ai","/api/chat/chatResponse"),{name:"ilggcautopromptgen",organizationName:"techolution",prompt:t||"Generate a query"},{headers:{"Content-Type":"application/json"},withCredentials:!0}).then(function(e){return e.data}).catch(function(e){throw console.error("Error calling auto-generate API:",e),e})},exports.default=function(a){var s=a.chatAssistantName,i=a.organizationName,w=a.baseUrl,T=a.baseWebsocketUrl,R=a.setIsNewChatClicked;a.ThinkingBulbIconComponent;var M=a.isFormSaveClicked,q=a.setIsFormSavedClicked,A=a.onResetLearningData,D=a.sendMessageInChat,N=a.setSendMessageInChat,F=a.isFormValidating,L=a.chatTitle,W=a.customMetaData,B=a.headerMessageHandlers;a.aiResponse;var P=a.setAIResponse,z=a.onResetChat,O=a.initialChatMessage,H=void 0===O?"":O,U=a.onSave,G=a.chatSize,Z=a.setChatSize,K=a.movingTowards,V=a.setCitations,Q=a.textareaPlaceholder,J=void 0===Q?"Tell me more about this learning...":Q,$=a.setCurrentRequestId,X=a.showSavedMessage,Y=void 0!==X&&X,ee=a.savedMessage,te=a.isError,ne=void 0!==te&&te,re=a.errorMessage,ae=void 0===re?"There was an error saving your changes.":re;a.isSaving;var se=a.isHighlighted,ie=void 0!==se&&se,oe=a.onStreamingStateChange,le=a.onViewComparison;a.isCopyEnabled;var ue=a.onComparisonLinkClick,de=a.onSubmitFeedback,ce=a.userDetails,ve=a.isGlobalEditActive,he=a.socketTimeOutInMilliSeconds,ge=a.initialDraftMessage,fe=void 0===ge?"":ge,me=a.onValidateSession,pe=a.onCloseSessionModal,_e=a.fieldLabelMap,Ce=a.enableChatLogs,xe=void 0!==Ce&&Ce,ye=b.default().user,Se=s,be=n.useRef("".concat(Se,"-").concat(i,"-").concat(l.v4())),we=n.useRef("".concat(l.v4())),ke=w,je=n.useRef(null),Ie=n.useRef(!0),Ee=n.useRef(null),Te=n.useRef(null),Re=n.useState(fe),Me=Re[0],qe=Re[1],Ae=n.useState([]),De=Ae[0],Ne=Ae[1],Fe=n.useState(!1),Le=Fe[0],We=Fe[1],Be=n.useState(!1);Be[0];var Pe=Be[1],ze=n.useState(!0),Oe=ze[0],He=ze[1],Ue=n.useState(!0);Ue[0];var Ge=Ue[1],Ze=n.useState("");Ze[0];var Ke=Ze[1],Ve=n.useState(""),Qe=Ve[0],Je=Ve[1],$e=n.useState(!1),Xe=$e[0],Ye=$e[1],et=n.useState(!1),tt=et[0],nt=et[1],rt=n.useState(!0),at=rt[0],st=rt[1],it=n.useState("100%");it[0];var ot=it[1],lt=n.useState(null),ut=lt[0],dt=lt[1],ct=n.useState(!1);ct[0];var vt=ct[1],ht=n.useState(!1),gt=ht[0],ft=ht[1],mt=n.useRef(null),pt=n.useRef(new Set),_t=n.useState(null),Ct=_t[0],xt=_t[1],yt=n.useState(!1),St=yt[0],bt=yt[1],wt=n.useState(!1);wt[0],wt[1];var kt=n.useState(null);kt[0],kt[1],n.useRef(null),n.useRef(null);var jt=n.useRef(new Map),It=n.useRef(""),Et=n.useRef(new Set),Tt=n.useRef(0),Rt=n.useRef(!0),Mt=n.useRef(new Map),qt=n.useRef(!1),At=n.useRef(0),Dt=n.useRef(new Map),Nt=n.useRef(null),Ft=n.useState(!1),Lt=Ft[0],Wt=Ft[1];r.keyframes(k||(k=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 Bt=n.useMemo(function(){return""===(null==Me?void 0:Me.trim())||Xe},[Me,Xe]),Pt=n.useMemo(function(){return F},[F]),zt=n.useMemo(function(){var e;return De.length>0&&"user"===(null===(e=De[De.length-1])||void 0===e?void 0:e.role)},[De]),Ot=n.useMemo(function(){return Bt||F||!!ve||zt},[Bt,F,ve,zt]);n.useEffect(function(){fe&&!Me&&(qe(fe),nt(!0),setTimeout(function(){if(Te.current){Te.current.focus();var e=fe.length;Te.current.setSelectionRange(e,e)}},400))},[fe]),n.useEffect(function(){null==oe||oe(Xe)},[Xe,oe]),n.useEffect(function(){return Rt.current=!0,function(){Rt.current=!1,Tt.current+=1,Dt.current.forEach(function(e){return clearTimeout(e)}),Dt.current.clear(),It.current&&T&&u.stopStreaming(It.current,T,!1)}},[T]),n.useEffect(function(){var e=je.current,t=function(){if(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;st(n-t-r<=20)}};return e&&(e.addEventListener("scroll",t),t()),function(){e&&e.removeEventListener("scroll",t)}},[De]);var Ht=C.useHeaderObserver({handlers:B,setResult:P}).processHeaderMessage;n.useEffect(function(){Y&&ft(!0)},[Y]),n.useEffect(function(){if(St){var e=setTimeout(function(){bt(!1)},3e3);return function(){return clearTimeout(e)}}},[St]),n.useEffect(function(){M&&!ve&&(Xt(new KeyboardEvent("keydown",{key:"Enter"}),!1,"Save this Learning"),q(!1))},[M]),n.useEffect(function(){if(D)try{if(D.startsWith("__SKELETON__:")){var t=D.split(":"),n=t[1],r=t.slice(2).join(":"),a={role:"user",content:"",id:n,time:new Date,isSkeleton:!0,skeletonContent:r};return Ne(function(t){return e.__spreadArray(e.__spreadArray([],t,!0),[a],!1)}),Xt(new KeyboardEvent("keydown",{key:"Enter"}),!1,r,!1,n),xt(n),N&&N(""),void setTimeout(function(){xt(null)},2e3)}if(D.startsWith("__SKELETON_END__::")){var s=D.split("::")[1]||"";return Ne(function(t){return t.map(function(t){return t.isSkeleton?e.__assign(e.__assign({},t),{isSkeleton:!1,content:t.skeletonContent||s}):t})}),void(N&&N(""))}var i=l.v4();Xt(new KeyboardEvent("keydown",{key:"Enter"}),!1,D,!1,i),xt(i),N&&N(""),setTimeout(function(){return xt(null)},2e3)}catch(e){console.error("Error handling sendMessageInChat signal",e)}},[D]),n.useEffect(function(){Gt(),Zt();var e=function(){var e,t=(null===(e=null==mt?void 0:mt.current)||void 0===e?void 0:e.clientHeight)||0,n="calc(100% - ".concat(t,"px - 10px)");ot(n)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var Ut=n.useCallback(function(e){var t="string"==typeof e?e:"smooth";Ee.current&&Ee.current.scrollIntoView({behavior:t,block:"end"}),Ie.current&&setTimeout(function(){Ee.current&&Ie.current&&Ee.current.scrollIntoView({behavior:t,block:"end"})},100)},[]);n.useEffect(function(){if(!Xe){var t="";if(gt?t=ee||"Thank you teacher for teaching me, your rule has been saved successfully.":ne&&(t=ae||"I'm sorry, I couldn't save your changes. Please try again."),t){var n={role:"assistant",content:t,id:l.v4(),citations:[],time:new Date};Ne(function(t){return e.__spreadArray(e.__spreadArray([],t,!0),[n],!1)}),ft(!1),setTimeout(function(){return Ut("smooth")},100)}}},[gt,ne,Xe,ee,ae,Ut]),n.useEffect(function(){Ie.current&&Ut("smooth")},[Ut]);var Gt=function(){var e={method:"get",maxBodyLength:1/0,url:"".concat(ke,"/api/chatbot/getChatSettings?name=").concat(Se,"&organizationName=").concat(i),headers:{}};o.http.request(e).then(function(e){var t,n,r;(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.chatSettings)&&""!==(null===(r=null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.chatSettings)||void 0===r?void 0:r.chatInitialMessage)&&Ge(!0)}).catch(function(e){console.error(e)})},Zt=function(){return e.__awaiter(void 0,void 0,void 0,function(){var t,n;return e.__generator(this,function(e){t="".concat(ke,"/api/chat/history?name=").concat(Se,"&organizationName=").concat(i);try{n={method:"GET",params:{guestSessionId:be.current},withCredentials:!0},o.http.get(t,n).then(function(e){var t=e.data;t.length>0?(Ne(t),Ut()):Ge(!0)}).catch(function(e){console.error(e)})}catch(e){We(!1),console.error(e)}return[2]})})},Kt=function(){var e="".concat(ke,"/api/chat/resetHistory?name=").concat(Se,"&organizationName=").concat(i);try{var t={method:"GET",params:{guestSessionId:be.current},headers:(null==ye?void 0:ye.accessToken)?{Authorization:"Bearer ".concat(ye.accessToken)}:{},withCredentials:!0};o.http.get(e,t).then(function(){R(!0),Ke(""),dt(null),pt.current.clear(),Mt.current.clear(),we.current="".concat(l.v4()),Ne([]),Ge(!0),Nt.current=null,null==z||z(),A&&A()}).catch(function(e){console.error(e)}).finally(function(){be.current="".concat(Se,"-").concat(i,"-").concat(l.v4())})}catch(e){We(!1),console.error(e)}};function Vt(e){return null==e?void 0:e.replace(/<a [^>]*>.*?<\/a>/g,function(e){return null==e?void 0:e.replace(/\*/g,"&ast;")})}var Qt=function(t,n,r,a,s,i,o){var u,d,c,v,h,g,f,m,p,_,C,x,y,S,b,w,k,j,I,E,T,R,M,q,A,D,N,F,L,W;if(null===(d=null===(u=null==t?void 0:t.chatStream)||void 0===u?void 0:u.continueChatResult)||void 0===d?void 0:d.header_message){var B={header_message:t.chatStream.continueChatResult.header_message,responsedata:null===(h=null===(v=null===(c=null==t?void 0:t.chatStream)||void 0===c?void 0:c.continueChatResult)||void 0===v?void 0:v.message)||void 0===h?void 0:h.content};Ht(B)}var P=null===(g=null==t?void 0:t.chatStream)||void 0===g?void 0:g.continueChatResult,z=null==P?void 0:P.isEnd,O=(null===(f=null==P?void 0:P.message)||void 0===f?void 0:f.citations)||[];z&&O.length>0&&V&&V(O);var H={role:"assistant",content:"",id:l.v4()};if(null===(C=null===(_=null===(p=null===(m=null==t?void 0:t.chatStream)||void 0===m?void 0:m.continueChatResult)||void 0===p?void 0:p.message)||void 0===_?void 0:_.content)||void 0===C?void 0:C.includes("WaitMessage: "))Pe(!0),H.content=function(e){var t="WaitMessage: ",n=e.indexOf(t);if(-1!==n){var r=e.substring(n+13);return null==r?void 0:r.replaceAll("WaitMessage: ","")}return""}((null===(S=null===(y=null===(x=null==t?void 0:t.chatStream)||void 0===x?void 0:x.continueChatResult)||void 0===y?void 0:y.message)||void 0===S?void 0:S.content)+"\n\n"),""!==H.content&&(We(!1),Ne(e.__spreadArray(e.__spreadArray([],De,!0),[{role:"user",content:s,time:a,isFirstQuestionSent:i||!1,id:o||(null===(w=null===(b=null==t?void 0:t.chatStream)||void 0===b?void 0:b.continueChatResult)||void 0===w?void 0:w.requestId)||"",reply:""},H],!1)));else{Pe(!1);var U=null===(j=null===(k=null==t?void 0:t.chatStream)||void 0===k?void 0:k.continueChatResult)||void 0===j?void 0:j.requestId;"string"==typeof U&&U&&$&&$(U);var G=function(t,n,r,a){var s,i,o,u,d,c,v,h={role:"assistant",content:"",id:l.v4(),time:new Date,citations:[]},g=(null===(s=null==t?void 0:t.chatStream)||void 0===s?void 0:s.continueChatResult)||{},f=null==g?void 0:g.requestId,m=null==g?void 0:g.preserve_message,p=null==g?void 0:g.isEnd,_=(null===(i=null==g?void 0:g.message)||void 0===i?void 0:i.content)||"",C=null==g?void 0:g.is_orchestrator,x=null==g?void 0:g.thinking_break,y=(null===(o=null==g?void 0:g.message)||void 0===o?void 0:o.citations)||[];if(f&&m&&_&&!p){var S=a.current.get(f)||[];S[S.length-1]!==_&&(S.push(_),a.current.set(f,S))}var b=(f&&a.current.get(f)||[]).join("\n\n"),w="";if(p)w=b&&""!==b.trim()?b:_;else if(m)w=b;else{var k=_.replace(/<!--(?![\s\S]*-->)[\s\S]*$/,"").trimEnd(),j=!1===C||x||0!==y.length?"":k;w=b?"".concat(b,"\n\n").concat(j):j}if(h.content=Vt(w),!0===(null==g?void 0:g.thinking_break)&&!0===(null==g?void 0:g.is_orchestrator)&&!1===(null==g?void 0:g.isEnd)&&n.push({responsedata:_,responseFrom:g.responded_by,header_message:g.header_message,finalResponseStatus:!1}),!1===(null==g?void 0:g.thinking_break)&&!1===(null==g?void 0:g.is_orchestrator)&&!1===(null==g?void 0:g.isEnd)){if(g.explainability_id&&g.responded_by){var I=g.explainability_id,E=g.responded_by;r.has(I)||r.set(I,{responded_by:E,index:n.length})}r.has(g.explainability_id)?n[null==(T=r.get(g.explainability_id))?void 0:T.index]={responsedata:_,responseFrom:g.responded_by,header_message:g.header_message,finalResponseStatus:!0,explainability_id:null!==(u=g.explainability_id)&&void 0!==u?u:"",isParallelToolResponse:!0}:n=e.__spreadArray(e.__spreadArray([],n,!0),[{responsedata:_,responseFrom:g.responded_by,header_message:g.header_message,finalResponseStatus:!0,explainability_id:null!==(d=g.explainability_id)&&void 0!==d?d:"",isParallelToolResponse:!1}],!1)}if(!0===(null==g?void 0:g.thinking_break)&&!1===(null==g?void 0:g.is_orchestrator)&&!1===(null==g?void 0:g.isEnd)){var T;g.explainability_id&&g.responded_by&&(I=g.explainability_id,E=g.responded_by,r.has(I)||r.set(I,{responded_by:E,index:n.length})),r.has(g.explainability_id)?n[null==(T=r.get(g.explainability_id))?void 0:T.index]={responsedata:_,responseFrom:g.responded_by,header_message:g.header_message,finalResponseStatus:!1,explainability_id:null!==(c=g.explainability_id)&&void 0!==c?c:"",isParallelToolResponse:!0}:n.push({responsedata:_,responseFrom:g.responded_by,header_message:g.header_message,finalResponseStatus:!1,explainability_id:null!==(v=g.explainability_id)&&void 0!==v?v:"",isParallelToolResponse:!1})}return e.__assign({orchestratorAndAgentsMessages:n},h)}(t,r,n,Mt);G.time=new Date,G.citations=O,G.isEnd=null===(E=null===(I=null==t?void 0:t.chatStream)||void 0===I?void 0:I.continueChatResult)||void 0===E?void 0:E.isEnd,G.requestId=null===(R=null===(T=null==t?void 0:t.chatStream)||void 0===T?void 0:T.continueChatResult)||void 0===R?void 0:R.requestId,G.sessionId=be.current,null===(M=G.orchestratorAndAgentsMessages)||void 0===M||M.forEach(function(e){e&&e.header_message&&Ht(e)}),(""!==(null==G?void 0:G.content)||(null==G?void 0:G.orchestratorAndAgentsMessages)&&(null==G?void 0:G.orchestratorAndAgentsMessages.length)>0)&&(We(!1),Ne(e.__spreadArray(e.__spreadArray([],De,!0),[{role:"user",content:s||"",time:a,isFirstQuestionSent:i||!1,id:o||(null===(A=null===(q=null==t?void 0:t.chatStream)||void 0===q?void 0:q.continueChatResult)||void 0===A?void 0:A.requestId)||"",requestId:null!==(F=null===(N=null===(D=null==t?void 0:t.chatStream)||void 0===D?void 0:D.continueChatResult)||void 0===N?void 0:N.requestId)&&void 0!==F?F:""},G],!1))),He(null===(W=null===(L=null==t?void 0:t.chatStream)||void 0===L?void 0:L.continueChatResult)||void 0===W?void 0:W.isEnd)}},Jt=n.useCallback(function(t,n){void 0===n&&(n="inactivity"),console.error("🛑 Stream failed or timed out due to:reason=".concat(n," requestId=").concat(t," at ").concat((new Date).toISOString()));var r=Dt.current.get(t);r&&(clearTimeout(r),Dt.current.delete(t)),t&&T&&(u.stopStreaming(t,T,!1),Mt.current.delete(t)),t===It.current?(qt.current=!1,He(!0),Ye(!1),vt(!1),We(!1),Pe(!1),Ne(function(t){var r=e.__spreadArray([],t,!0).reverse().find(function(e){return"user"===e.role}),a=((null==r?void 0:r.content)||"").replace(/"/g,"&quot;"),s=e.__spreadArray([],t,!0),i=s[s.length-1];i&&"assistant"===i.role&&!i.isEnd&&s.pop();var o="I ran into an unexpected issue while trying to process this learning.";return"inactivity"===n?o="Something went wrong—teaching is taking longer than expected.":"websocket_error"===n&&(o="I lost connection to the server while working on that."),e.__spreadArray(e.__spreadArray([],s,!0),[{role:"assistant",content:"".concat(o,' Please try again.\n\n<button class="clickable-button" data-value="').concat(a,'">Retry</button>'),id:l.v4(),time:new Date,isEnd:!0,citations:[]}],!1)})):console.warn("🛑 [handleStreamTimeout] Ignoring stale timeout for superseded requestId=".concat(t,"; active=").concat(It.current))},[he,T]),$t=n.useCallback(function(e){var t=Dt.current.get(e);if(t&&clearTimeout(t),he&&he>0){console.log("⏱️ [Timeout armed] requestId=".concat(e," timeout=").concat(he,"ms at ").concat((new Date).toISOString()));var n=setTimeout(function(){console.warn("⏱️ [Timeout FIRED — auto stop] requestId=".concat(e," at ").concat((new Date).toISOString())),Jt(e,"inactivity")},he);Dt.current.set(e,n)}},[Jt,he]),Xt=function(t,n,r,a,s,o){return e.__awaiter(void 0,void 0,void 0,function(){var a,d,c,v,h,g,f,m,p,_,C,x,y,S,b,w,k;return e.__generator(this,function(j){switch(j.label){case 0:if(a=(void 0!==r?r:Me||"").trim(),(d="Enter"===(null==t?void 0:t.key)&&!(null==t?void 0:t.shiftKey)&&!ve)&&(null===(x=null==t?void 0:t.preventDefault)||void 0===x||x.call(t)),c="user"===(null===(y=De[De.length-1])||void 0===y?void 0:y.role),!a||Xe||qt.current||c||(null==t?void 0:t.key)&&!d)return[2];if(Nt.current||(Nt.current=(new Date).toISOString(),console.log("Session start time set to ".concat(Nt.current))),!me)return[3,5];We(!0),Je("Validating session..."),j.label=1;case 1:return j.trys.push([1,3,,4]),[4,me(Nt.current)];case 2:return j.sent()?[3,4]:(Wt(!0),We(!1),o&&o(!1),[2]);case 3:return v=j.sent(),console.error("Validation error:",v),Wt(!0),We(!1),o&&o(!1),[2];case 4:We(!1),j.label=5;case 5:return qt.current=!0,"I want to add a rule description"===a?(He(!1),Ie.current=!0,Ye(!0),!ut&&a&&dt(r||"manual_entry"),h=new Date,Ne(function(t){return e.__spreadArray(e.__spreadArray([],t.map(function(t,n){var r;return e.__assign(e.__assign({},t),{content:null===(r=Vt(t.content))||void 0===r?void 0:r.replace("WaitMessage: ","")})}),!0),[{role:"user",content:a,time:h,isFirstQuestionSent:!1,id:s||l.v4()}],!1)}),Ut("smooth"),setTimeout(function(){Ne(function(t){return e.__spreadArray(e.__spreadArray([],t,!0),[{role:"assistant",content:"I'd be happy to help you set up a new rule! To get started, could you tell me what kind of behavior or logic you would like this rule to follow?",id:l.v4(),citations:[],time:new Date}],!1)}),Ut("smooth"),setTimeout(function(){Ye(!1),He(!0)},500)},500),[2]):(He(!1),Ie.current=!0,Ye(!0),!ut&&a&&dt(r||"manual_entry"),g=new Date,f=Tt.current,Ne(function(t){var n=t.map(function(t){var n;return e.__assign(e.__assign({},t),{content:null===(n=Vt(t.content))||void 0===n?void 0:n.replace("WaitMessage: ","")})});return s&&n.some(function(e){return e.id===s})?n.map(function(t){return t.id===s?e.__assign(e.__assign({},t),{content:a}):t}):e.__spreadArray(e.__spreadArray([],n,!0),[{role:"user",content:a,time:g,isFirstQuestionSent:!1,id:s||l.v4()}],!1)}),Ut("smooth"),m=new Map,p=[],_=function(e){var t;if(!e)return{};var n=Object.keys(e);return 1===n.length&&"current"===n[0]?null!==(t=e.current)&&void 0!==t?t:{}:e},C={WEBSOCKET_URL:T,organizationName:i,chatAssistantName:Se,selectedAIModel:"gpt-4",replyMessage:"",userName:null!==(S=null==ce?void 0:ce.name)&&void 0!==S?S:"Guest User",userEmailId:null!==(b=null==ce?void 0:ce.email)&&void 0!==b?b:"guestUser@example.com",userId:null!==(w=null==ce?void 0:ce.id)&&void 0!==w?w:"Guest User",query:a,requestId:"requestId-".concat(l.v4()),customPrompt:"",enableForBackend:!1,guestSessionId:be.current,chatPreviewId:we.current,customMetaData:_(W),aiModel:"",enableLogs:!0,logControls:{infoLogs:xe,debugLogs:xe},additionalHeaders:(null==ye?void 0:ye.accessToken)?{Authorization:"Bearer ".concat(ye.accessToken)}:void 0,onStreamEvent:function(e){var t,r,i,o,l,u;if(Rt.current&&Tt.current===f){var d=null===(r=null===(t=null==e?void 0:e.chatStream)||void 0===t?void 0:t.continueChatResult)||void 0===r?void 0:r.requestId,c=null===(o=null===(i=null==e?void 0:e.chatStream)||void 0===i?void 0:i.continueChatResult)||void 0===o?void 0:o.header_message;console.log("📦 [Stream Chunk Received] With RequestID and header_message: ".concat(d,",").concat(c)),$t(C.requestId);var v=null===(u=null===(l=null==e?void 0:e.chatStream)||void 0===l?void 0:l.continueChatResult)||void 0===u?void 0:u.error_state;if(Array.isArray(v)&&v.length>0)return console.error("⚠️ Agent returned an error_state during stream:",{requestId:d,errorState:v}),void Jt(C.requestId,"agent_error");Qt(e,m,p,g,a,n,s)}},onStreamEnd:function(t){var n,r;if(Rt.current&&Tt.current===f){var a=null===(r=null===(n=null==t?void 0:t.chatStream)||void 0===n?void 0:n.continueChatResult)||void 0===r?void 0:r.requestId;Et.current.add(C.requestId),console.log("✅ [Stream Completed] RequestID: ".concat(a));var s=Dt.current.get(C.requestId);s&&(clearTimeout(s),Dt.current.delete(C.requestId)),qt.current=!1,He(!0),Ye(!1),vt(!1);var i=Date.now(),o=jt.current.get(C.requestId);if(o){var l=Math.round((i-o)/1e3).toFixed(1);Ne(function(t){var n=e.__spreadArray([],t,!0).reverse().findIndex(function(e){return"assistant"===e.role});if(-1===n)return t;var r=t.length-1-n;return t.map(function(t,n){return n===r?e.__assign(e.__assign({},t),{finalTimeTaken:l}):t})})}}},onError:function(e){if(Rt.current&&Tt.current===f){var t=Dt.current.get(C.requestId);if(t&&(clearTimeout(t),Dt.current.delete(C.requestId)),Et.current.has(C.requestId))return console.warn("Ignoring post-completion error for already-finished request:",C.requestId),void Et.current.delete(C.requestId);console.error("Stream error:",e),Jt(C.requestId,"websocket_error")}}},a&&(We(!0),null===(k=Te.current)||void 0===k||k.blur(),qe(""),Ut(),Je(s?"Just a moment, processing your request...":"Okay, got it. Let me take a moment to work on this and I'll get back to you shortly."),jt.current.set(C.requestId,Date.now()),It.current=C.requestId,console.log("Chat Stream Params:",C),$t(C.requestId),At.current+=1,console.log("🚀 [UI Action] stream started (Total UI invocations: ".concat(At.current,") | RequestID: ").concat(C.requestId,' | Query: "').concat(a,'"')),u.startChatStream(C)),o&&o(!1),[2])}})})},Yt=n.useRef(null);n.useLayoutEffect(function(){Yt.current=Xt});var en=n.useCallback(function(){for(var t,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return null===(t=Yt.current)||void 0===t?void 0:t.call.apply(t,e.__spreadArray([Yt],n,!1))},[]),tn=n.useMemo(function(){return{p:function(n){n.node;var r=n.children;return e.__rest(n,["node","children"]),t.jsx("div",e.__assign({style:{margin:0,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"10px",fontFamily:"inherit"}},{children:r}))},button:function(n){n.node;var r=n.className,a=n.children,s=e.__rest(n,["node","className","children"]),i=C.extractTextFromChildren(a),o=s["data-value"],l=ut===i||ut===o,u=!!ut||!!ve,d="Tester Genie"===i;return t.jsx(g.ActionableButton,e.__assign({},s,{className:r,handleStream:en,isStreamEnd:Oe,disabled:u,isLastMessage:!0,style:{margin:0},isTesterGenie:d,"data-selected":l?"true":ut?"false":void 0},{children:t.jsxs("span",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[a,d&&t.jsxs("svg",e.__assign({width:"16",height:"20",viewBox:"0 0 16 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[t.jsx("path",{d:"M7.20368 8.94768e-06C7.48895 -0.00208639 7.69331 0.364327 7.83856 0.57465C8.14381 1.01633 8.38012 1.87909 7.71077 2.14118C8.57167 2.21011 9.70406 2.93098 10.1785 3.64699C10.5932 4.27286 10.4559 5.16037 9.80301 5.56007L9.9502 7.16593C9.97671 7.44871 10.0265 7.87092 10.0299 8.14457C10.4213 8.23046 11.0787 8.55391 11.326 8.87592C11.5979 8.75656 11.9189 8.76963 12.1688 8.93469C12.3563 8.67751 12.5598 8.41456 12.7507 8.15787C12.3283 7.45155 12.5047 6.57745 13.2143 6.13784C13.5375 5.9377 13.9264 5.87277 14.2971 5.95705C14.0961 6.30964 13.8775 6.72182 13.6593 7.05857C13.7906 7.2436 13.9184 7.44225 14.044 7.63194L14.8022 7.63198C15.0349 7.30106 15.2515 6.90827 15.4835 6.59349C15.8623 7.0712 15.8156 7.79671 15.4734 8.28241C15.1318 8.76741 14.4886 8.9899 13.9118 8.88251C13.758 9.12108 13.5577 9.39243 13.3941 9.63201C13.7143 9.9316 13.7725 10.364 13.4067 10.6594C13.5231 10.8889 13.5309 11.1613 13.447 11.402C13.1502 12.2523 12.1724 12.5645 11.3474 12.5025C11.1171 12.4852 10.939 12.4698 10.7197 12.3953C10.8724 13.1271 10.7744 14.2031 10.5132 14.9051C10.1688 15.8304 9.43632 16.5569 8.54503 16.9655C7.90465 17.2706 7.21222 17.3607 6.50472 17.4505C5.74445 17.5471 4.75801 17.4362 4.08533 17.825C3.9327 17.9132 3.86566 18.0173 3.82943 18.1792C3.94996 18.5982 4.47858 18.6063 4.78474 18.8897C5.20191 19.2758 4.90716 19.9663 4.36611 19.9908C4.31476 19.9931 4.26867 19.9867 4.23186 19.9493C4.23089 19.8303 4.47587 19.7199 4.49787 19.5262C4.55075 19.0604 3.70014 19.0078 3.37835 18.8374C3.13013 18.706 2.99537 18.6309 2.82242 18.4021C2.63795 18.1579 2.58428 17.835 2.63138 17.5392C2.74868 16.7847 3.47123 16.393 4.12184 16.1497C4.61314 15.9659 5.46304 15.7158 5.52019 15.0793C5.58589 14.348 4.97543 13.5523 4.57739 12.9807C4.44275 12.7875 4.3039 12.579 4.16309 12.3919C4.18987 12.365 4.21049 12.3463 4.23916 12.3212C4.59619 12.6218 5.21209 12.6421 5.55038 12.2979C5.70457 12.144 5.78974 11.9342 5.78642 11.7164C5.78121 11.4493 5.63382 11.2002 5.4454 11.019C5.44704 10.9932 5.44824 10.9676 5.449 10.9419C5.4566 10.6648 5.37505 10.4902 5.1892 10.2943C5.18398 10.2538 5.17776 10.2134 5.17053 10.1732C5.08123 9.69297 4.71708 9.34182 4.23415 9.27108C4.16418 9.26083 3.96108 9.26105 3.92071 9.23344C3.90485 9.1828 3.9059 9.20792 3.91904 9.15527C4.22103 8.90139 4.14407 8.78214 4.31107 8.4846C4.42301 8.28513 4.73047 8.15239 4.95452 8.10701C4.96167 7.51076 5.03684 6.88562 5.10036 6.29144C5.12451 6.0655 5.12531 5.75046 5.1511 5.55257C4.11108 4.86747 4.39091 3.75946 5.25465 3.06391C5.84978 2.58469 6.34496 2.31002 7.10143 2.14517C7.01589 2.10416 6.93842 2.04811 6.87269 1.97972C6.77021 1.87349 6.70248 1.73857 6.67853 1.59293C6.60568 1.12096 7.04104 0.914625 7.18759 0.526392C7.26428 0.323403 7.03925 0.146075 7.20368 8.94768e-06Z",fill:"#475569"}),t.jsx("path",{d:"M7.459 4.5C7.48797 4.50312 7.71949 4.61154 7.76205 4.63061C8.27062 4.85835 8.87051 5.09164 9.35658 5.3582C9.36602 6.03495 9.37016 6.56625 8.70573 6.91519C8.6633 6.80883 8.63019 6.72409 8.56332 6.63044C8.43786 6.45568 8.24656 6.33963 8.03354 6.30909C7.8434 6.28211 7.65146 6.3197 7.49586 6.43503C7.21897 6.21256 6.76265 6.28197 6.5229 6.52486C6.39308 6.65639 6.34815 6.75074 6.28902 6.92344C5.59702 6.5957 5.58761 6.04267 5.60583 5.35582C5.89882 5.23844 6.21318 5.0724 6.50153 4.941C6.82145 4.79522 7.14482 4.6574 7.459 4.5Z",fill:"#D1EDFD"}),t.jsx("path",{d:"M11.0756 10.6406C11.1037 10.6701 11.1324 10.7706 11.1535 10.8145C11.2818 11.0817 11.4922 11.1945 11.7498 11.2977C11.5607 11.63 11.4567 11.8797 11.1034 12.0466L11.0839 12.0517C10.9262 12.0927 10.7996 12.0968 10.651 12.0135C10.4755 11.915 10.3807 11.6614 10.4792 11.478C10.6388 11.1809 10.8877 10.9272 11.0756 10.6406Z",fill:"#D1EDFD"}),t.jsx("path",{d:"M11.6036 9.1377C11.6993 9.11763 11.8391 9.16378 11.9294 9.19593C11.6952 9.50644 11.4706 9.81614 11.2327 10.1261L11.1572 10.2255C10.7581 9.73539 11.0333 9.24481 11.6036 9.1377Z",fill:"#D1EDFD"}),t.jsx("path",{d:"M7.49681 0.882812C7.53691 0.925159 7.61244 1.08523 7.63598 1.14156C7.74243 1.39673 7.75769 1.76908 7.38596 1.77504C7.28236 1.75599 7.15628 1.68938 7.13517 1.5783C7.0843 1.3107 7.35609 1.09964 7.48737 0.897583L7.49681 0.882812Z",fill:"#D1EDFD"}),t.jsx("path",{d:"M1.68305 6.17249C1.71659 6.1673 1.8134 6.16478 1.84892 6.16432C2.34052 6.15616 2.81496 6.34495 3.16655 6.68866C3.50847 7.01806 3.70349 7.47119 3.70765 7.94596C3.70896 8.42345 3.54045 8.85284 3.20281 9.19025C3.34033 9.28068 3.5321 9.52219 3.6543 9.65748C4.17158 9.39073 4.91447 9.69339 4.79675 10.3444C5.08751 10.5485 5.19656 10.8288 5.0585 11.1674C5.15418 11.2375 5.25595 11.3205 5.32383 11.4186C5.40228 11.5303 5.4309 11.6695 5.40291 11.8031C5.32228 12.1857 4.90085 12.3286 4.57669 12.1236C4.51367 12.0838 4.42258 11.9595 4.35299 11.9431C4.30669 11.9557 4.28453 11.9584 4.23644 11.9644C4.22885 11.9742 4.22118 11.9841 4.21343 11.9938C3.93597 12.3413 3.49234 12.4682 3.06933 12.5157C2.85285 12.518 2.70432 12.5146 2.49066 12.4609C1.80785 12.2892 1.50808 11.6167 1.70723 10.9639C1.829 10.5648 2.11891 10.2506 2.48939 10.0518C2.54655 10.132 2.57559 10.2191 2.64066 10.303C2.73571 10.2223 2.82048 10.1482 2.92363 10.0773C2.81023 9.95313 2.66811 9.7693 2.55817 9.63584C2.38871 9.6878 2.23026 9.72879 2.05298 9.74653C1.54239 9.80228 1.03118 9.64711 0.637735 9.31695C0.269964 9.01018 0.0453493 8.54827 0.00544736 8.07322C-0.0309495 7.60988 0.116099 7.15077 0.414918 6.79478C0.742554 6.41198 1.18728 6.21393 1.68305 6.17249Z",fill:"#475569"}),t.jsx("path",{d:"M1.79616 6.5951C2.54894 6.5619 3.18687 7.14364 3.22301 7.8963C3.25915 8.64894 2.67989 9.28913 1.92739 9.3282C1.17073 9.3675 0.526231 8.78435 0.489885 8.02753C0.45354 7.27071 1.03921 6.62849 1.79616 6.5951Z",fill:"#D1EDFD"}),t.jsx("path",{d:"M4.93607 11.4844C5.12839 11.6261 5.22049 11.9085 4.91876 11.9419C4.8067 11.8805 4.78491 11.8646 4.71094 11.7561C4.81572 11.6752 4.862 11.5925 4.93607 11.4844Z",fill:"#FEFEFD"}),t.jsx("path",{d:"M12.5164 3.58594L12.5715 3.59466C12.6589 3.65863 12.6908 3.94434 12.7882 4.05193C12.8789 4.15216 12.9155 4.17816 13.0326 4.24929C13.1363 4.31224 13.3325 4.34025 13.384 4.43124C13.3643 4.56218 13.0693 4.54857 12.9127 4.69344C12.6903 4.89898 12.7114 5.06971 12.5892 5.28622C12.5669 5.28439 12.5368 5.2868 12.5261 5.27346C12.4336 5.15843 12.4072 4.9308 12.3099 4.81465C12.1627 4.63903 11.9972 4.60054 11.7981 4.51372C11.7544 4.49467 11.7266 4.47099 11.7129 4.42649C11.7867 4.31876 12.0509 4.34309 12.2376 4.14892C12.43 3.94901 12.4155 3.72208 12.5164 3.58594Z",fill:"#475569"}),t.jsx("path",{d:"M2.13644 3.72656C2.24401 3.77084 2.29712 4.1268 2.431 4.25226C2.60327 4.41371 2.7311 4.41949 2.93246 4.52449C2.96024 4.53897 2.97173 4.56042 2.97671 4.58878C2.89584 4.6981 2.61854 4.70721 2.4596 4.85659C2.26275 5.04156 2.27341 5.29132 2.17022 5.42088C2.16192 5.41849 2.11671 5.40232 2.1156 5.40043C2.01291 5.21216 1.9836 5.04909 1.84812 4.87273C1.73599 4.72675 1.36534 4.69959 1.32812 4.56939C1.3835 4.47941 1.67823 4.44211 1.82291 4.30563C2.02737 4.11274 2.0042 3.8372 2.13644 3.72656Z",fill:"#475569"})]}))]}))}))}}},[en,Oe,ut,ve]),nn=n.useMemo(function(){return De.some(function(e){return e.isSkeleton})},[De]),rn=function(t){return e.__awaiter(void 0,void 0,void 0,function(){return e.__generator(this,function(n){switch(n.label){case 0:return de?[4,de(t)]:[3,2];case 1:n.sent(),Ne(function(t){return e.__spreadArray(e.__spreadArray([],t,!0),[{role:"assistant",content:"Thanks for your feedback — this will help improve future suggestions.",id:l.v4(),citations:[],time:new Date,isEnd:!0}],!1)}),setTimeout(function(){return Ut("smooth")},100),n.label=2;case 2:return[2]}})})};return t.jsxs("div",e.__assign({className:"".concat(p.default.customFont," ").concat(m.default.chatContainer),style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:ie&&!nn?"0 0 20px 5px rgba(37, 99, 235, 0.5)":"none"}},{children:[t.jsxs("div",e.__assign({ref:je,className:m.default.scrollWrapper},{children:[t.jsx("div",e.__assign({ref:mt,className:m.default.stickyHeader},{children:t.jsx(c.default,{resetChatHistory:Kt,isStreamEnd:Oe,chatTitle:L,onResize:Z,chatSize:G,movingTowards:K})})),t.jsxs("div",e.__assign({className:m.default.messagesList},{children:[t.jsxs("div",e.__assign({className:m.default.initialMessageRow},{children:[t.jsx("div",e.__assign({className:m.default.iconWrapper},{children:t.jsx(y.default,{})})),t.jsx("div",e.__assign({className:m.default.welcomeTextWrapper},{children:t.jsx("div",e.__assign({className:m.default.welcomeMarkdownWrapper},{children:t.jsx("span",{children:t.jsx(I.default,e.__assign({rehypePlugins:[E.default],components:tn},{children:H}))})}))}))]})),De.length>0&&De.map(function(n,r){var a,s;return t.jsxs("div",e.__assign({className:m.default.messageRow},{children:["assistant"===n.role?t.jsx("div",e.__assign({className:m.default.assistantIconContainer},{children:t.jsx(y.default,{})})):t.jsx("div",{className:m.default.userSpacer}),t.jsx("div",e.__assign({className:m.default.messageContent},{children:"assistant"===n.role?t.jsxs(t.Fragment,{children:[n.orchestratorAndAgentsMessages&&n.orchestratorAndAgentsMessages.length>0&&t.jsx(d.WatchMeWork,{orchestratorAndAgentsMessages:null==n?void 0:n.orchestratorAndAgentsMessages,isStreamEnd:Oe,finalTimeTaken:null==n?void 0:n.finalTimeTaken},null!==(a=null==n?void 0:n.finalTimeTaken)&&void 0!==a?a:null==n?void 0:n.id),t.jsx(v.default,{index:r,content:null==n?void 0:n.content,role:null==n?void 0:n.role,messages:De,handleStream:en,isLastMessage:r===De.length-1,onSave:U,citations:null==n?void 0:n.citations,setChatSize:Z,chatSize:G,isStreamEnd:Oe,messageIsEnd:null==n?void 0:n.isEnd,onViewComparison:le,onTypeResponseClick:function(){var e;bt(!0),null===(e=Te.current)||void 0===e||e.focus()},onComparisonLinkClick:ue,baseURL:ke,onFeedbackSubmit:rn,isGlobalEditActive:ve,fieldLabelMap:_e}),n.hasOwnProperty("isEnd")&&!(null==n?void 0:n.isEnd)&&(null===(s=null==n?void 0:n.content)||void 0===s?void 0:s.length)>0&&t.jsxs(t.Fragment,{children:[t.jsx(h.Skeleton,{variant:"text",width:"50%",height:20}),t.jsx("div",{style:{marginTop:"10px"}}),t.jsx(h.Skeleton,{variant:"text",width:"100%",height:40})]}),t.jsx("div",e.__assign({className:m.default.timestamp},{children:n.time&&!isNaN(new Date(n.time).getTime())?new Date(n.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}):t.jsxs("div",e.__assign({className:m.default.userMessageWrapper},{children:[t.jsxs("div",e.__assign({className:m.default.userMessageBubble,style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:n.isSkeleton||nn||n.id!==Ct?"none":"0 0 15px 3px rgba(37, 99, 235, 0.6)"}},{children:[n.isSkeleton?t.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:"12px",minWidth:"280px",padding:"8px 0"}},{children:[t.jsx(h.Skeleton,{variant:"text",width:"100%",height:16}),t.jsx(h.Skeleton,{variant:"text",width:"80%",height:16})]})):t.jsx(v.default,{index:r,content:null==n?void 0:n.content,role:null==n?void 0:n.role,messages:De,handleStream:en,isLastMessage:r===De.length-1,onSave:U,citations:null==n?void 0:n.citations,isStreamEnd:Oe,isGlobalEditActive:ve,messageIsEnd:null==n?void 0:n.isEnd,onViewComparison:le,onComparisonLinkClick:ue,baseURL:ke,onFeedbackSubmit:rn,fieldLabelMap:_e}),t.jsx("div",e.__assign({style:{marginTop:"0.5rem"}},{children:t.jsx(S.UserIcon,{})}))]})),t.jsx("div",e.__assign({className:m.default.userTimestamp},{children:new Date(n.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}))}))]}),n.id)}),Le&&t.jsxs("div",e.__assign({className:m.default.loadingRow},{children:[t.jsx("div",e.__assign({className:m.default.iconWrapper,style:{marginTop:"0.2rem"}},{children:t.jsx(y.default,{})})),t.jsx("div",e.__assign({className:m.default.loadingTextWrapper},{children:t.jsx("span",{children:Qe})}))]})),t.jsx("div",{ref:Ee,style:{float:"left",clear:"both"}})]}))]})),t.jsx("div",e.__assign({className:m.default.inputAreaWrapper},{children:t.jsx(j.default,e.__assign({title:F?"Please wait for the validation to be completed.":""},{children:t.jsxs("div",e.__assign({className:"".concat(m.default.inputBoxContainer," ").concat(Pt?m.default.disabled:""),style:St?{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:[De.length>0&&!at&&t.jsx("div",e.__assign({onMouseDown:function(e){e.preventDefault(),Ut("smooth")},className:m.default.scrollToBottomBtn},{children:t.jsx(_.ScrollToBottom,{})})),t.jsxs("div",e.__assign({style:{width:"100%",display:"flex"}},{children:[t.jsx("textarea",{ref:Te,placeholder:J,value:Me||"",onChange:function(e){qe(e.target.value)},onFocus:function(){return nt(!0)},onBlur:function(){return nt(!1)},onKeyDown:function(e){return Xt(e)},disabled:Pt,className:"no-scrollbar ".concat(m.default.chatTextarea),style:{minHeight:tt||Me&&Me.length>40?"120px":"50px",height:tt||Me&&Me.length>40?"120px":"50px",maxHeight:"120px"}}),t.jsx("span",e.__assign({className:m.default.sendButtonWrapper},{children:t.jsx("button",e.__assign({onClick:function(e){Ot||Xt(new KeyboardEvent("keydown",{key:"Enter"}))},disabled:Ot,className:"".concat(m.default.sendButton," ").concat(Ot?m.default.disabled:m.default.active)},{children:t.jsx(x.SendButton,{})}))}))]}))]}))}))})),t.jsxs("div",e.__assign({className:m.default.footerTools},{children:[t.jsx(j.default,e.__assign({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:t.jsx("span",e.__assign({className:m.default.footerToolItem},{children:t.jsx(f.default,{amplitude:1,variant:"speaker",isActive:!1,onClick:function(){return null},disabled:!1})}))})),t.jsx(j.default,e.__assign({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:t.jsx("span",e.__assign({className:m.default.footerToolItem},{children:t.jsx(f.default,{amplitude:1,variant:"microphone",isActive:!1,onClick:function(){return null},disabled:!1})}))}))]})),t.jsx(r.Dialog,e.__assign({open:Lt,onClose:function(){},PaperProps:{sx:{borderRadius:"12px",padding:"8px",maxWidth:"400px",backgroundColor:"var(--il-surface, #ffffff)",color:"var(--il-foreground, #0F172A)"}}},{children:t.jsxs(r.Box,e.__assign({sx:{p:3,textAlign:"center",fontFamily:"'Plus Jakarta Sans', sans-serif"}},{children:[t.jsx("h3",e.__assign({style:{fontSize:"18px",fontWeight:600,color:"var(--il-foreground, #0F172A)",marginBottom:"10px"}},{children:"Session Expired"})),t.jsx("p",e.__assign({style:{fontSize:"14px",color:"var(--il-muted, #64748B)",lineHeight:"1.5",marginBottom:"20px"}},{children:"Changes were made to the learnings in this scope while you were editing. To avoid conflicts, concurrent edits aren’t allowed."})),t.jsxs(r.Box,e.__assign({sx:{display:"flex",gap:2,justifyContent:"center"}},{children:[t.jsx("button",e.__assign({onClick:function(){Wt(!1),Kt()},style:{flex:1,padding:"10px 16px",cursor:"pointer",backgroundColor:"var(--il-secondary-bg, white)",border:"1px solid var(--il-border, #E2E8F0)",borderRadius:"8px",fontSize:"14px",fontWeight:500,color:"var(--il-secondary-fg, #475569)",transition:"all 0.2s"},onMouseOver:function(e){return e.currentTarget.style.backgroundColor="var(--il-hover, #F8FAFC)"},onMouseOut:function(e){return e.currentTarget.style.backgroundColor="var(--il-secondary-bg, white)"}},{children:"Reset Session"})),t.jsx("button",e.__assign({onClick:function(){Wt(!1),null==pe||pe()},style:{flex:1,padding:"10px 16px",backgroundColor:"var(--il-danger, #EF4444)",color:"var(--il-primary-fg, white)",border:"none",borderRadius:"8px",fontSize:"14px",fontWeight:500,cursor:"pointer",transition:"background-color 0.2s"},onMouseOver:function(e){return e.currentTarget.style.backgroundColor="var(--il-danger-hover, #DC2626)"},onMouseOut:function(e){return e.currentTarget.style.backgroundColor="var(--il-danger, #EF4444)"}},{children:"Discard & Close"}))]}))]}))}))]}))};
2
2
  //# sourceMappingURL=ChatComponent.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("react"),a=require("@mui/material"),s=require("@mui/material/Tooltip"),i=require("react-markdown"),o=require("rehype-raw"),r=require("../../../../api/transport.js"),l=require("uuid"),u=require("@e-llm-studio/streaming-response"),d=require("@e-llm-studio/watch-me-work"),c=require("./ChatHeader.js"),h=require("../MessageRendering/MessageRendering.js"),v=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"),C=require("../_svg/ScrollToBottom.js"),_=require("../../helpers/utils.js"),x=require("../_svg/SendButton.js"),S=require("../_svg/SparkleIcon.js"),y=require("../_svg/UserIcon.js"),b=require("../../../LearningManagement/store/useAuthStore.js");function R(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var j,w=R(s),k=R(i),E=R(o);exports.default=function(s){var i=s.chatAssistantName,o=s.organizationName,R=s.baseUrl,M=s.baseWebsocketUrl,T=s.setIsNewChatClicked;s.ThinkingBulbIconComponent;var A=s.isFormSaveClicked,I=s.setIsFormSavedClicked,N=s.onResetLearningData,D=s.sendMessageInChat,q=s.setSendMessageInChat,L=s.isFormValidating,F=s.chatTitle,B=s.customMetaData,W=s.headerMessageHandlers;s.aiResponse;var z=s.setAIResponse,P=s.onResetChat,H=s.initialChatMessage,U=void 0===H?"":H,Z=s.onSave,K=s.chatSize,O=s.setChatSize,G=s.movingTowards,V=s.setCitations,J=s.textareaPlaceholder,Q=void 0===J?"Tell me more about this learning...":J,X=s.setCurrentRequestId,Y=s.showSavedMessage,$=void 0!==Y&&Y,ee=s.savedMessage,te=s.isError,ne=void 0!==te&&te,ae=s.errorMessage,se=void 0===ae?"There was an error saving your changes.":ae;s.isSaving;var ie=s.isHighlighted,oe=void 0!==ie&&ie,re=s.onStreamingStateChange,le=s.onViewComparison;s.isCopyEnabled;var ue=s.onComparisonLinkClick,de=s.onSubmitFeedback,ce=b.default().user,he=i,ve=n.useRef("".concat(he,"-").concat(o,"-").concat(l.v4())),me=n.useRef("".concat(l.v4())),fe=R,ge=n.useRef(null),pe=n.useRef(!0),Ce=n.useRef(null),_e=n.useRef(null),xe=n.useState(""),Se=xe[0],ye=xe[1],be=n.useState([]),Re=be[0],je=be[1],we=n.useState(!1),ke=we[0],Ee=we[1],Me=n.useState(!1);Me[0];var Te=Me[1],Ae=n.useState(!0),Ie=Ae[0],Ne=Ae[1],De=n.useState(!0);De[0];var qe=De[1],Le=n.useState("");Le[0];var Fe=Le[1],Be=n.useState(""),We=Be[0],ze=Be[1],Pe=n.useState(!1),He=Pe[0],Ue=Pe[1],Ze=n.useState(!1),Ke=Ze[0],Oe=Ze[1],Ge=n.useState(!0),Ve=Ge[0],Je=Ge[1],Qe=n.useState("100%");Qe[0];var Xe=Qe[1],Ye=n.useState(null),$e=Ye[0],et=Ye[1],tt=n.useState(!1);tt[0];var nt=tt[1],at=n.useState(!1),st=at[0],it=at[1],ot=n.useRef(null),rt=n.useRef(new Set),lt=n.useState(null),ut=lt[0],dt=lt[1],ct=n.useState(!1),ht=ct[0],vt=ct[1],mt=n.useState(!1);mt[0],mt[1];var ft=n.useState(null);ft[0],ft[1],n.useRef(null),n.useRef(null);var gt=n.useRef(new Map),pt=n.useRef(""),Ct=n.useRef(0),_t=n.useRef(!0),xt=a.keyframes(j||(j=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 "]))),St=n.useMemo(function(){return""===(null==Se?void 0:Se.trim())||He},[Se,He]),yt=n.useMemo(function(){return L},[L]),bt=n.useMemo(function(){return St||He||L},[St,He,L]);n.useEffect(function(){null==re||re(He)},[He,re]),n.useEffect(function(){return _t.current=!0,function(){_t.current=!1,Ct.current+=1,pt.current&&M&&u.stopStreaming(pt.current,M,!1)}},[M]),n.useEffect(function(){var e=ge.current,t=function(){if(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;Je(n-t-a<=20)}};return e&&(e.addEventListener("scroll",t),t()),function(){e&&e.removeEventListener("scroll",t)}},[Re]);var Rt=_.useHeaderObserver({handlers:W,setResult:z}).processHeaderMessage;n.useEffect(function(){$&&it(!0)},[$]),n.useEffect(function(){if(ht){var e=setTimeout(function(){vt(!1)},3e3);return function(){return clearTimeout(e)}}},[ht]),n.useEffect(function(){A&&(Tt(new KeyboardEvent("keydown",{key:"Enter"}),!1,"Save this Learning"),I(!1))},[A]),n.useEffect(function(){if(D)try{if(D.startsWith("__SKELETON__:")){var t=D.split(":"),n=t[1],a=t.slice(2).join(":"),s={role:"user",content:"",id:n,time:new Date,isSkeleton:!0,skeletonContent:a};return je(function(t){return e.__spreadArray(e.__spreadArray([],t,!0),[s],!1)}),Tt(new KeyboardEvent("keydown",{key:"Enter"}),!1,a,!1,n),dt(n),q&&q(""),void setTimeout(function(){dt(null)},2e3)}if(D.startsWith("__SKELETON_END__::")){var i=D.split("::")[1]||"";return je(function(t){return t.map(function(t){return t.isSkeleton?e.__assign(e.__assign({},t),{isSkeleton:!1,content:t.skeletonContent||i}):t})}),void(q&&q(""))}var o=l.v4();Tt(new KeyboardEvent("keydown",{key:"Enter"}),!1,D,!1,o),dt(o),q&&q(""),setTimeout(function(){return dt(null)},2e3)}catch(e){console.error("Error handling sendMessageInChat signal",e)}},[D]),n.useEffect(function(){wt(),kt();var e=function(){var e,t=(null===(e=null==ot?void 0:ot.current)||void 0===e?void 0:e.clientHeight)||0,n="calc(100% - ".concat(t,"px - 10px)");Xe(n)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var jt=n.useCallback(function(e){var t="string"==typeof e?e:"smooth";Ce.current&&Ce.current.scrollIntoView({behavior:t,block:"end"}),pe.current&&setTimeout(function(){Ce.current&&pe.current&&Ce.current.scrollIntoView({behavior:t,block:"end"})},100)},[]);n.useEffect(function(){if(!He){var t="";if(st?t=ee||"Thank you teacher for teaching me, your rule has been saved successfully.":ne&&(t=se||"I'm sorry, I couldn't save your changes. Please try again."),t){var n={role:"assistant",content:t,id:l.v4(),citations:[],time:new Date};je(function(t){return e.__spreadArray(e.__spreadArray([],t,!0),[n],!1)}),it(!1),setTimeout(function(){return jt("smooth")},100)}}},[st,ne,He,ee,se,jt]),n.useEffect(function(){pe.current&&jt("smooth")},[jt]);var wt=function(){var e={method:"get",maxBodyLength:1/0,url:"".concat(fe,"/api/chatbot/getChatSettings?name=").concat(he,"&organizationName=").concat(o),headers:{}};r.http.request(e).then(function(e){var t,n,a;(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.chatSettings)&&""!==(null===(a=null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.chatSettings)||void 0===a?void 0:a.chatInitialMessage)&&qe(!0)}).catch(function(e){console.error(e)})},kt=function(){return e.__awaiter(void 0,void 0,void 0,function(){var t,n;return e.__generator(this,function(e){t="".concat(fe,"/api/chat/history?name=").concat(he,"&organizationName=").concat(o);try{n={method:"GET",params:{guestSessionId:ve.current},withCredentials:!0},r.http.get(t,n).then(function(e){var t=e.data;t.length>0?(je(t),jt()):qe(!0)}).catch(function(e){console.error(e)})}catch(e){Ee(!1),console.error(e)}return[2]})})};function Et(e){return null==e?void 0:e.replace(/<a [^>]*>.*?<\/a>/g,function(e){return null==e?void 0:e.replace(/\*/g,"&ast;")})}var Mt=function(t,n,a,s,i,o,r){var u,d,c,h,v,m,f,g,p,C,_,x,S,y,b,R,j,w,k,E,M,T,A,I,N,D,q,L,F,B,W,z,P,H;if(null===(d=null===(u=null==t?void 0:t.chatStream)||void 0===u?void 0:u.continueChatResult)||void 0===d?void 0:d.header_message){var U={header_message:t.chatStream.continueChatResult.header_message,responsedata:null===(v=null===(h=null===(c=null==t?void 0:t.chatStream)||void 0===c?void 0:c.continueChatResult)||void 0===h?void 0:h.message)||void 0===v?void 0:v.content};Rt(U)}var Z=null===(m=null==t?void 0:t.chatStream)||void 0===m?void 0:m.continueChatResult,K=null==Z?void 0:Z.isEnd,O=(null===(f=null==Z?void 0:Z.message)||void 0===f?void 0:f.citations)||[];K&&O.length>0&&V&&V(O);var G={role:"assistant",content:"",id:l.v4()};if(null===(_=null===(C=null===(p=null===(g=null==t?void 0:t.chatStream)||void 0===g?void 0:g.continueChatResult)||void 0===p?void 0:p.message)||void 0===C?void 0:C.content)||void 0===_?void 0:_.includes("WaitMessage: "))Te(!0),G.content=function(e){var t="WaitMessage: ",n=e.indexOf(t);if(-1!==n){var a=e.substring(n+13);return null==a?void 0:a.replaceAll("WaitMessage: ","")}return""}((null===(y=null===(S=null===(x=null==t?void 0:t.chatStream)||void 0===x?void 0:x.continueChatResult)||void 0===S?void 0:S.message)||void 0===y?void 0:y.content)+"\n\n"),""!==G.content&&(Ee(!1),je(e.__spreadArray(e.__spreadArray([],Re,!0),[{role:"user",content:i,time:s,isFirstQuestionSent:o||!1,id:r||(null===(R=null===(b=null==t?void 0:t.chatStream)||void 0===b?void 0:b.continueChatResult)||void 0===R?void 0:R.requestId)||"",reply:""},G],!1)));else{Te(!1),G.content=null===(E=Et(null===(k=null===(w=null===(j=null==t?void 0:t.chatStream)||void 0===j?void 0:j.continueChatResult)||void 0===w?void 0:w.message)||void 0===k?void 0:k.content))||void 0===E?void 0:E.replaceAll("WaitMessage: ","");var J=null===(T=null===(M=null==t?void 0:t.chatStream)||void 0===M?void 0:M.continueChatResult)||void 0===T?void 0:T.requestId;"string"==typeof J&&J&&X&&X(J);var Q=function(t,n,a){var s,i,o,r,u,d,c,h,v,m,f,g,p,C,_,x,S,y,b,R,j,w,k,E,M,T,A,I,N,D,q,L,F,B,W={role:"assistant",content:"",id:l.v4(),time:new Date,citations:[]};if(!1===(null===(i=null===(s=t.chatStream)||void 0===s?void 0:s.continueChatResult)||void 0===i?void 0:i.thinking_break)&&!0===(null===(r=null===(o=t.chatStream)||void 0===o?void 0:o.continueChatResult)||void 0===r?void 0:r.is_orchestrator)&&!1===(null===(d=null===(u=t.chatStream)||void 0===u?void 0:u.continueChatResult)||void 0===d?void 0:d.isEnd)&&(W.content=Et(t.chatStream.continueChatResult.message.content||"")),!0===(null===(h=null===(c=t.chatStream)||void 0===c?void 0:c.continueChatResult)||void 0===h?void 0:h.thinking_break)&&!0===(null===(m=null===(v=t.chatStream)||void 0===v?void 0:v.continueChatResult)||void 0===m?void 0:m.is_orchestrator)&&!1===(null===(g=null===(f=t.chatStream)||void 0===f?void 0:f.continueChatResult)||void 0===g?void 0:g.isEnd)&&(W.content="",n.push({responsedata:t.chatStream.continueChatResult.message.content,responseFrom:t.chatStream.continueChatResult.responded_by,header_message:t.chatStream.continueChatResult.header_message,finalResponseStatus:!1})),!1===(null===(C=null===(p=t.chatStream)||void 0===p?void 0:p.continueChatResult)||void 0===C?void 0:C.thinking_break)&&!0===(null===(x=null===(_=t.chatStream)||void 0===_?void 0:_.continueChatResult)||void 0===x?void 0:x.is_orchestrator)&&!0===(null===(y=null===(S=t.chatStream)||void 0===S?void 0:S.continueChatResult)||void 0===y?void 0:y.isEnd)&&(W.content=Et(t.chatStream.continueChatResult.message.content)),!1===(null===(R=null===(b=t.chatStream)||void 0===b?void 0:b.continueChatResult)||void 0===R?void 0:R.thinking_break)&&!1===(null===(w=null===(j=t.chatStream)||void 0===j?void 0:j.continueChatResult)||void 0===w?void 0:w.is_orchestrator)&&!1===(null===(E=null===(k=t.chatStream)||void 0===k?void 0:k.continueChatResult)||void 0===E?void 0:E.isEnd)){if((H=t.chatStream.continueChatResult).explainability_id&&H.responded_by){var z=H.explainability_id,P=H.responded_by;a.has(z)||a.set(z,{responded_by:P,index:n.length})}a.has(t.chatStream.continueChatResult.explainability_id)?n[null==(U=a.get(t.chatStream.continueChatResult.explainability_id))?void 0:U.index]={responsedata:t.chatStream.continueChatResult.message.content,responseFrom:t.chatStream.continueChatResult.responded_by,header_message:t.chatStream.continueChatResult.header_message,finalResponseStatus:!0,explainability_id:null!==(M=t.chatStream.continueChatResult.explainability_id)&&void 0!==M?M:"",isParallelToolResponse:!0}:n=e.__spreadArray(e.__spreadArray([],n,!0),[{responsedata:t.chatStream.continueChatResult.message.content,responseFrom:t.chatStream.continueChatResult.responded_by,header_message:t.chatStream.continueChatResult.header_message,finalResponseStatus:!0,explainability_id:null!==(T=t.chatStream.continueChatResult.explainability_id)&&void 0!==T?T:"",isParallelToolResponse:!1}],!1)}if(!0===(null===(I=null===(A=t.chatStream)||void 0===A?void 0:A.continueChatResult)||void 0===I?void 0:I.thinking_break)&&!1===(null===(D=null===(N=t.chatStream)||void 0===N?void 0:N.continueChatResult)||void 0===D?void 0:D.is_orchestrator)&&!1===(null===(L=null===(q=t.chatStream)||void 0===q?void 0:q.continueChatResult)||void 0===L?void 0:L.isEnd)){var H,U;(H=t.chatStream.continueChatResult).explainability_id&&H.responded_by&&(z=H.explainability_id,P=H.responded_by,a.has(z)||a.set(z,{responded_by:P,index:n.length})),a.has(t.chatStream.continueChatResult.explainability_id)?n[null==(U=a.get(t.chatStream.continueChatResult.explainability_id))?void 0:U.index]={responsedata:t.chatStream.continueChatResult.message.content,responseFrom:t.chatStream.continueChatResult.responded_by,header_message:t.chatStream.continueChatResult.header_message,finalResponseStatus:!1,explainability_id:null!==(F=t.chatStream.continueChatResult.explainability_id)&&void 0!==F?F:"",isParallelToolResponse:!0}:n.push({responsedata:t.chatStream.continueChatResult.message.content,responseFrom:t.chatStream.continueChatResult.responded_by,header_message:t.chatStream.continueChatResult.header_message,finalResponseStatus:!1,explainability_id:null!==(B=t.chatStream.continueChatResult.explainability_id)&&void 0!==B?B:"",isParallelToolResponse:!1})}return e.__assign({orchestratorAndAgentsMessages:n},W)}(t,a,n);Q.time=new Date,Q.citations=O,Q.isEnd=null===(I=null===(A=null==t?void 0:t.chatStream)||void 0===A?void 0:A.continueChatResult)||void 0===I?void 0:I.isEnd,Q.requestId=null===(D=null===(N=null==t?void 0:t.chatStream)||void 0===N?void 0:N.continueChatResult)||void 0===D?void 0:D.requestId,Q.sessionId=ve.current,null===(q=Q.orchestratorAndAgentsMessages)||void 0===q||q.forEach(function(e){e&&e.header_message&&Rt(e)}),(""!==(null==Q?void 0:Q.content)||(null==Q?void 0:Q.orchestratorAndAgentsMessages)&&(null==Q?void 0:Q.orchestratorAndAgentsMessages.length)>0)&&(Ee(!1),je(e.__spreadArray(e.__spreadArray([],Re,!0),[{role:"user",content:i||"",time:s,isFirstQuestionSent:o||!1,id:r||(null===(F=null===(L=null==t?void 0:t.chatStream)||void 0===L?void 0:L.continueChatResult)||void 0===F?void 0:F.requestId)||"",requestId:null!==(z=null===(W=null===(B=null==t?void 0:t.chatStream)||void 0===B?void 0:B.continueChatResult)||void 0===W?void 0:W.requestId)&&void 0!==z?z:""},Q],!1))),Ne(null===(H=null===(P=null==t?void 0:t.chatStream)||void 0===P?void 0:P.continueChatResult)||void 0===H?void 0:H.isEnd)}},Tt=function(t,n,a,s,i,r){var d,c,h=(void 0!==a?a:Se||"").trim(),v="Enter"===(null==t?void 0:t.key)&&!(null==t?void 0:t.shiftKey);if(v&&(null===(d=null==t?void 0:t.preventDefault)||void 0===d||d.call(t)),!(!h||He&&!a||(null==t?void 0:t.key)&&!v)){if("I want to add a rule description"===h){Ne(!1),pe.current=!0,Ue(!0),!$e&&h&&et(a||"manual_entry");var m=new Date;return je(function(t){return e.__spreadArray(e.__spreadArray([],t.map(function(t,n){var a;return e.__assign(e.__assign({},t),{content:null===(a=Et(t.content))||void 0===a?void 0:a.replace("WaitMessage: ","")})}),!0),[{role:"user",content:h,time:m,isFirstQuestionSent:!1,id:i||l.v4()}],!1)}),jt("smooth"),void setTimeout(function(){je(function(t){return e.__spreadArray(e.__spreadArray([],t,!0),[{role:"assistant",content:"I'd be happy to help you set up a new rule! To get started, could you tell me what kind of behavior or logic you would like this rule to follow?",id:l.v4(),citations:[],time:new Date}],!1)}),jt("smooth"),setTimeout(function(){Ue(!1),Ne(!0)},500)},500)}Ne(!1),pe.current=!0,Ue(!0),!$e&&h&&et(a||"manual_entry");var f=new Date,g=Ct.current;je(function(t){var n=t.map(function(t){var n;return e.__assign(e.__assign({},t),{content:null===(n=Et(t.content))||void 0===n?void 0:n.replace("WaitMessage: ","")})});return i&&n.some(function(e){return e.id===i})?n.map(function(t){return t.id===i?e.__assign(e.__assign({},t),{content:h}):t}):e.__spreadArray(e.__spreadArray([],n,!0),[{role:"user",content:h,time:f,isFirstQuestionSent:!1,id:i||l.v4()}],!1)}),jt("smooth");var p=new Map,C=[],_={WEBSOCKET_URL:M,organizationName:o,chatAssistantName:he,selectedAIModel:"gpt-4",replyMessage:"",userName:"Guest User",userEmailId:"guestUser@example.com",userId:"Guest User",query:h,requestId:"requestId-".concat(l.v4()),customPrompt:"",enableForBackend:!1,guestSessionId:ve.current,chatPreviewId:me.current,customMetaData:B,aiModel:"",additionalHeaders:(null==ce?void 0:ce.accessToken)?{Authorization:"Bearer ".concat(ce.accessToken)}:void 0,onStreamEvent:function(e){_t.current&&Ct.current===g&&Mt(e,p,C,f,h,n,i)},onStreamEnd:function(t){if(_t.current&&Ct.current===g){Ne(!0),Ue(!1),nt(!1);var n=Date.now(),a=gt.current.get(pt.current);if(a){var s=Math.round((n-a)/1e3).toFixed(1);je(function(t){var n=e.__spreadArray([],t,!0).reverse().findIndex(function(e){return"assistant"===e.role});if(-1===n)return t;var a=t.length-1-n;return t.map(function(t,n){return n===a?e.__assign(e.__assign({},t),{finalTimeTaken:s}):t})})}}},onError:function(e){_t.current&&Ct.current===g&&(console.error("Stream error:",e),Ne(!0),Ue(!1),nt(!1))}};if(h)Ee(!0),null===(c=_e.current)||void 0===c||c.blur(),ye(""),jt(),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."),gt.current.set(_.requestId,Date.now()),pt.current=_.requestId,u.startChatStream(_);r&&r(!1)}},At=n.useRef(null);n.useLayoutEffect(function(){At.current=Tt});var It=n.useCallback(function(){for(var t,n=[],a=0;a<arguments.length;a++)n[a]=arguments[a];return null===(t=At.current)||void 0===t?void 0:t.call.apply(t,e.__spreadArray([At],n,!1))},[]),Nt=n.useMemo(function(){return{p:function(n){n.node;var a=n.children;return e.__rest(n,["node","children"]),t.jsx("div",e.__assign({style:{margin:0,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"10px",fontFamily:"inherit"}},{children:a}))},button:function(n){n.node;var a=n.className,s=n.children,i=e.__rest(n,["node","className","children"]),o=_.extractTextFromChildren(s),r=i["data-value"],l=$e===o||$e===r,u=!!$e,d="Tester Genie"===o;return t.jsx(m.ActionableButton,e.__assign({},i,{className:a,handleStream:It,isStreamEnd:Ie,disabled:u,isLastMessage:!0,style:{margin:0},isTesterGenie:d,"data-selected":l?"true":$e?"false":void 0},{children:t.jsxs("span",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[s,d&&t.jsxs("svg",e.__assign({width:"16",height:"20",viewBox:"0 0 16 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[t.jsx("path",{d:"M7.20368 8.94768e-06C7.48895 -0.00208639 7.69331 0.364327 7.83856 0.57465C8.14381 1.01633 8.38012 1.87909 7.71077 2.14118C8.57167 2.21011 9.70406 2.93098 10.1785 3.64699C10.5932 4.27286 10.4559 5.16037 9.80301 5.56007L9.9502 7.16593C9.97671 7.44871 10.0265 7.87092 10.0299 8.14457C10.4213 8.23046 11.0787 8.55391 11.326 8.87592C11.5979 8.75656 11.9189 8.76963 12.1688 8.93469C12.3563 8.67751 12.5598 8.41456 12.7507 8.15787C12.3283 7.45155 12.5047 6.57745 13.2143 6.13784C13.5375 5.9377 13.9264 5.87277 14.2971 5.95705C14.0961 6.30964 13.8775 6.72182 13.6593 7.05857C13.7906 7.2436 13.9184 7.44225 14.044 7.63194L14.8022 7.63198C15.0349 7.30106 15.2515 6.90827 15.4835 6.59349C15.8623 7.0712 15.8156 7.79671 15.4734 8.28241C15.1318 8.76741 14.4886 8.9899 13.9118 8.88251C13.758 9.12108 13.5577 9.39243 13.3941 9.63201C13.7143 9.9316 13.7725 10.364 13.4067 10.6594C13.5231 10.8889 13.5309 11.1613 13.447 11.402C13.1502 12.2523 12.1724 12.5645 11.3474 12.5025C11.1171 12.4852 10.939 12.4698 10.7197 12.3953C10.8724 13.1271 10.7744 14.2031 10.5132 14.9051C10.1688 15.8304 9.43632 16.5569 8.54503 16.9655C7.90465 17.2706 7.21222 17.3607 6.50472 17.4505C5.74445 17.5471 4.75801 17.4362 4.08533 17.825C3.9327 17.9132 3.86566 18.0173 3.82943 18.1792C3.94996 18.5982 4.47858 18.6063 4.78474 18.8897C5.20191 19.2758 4.90716 19.9663 4.36611 19.9908C4.31476 19.9931 4.26867 19.9867 4.23186 19.9493C4.23089 19.8303 4.47587 19.7199 4.49787 19.5262C4.55075 19.0604 3.70014 19.0078 3.37835 18.8374C3.13013 18.706 2.99537 18.6309 2.82242 18.4021C2.63795 18.1579 2.58428 17.835 2.63138 17.5392C2.74868 16.7847 3.47123 16.393 4.12184 16.1497C4.61314 15.9659 5.46304 15.7158 5.52019 15.0793C5.58589 14.348 4.97543 13.5523 4.57739 12.9807C4.44275 12.7875 4.3039 12.579 4.16309 12.3919C4.18987 12.365 4.21049 12.3463 4.23916 12.3212C4.59619 12.6218 5.21209 12.6421 5.55038 12.2979C5.70457 12.144 5.78974 11.9342 5.78642 11.7164C5.78121 11.4493 5.63382 11.2002 5.4454 11.019C5.44704 10.9932 5.44824 10.9676 5.449 10.9419C5.4566 10.6648 5.37505 10.4902 5.1892 10.2943C5.18398 10.2538 5.17776 10.2134 5.17053 10.1732C5.08123 9.69297 4.71708 9.34182 4.23415 9.27108C4.16418 9.26083 3.96108 9.26105 3.92071 9.23344C3.90485 9.1828 3.9059 9.20792 3.91904 9.15527C4.22103 8.90139 4.14407 8.78214 4.31107 8.4846C4.42301 8.28513 4.73047 8.15239 4.95452 8.10701C4.96167 7.51076 5.03684 6.88562 5.10036 6.29144C5.12451 6.0655 5.12531 5.75046 5.1511 5.55257C4.11108 4.86747 4.39091 3.75946 5.25465 3.06391C5.84978 2.58469 6.34496 2.31002 7.10143 2.14517C7.01589 2.10416 6.93842 2.04811 6.87269 1.97972C6.77021 1.87349 6.70248 1.73857 6.67853 1.59293C6.60568 1.12096 7.04104 0.914625 7.18759 0.526392C7.26428 0.323403 7.03925 0.146075 7.20368 8.94768e-06Z",fill:"#475569"}),t.jsx("path",{d:"M7.459 4.5C7.48797 4.50312 7.71949 4.61154 7.76205 4.63061C8.27062 4.85835 8.87051 5.09164 9.35658 5.3582C9.36602 6.03495 9.37016 6.56625 8.70573 6.91519C8.6633 6.80883 8.63019 6.72409 8.56332 6.63044C8.43786 6.45568 8.24656 6.33963 8.03354 6.30909C7.8434 6.28211 7.65146 6.3197 7.49586 6.43503C7.21897 6.21256 6.76265 6.28197 6.5229 6.52486C6.39308 6.65639 6.34815 6.75074 6.28902 6.92344C5.59702 6.5957 5.58761 6.04267 5.60583 5.35582C5.89882 5.23844 6.21318 5.0724 6.50153 4.941C6.82145 4.79522 7.14482 4.6574 7.459 4.5Z",fill:"#D1EDFD"}),t.jsx("path",{d:"M11.0756 10.6406C11.1037 10.6701 11.1324 10.7706 11.1535 10.8145C11.2818 11.0817 11.4922 11.1945 11.7498 11.2977C11.5607 11.63 11.4567 11.8797 11.1034 12.0466L11.0839 12.0517C10.9262 12.0927 10.7996 12.0968 10.651 12.0135C10.4755 11.915 10.3807 11.6614 10.4792 11.478C10.6388 11.1809 10.8877 10.9272 11.0756 10.6406Z",fill:"#D1EDFD"}),t.jsx("path",{d:"M11.6036 9.1377C11.6993 9.11763 11.8391 9.16378 11.9294 9.19593C11.6952 9.50644 11.4706 9.81614 11.2327 10.1261L11.1572 10.2255C10.7581 9.73539 11.0333 9.24481 11.6036 9.1377Z",fill:"#D1EDFD"}),t.jsx("path",{d:"M7.49681 0.882812C7.53691 0.925159 7.61244 1.08523 7.63598 1.14156C7.74243 1.39673 7.75769 1.76908 7.38596 1.77504C7.28236 1.75599 7.15628 1.68938 7.13517 1.5783C7.0843 1.3107 7.35609 1.09964 7.48737 0.897583L7.49681 0.882812Z",fill:"#D1EDFD"}),t.jsx("path",{d:"M1.68305 6.17249C1.71659 6.1673 1.8134 6.16478 1.84892 6.16432C2.34052 6.15616 2.81496 6.34495 3.16655 6.68866C3.50847 7.01806 3.70349 7.47119 3.70765 7.94596C3.70896 8.42345 3.54045 8.85284 3.20281 9.19025C3.34033 9.28068 3.5321 9.52219 3.6543 9.65748C4.17158 9.39073 4.91447 9.69339 4.79675 10.3444C5.08751 10.5485 5.19656 10.8288 5.0585 11.1674C5.15418 11.2375 5.25595 11.3205 5.32383 11.4186C5.40228 11.5303 5.4309 11.6695 5.40291 11.8031C5.32228 12.1857 4.90085 12.3286 4.57669 12.1236C4.51367 12.0838 4.42258 11.9595 4.35299 11.9431C4.30669 11.9557 4.28453 11.9584 4.23644 11.9644C4.22885 11.9742 4.22118 11.9841 4.21343 11.9938C3.93597 12.3413 3.49234 12.4682 3.06933 12.5157C2.85285 12.518 2.70432 12.5146 2.49066 12.4609C1.80785 12.2892 1.50808 11.6167 1.70723 10.9639C1.829 10.5648 2.11891 10.2506 2.48939 10.0518C2.54655 10.132 2.57559 10.2191 2.64066 10.303C2.73571 10.2223 2.82048 10.1482 2.92363 10.0773C2.81023 9.95313 2.66811 9.7693 2.55817 9.63584C2.38871 9.6878 2.23026 9.72879 2.05298 9.74653C1.54239 9.80228 1.03118 9.64711 0.637735 9.31695C0.269964 9.01018 0.0453493 8.54827 0.00544736 8.07322C-0.0309495 7.60988 0.116099 7.15077 0.414918 6.79478C0.742554 6.41198 1.18728 6.21393 1.68305 6.17249Z",fill:"#475569"}),t.jsx("path",{d:"M1.79616 6.5951C2.54894 6.5619 3.18687 7.14364 3.22301 7.8963C3.25915 8.64894 2.67989 9.28913 1.92739 9.3282C1.17073 9.3675 0.526231 8.78435 0.489885 8.02753C0.45354 7.27071 1.03921 6.62849 1.79616 6.5951Z",fill:"#D1EDFD"}),t.jsx("path",{d:"M4.93607 11.4844C5.12839 11.6261 5.22049 11.9085 4.91876 11.9419C4.8067 11.8805 4.78491 11.8646 4.71094 11.7561C4.81572 11.6752 4.862 11.5925 4.93607 11.4844Z",fill:"#FEFEFD"}),t.jsx("path",{d:"M12.5164 3.58594L12.5715 3.59466C12.6589 3.65863 12.6908 3.94434 12.7882 4.05193C12.8789 4.15216 12.9155 4.17816 13.0326 4.24929C13.1363 4.31224 13.3325 4.34025 13.384 4.43124C13.3643 4.56218 13.0693 4.54857 12.9127 4.69344C12.6903 4.89898 12.7114 5.06971 12.5892 5.28622C12.5669 5.28439 12.5368 5.2868 12.5261 5.27346C12.4336 5.15843 12.4072 4.9308 12.3099 4.81465C12.1627 4.63903 11.9972 4.60054 11.7981 4.51372C11.7544 4.49467 11.7266 4.47099 11.7129 4.42649C11.7867 4.31876 12.0509 4.34309 12.2376 4.14892C12.43 3.94901 12.4155 3.72208 12.5164 3.58594Z",fill:"#475569"}),t.jsx("path",{d:"M2.13644 3.72656C2.24401 3.77084 2.29712 4.1268 2.431 4.25226C2.60327 4.41371 2.7311 4.41949 2.93246 4.52449C2.96024 4.53897 2.97173 4.56042 2.97671 4.58878C2.89584 4.6981 2.61854 4.70721 2.4596 4.85659C2.26275 5.04156 2.27341 5.29132 2.17022 5.42088C2.16192 5.41849 2.11671 5.40232 2.1156 5.40043C2.01291 5.21216 1.9836 5.04909 1.84812 4.87273C1.73599 4.72675 1.36534 4.69959 1.32812 4.56939C1.3835 4.47941 1.67823 4.44211 1.82291 4.30563C2.02737 4.11274 2.0042 3.8372 2.13644 3.72656Z",fill:"#475569"})]}))]}))}))}}},[It,Ie,$e]),Dt=n.useMemo(function(){return Re.some(function(e){return e.isSkeleton})},[Re]),qt=function(t){return e.__awaiter(void 0,void 0,void 0,function(){return e.__generator(this,function(n){switch(n.label){case 0:return de?[4,de(t)]:[3,2];case 1:n.sent(),je(function(t){return e.__spreadArray(e.__spreadArray([],t,!0),[{role:"assistant",content:"Thanks for your feedback — this will help improve future suggestions.",id:l.v4(),citations:[],time:new Date,isEnd:!0}],!1)}),setTimeout(function(){return jt("smooth")},100),n.label=2;case 2:return[2]}})})};return console.log(Re,"rendering messages"),t.jsxs("div",e.__assign({className:"".concat(p.default.customFont," ").concat(g.default.chatContainer),style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:oe&&!Dt?"0 0 20px 5px rgba(37, 99, 235, 0.5)":"none"}},{children:[t.jsxs("div",e.__assign({ref:ge,className:g.default.scrollWrapper},{children:[t.jsx("div",e.__assign({ref:ot,className:g.default.stickyHeader},{children:t.jsx(c.default,{resetChatHistory:function(){var e="".concat(fe,"/api/chat/resetHistory?name=").concat(he,"&organizationName=").concat(o);try{var t={method:"GET",params:{guestSessionId:ve.current},withCredentials:!0};r.http.get(e,t).then(function(){T(!0),Fe(""),et(null),rt.current.clear(),me.current="".concat(l.v4()),je([]),qe(!0),null==P||P(),N&&N()}).catch(function(e){console.error(e)}).finally(function(){ve.current="".concat(he,"-").concat(o,"-").concat(l.v4())})}catch(e){Ee(!1),console.error(e)}},isStreamEnd:Ie,chatTitle:F,onResize:O,chatSize:K,movingTowards:G})})),t.jsxs("div",e.__assign({className:g.default.messagesList},{children:[t.jsxs("div",e.__assign({className:g.default.initialMessageRow},{children:[t.jsx("div",e.__assign({className:g.default.iconWrapper},{children:t.jsx(S.default,{})})),t.jsx("div",e.__assign({className:g.default.welcomeTextWrapper},{children:t.jsx("div",e.__assign({className:g.default.welcomeMarkdownWrapper},{children:t.jsx("span",{children:t.jsx(k.default,e.__assign({rehypePlugins:[E.default],components:Nt},{children:U}))})}))}))]})),Re.length>0&&Re.map(function(n,a){return t.jsxs("div",e.__assign({className:g.default.messageRow},{children:["assistant"===n.role?t.jsx("div",e.__assign({className:g.default.assistantIconContainer},{children:t.jsx(S.default,{})})):t.jsx("div",{className:g.default.userSpacer}),t.jsx("div",e.__assign({className:g.default.messageContent},{children:"assistant"===n.role?t.jsxs(t.Fragment,{children:[n.orchestratorAndAgentsMessages&&n.orchestratorAndAgentsMessages.length>0&&t.jsx(d.WatchMeWork,{orchestratorAndAgentsMessages:null==n?void 0:n.orchestratorAndAgentsMessages,isStreamEnd:Ie,finalTimeTaken:null==n?void 0:n.finalTimeTaken},null==n?void 0:n.id),t.jsx(h.default,{index:a,content:null==n?void 0:n.content,role:null==n?void 0:n.role,messages:Re,handleStream:Tt,isLastMessage:a===Re.length-1,onSave:Z,citations:null==n?void 0:n.citations,setChatSize:O,chatSize:K,isStreamEnd:Ie,messageIsEnd:null==n?void 0:n.isEnd,onViewComparison:le,onTypeResponseClick:function(){var e;vt(!0),null===(e=_e.current)||void 0===e||e.focus()},onComparisonLinkClick:ue,baseURL:fe,onFeedbackSubmit:qt}),t.jsx("div",e.__assign({className:g.default.timestamp},{children:n.time&&!isNaN(new Date(n.time).getTime())?new Date(n.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}):t.jsxs("div",e.__assign({className:g.default.userMessageWrapper},{children:[t.jsxs("div",e.__assign({className:g.default.userMessageBubble,style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:n.isSkeleton||Dt||n.id!==ut?"none":"0 0 15px 3px rgba(37, 99, 235, 0.6)"}},{children:[n.isSkeleton?t.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:"12px",minWidth:"280px",padding:"8px 0"}},{children:[t.jsx(v.Skeleton,{variant:"text",width:"100%",height:16}),t.jsx(v.Skeleton,{variant:"text",width:"80%",height:16})]})):t.jsx(h.default,{index:a,content:null==n?void 0:n.content,role:null==n?void 0:n.role,messages:Re,handleStream:Tt,isLastMessage:a===Re.length-1,onSave:Z,citations:null==n?void 0:n.citations,isStreamEnd:Ie,messageIsEnd:null==n?void 0:n.isEnd,onViewComparison:le,onComparisonLinkClick:ue,baseURL:fe,onFeedbackSubmit:qt}),t.jsx("div",e.__assign({style:{marginTop:"0.5rem"}},{children:t.jsx(y.UserIcon,{})}))]})),t.jsx("div",e.__assign({className:g.default.userTimestamp},{children:new Date(n.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}))}))]}),n.id)}),ke&&t.jsxs("div",e.__assign({className:g.default.loadingRow},{children:[t.jsx("div",e.__assign({className:g.default.iconWrapper,style:{marginTop:"0.2rem"}},{children:t.jsx(S.default,{})})),t.jsx("div",e.__assign({className:g.default.loadingTextWrapper},{children:t.jsx("span",{children:We})}))]})),t.jsx("div",{ref:Ce,style:{float:"left",clear:"both"}})]}))]})),t.jsxs("div",e.__assign({className:g.default.inputAreaWrapper},{children:[He&&t.jsxs(a.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:"8px",paddingBottom:"8px",paddingLeft:"4px",fontFamily:'"Plus Jakarta Sans", sans-serif',fontSize:"0.875rem",color:"#6b7280",width:"100%"}},{children:[t.jsx("span",{children:"Instant Learning AI is thinking"}),t.jsx(a.Box,{sx:{width:"5px",height:"5px",bgcolor:"#6b7280",borderRadius:"50%",animation:"".concat(xt," 1.4s infinite ease-in-out both"),animationDelay:"-0.32s"}}),t.jsx(a.Box,{sx:{width:"5px",height:"5px",bgcolor:"#6b7280",borderRadius:"50%",animation:"".concat(xt," 1.4s infinite ease-in-out both"),animationDelay:"-0.16s"}}),t.jsx(a.Box,{sx:{width:"5px",height:"5px",bgcolor:"#6b7280",borderRadius:"50%",animation:"".concat(xt," 1.4s infinite ease-in-out both")}})]})),t.jsx(w.default,e.__assign({title:L?"Please wait for the validation to be completed.":""},{children:t.jsxs("div",e.__assign({className:"".concat(g.default.inputBoxContainer," ").concat(yt?g.default.disabled:""),style:ht?{boxShadow:"0 0 15px 3px rgba(37, 99, 235, 0.5)",borderColor:"#2563eb",transition:"box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out"}:{transition:"box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out"}},{children:[Re.length>0&&!Ve&&t.jsx("div",e.__assign({onMouseDown:function(e){e.preventDefault(),jt("smooth")},className:g.default.scrollToBottomBtn},{children:t.jsx(C.ScrollToBottom,{})})),t.jsxs("div",e.__assign({style:{width:"100%",display:"flex"}},{children:[t.jsx("textarea",{ref:_e,placeholder:Q,value:Se||"",onChange:function(e){ye(e.target.value)},onFocus:function(){return Oe(!0)},onBlur:function(){return Oe(!1)},onKeyDown:function(e){return Tt(e)},disabled:yt,className:"no-scrollbar ".concat(g.default.chatTextarea),style:{minHeight:Ke?"120px":"50px",height:Ke?"120px":"50px",maxHeight:"120px"}}),t.jsx("span",e.__assign({className:g.default.sendButtonWrapper},{children:t.jsx("button",e.__assign({onClick:function(e){Tt(new KeyboardEvent("keydown",{key:"Enter"}))},disabled:bt,className:"".concat(g.default.sendButton," ").concat(bt?g.default.disabled:g.default.active)},{children:t.jsx(x.SendButton,{})}))}))]}))]}))}))]})),t.jsxs("div",e.__assign({className:g.default.footerTools},{children:[t.jsx(w.default,e.__assign({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:t.jsx("span",e.__assign({className:g.default.footerToolItem},{children:t.jsx(f.default,{amplitude:1,variant:"speaker",isActive:!1,onClick:function(){return null},disabled:!1})}))})),t.jsx(w.default,e.__assign({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:t.jsx("span",e.__assign({className:g.default.footerToolItem},{children:t.jsx(f.default,{amplitude:1,variant:"microphone",isActive:!1,onClick:function(){return null},disabled:!1})}))}))]}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("react"),a=require("@mui/material"),s=require("@mui/material/Tooltip"),i=require("react-markdown"),o=require("rehype-raw"),r=require("../../../../api/transport.js"),l=require("uuid"),u=require("@e-llm-studio/streaming-response"),d=require("@e-llm-studio/watch-me-work"),c=require("./ChatHeader.js"),h=require("../MessageRendering/MessageRendering.js"),v=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"),C=require("../_svg/ScrollToBottom.js"),_=require("../../helpers/utils.js"),x=require("../_svg/SendButton.js"),S=require("../_svg/SparkleIcon.js"),y=require("../_svg/UserIcon.js"),b=require("../../../LearningManagement/store/useAuthStore.js");function R(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var j,w=R(s),k=R(i),E=R(o);exports.default=function(s){var i=s.chatAssistantName,o=s.organizationName,R=s.baseUrl,M=s.baseWebsocketUrl,T=s.setIsNewChatClicked;s.ThinkingBulbIconComponent;var A=s.isFormSaveClicked,I=s.setIsFormSavedClicked,N=s.onResetLearningData,D=s.sendMessageInChat,q=s.setSendMessageInChat,L=s.isFormValidating,F=s.chatTitle,B=s.customMetaData,W=s.headerMessageHandlers;s.aiResponse;var z=s.setAIResponse,P=s.onResetChat,H=s.initialChatMessage,U=void 0===H?"":H,Z=s.onSave,K=s.chatSize,O=s.setChatSize,G=s.movingTowards,V=s.setCitations,J=s.textareaPlaceholder,Q=void 0===J?"Tell me more about this learning...":J,X=s.setCurrentRequestId,Y=s.showSavedMessage,$=void 0!==Y&&Y,ee=s.savedMessage,te=s.isError,ne=void 0!==te&&te,ae=s.errorMessage,se=void 0===ae?"There was an error saving your changes.":ae;s.isSaving;var ie=s.isHighlighted,oe=void 0!==ie&&ie,re=s.onStreamingStateChange,le=s.onViewComparison;s.isCopyEnabled;var ue=s.onComparisonLinkClick,de=s.onSubmitFeedback,ce=b.default().user,he=i,ve=n.useRef("".concat(he,"-").concat(o,"-").concat(l.v4())),me=n.useRef("".concat(l.v4())),fe=R,ge=n.useRef(null),pe=n.useRef(!0),Ce=n.useRef(null),_e=n.useRef(null),xe=n.useState(""),Se=xe[0],ye=xe[1],be=n.useState([]),Re=be[0],je=be[1],we=n.useState(!1),ke=we[0],Ee=we[1],Me=n.useState(!1);Me[0];var Te=Me[1],Ae=n.useState(!0),Ie=Ae[0],Ne=Ae[1],De=n.useState(!0);De[0];var qe=De[1],Le=n.useState("");Le[0];var Fe=Le[1],Be=n.useState(""),We=Be[0],ze=Be[1],Pe=n.useState(!1),He=Pe[0],Ue=Pe[1],Ze=n.useState(!1),Ke=Ze[0],Oe=Ze[1],Ge=n.useState(!0),Ve=Ge[0],Je=Ge[1],Qe=n.useState("100%");Qe[0];var Xe=Qe[1],Ye=n.useState(null),$e=Ye[0],et=Ye[1],tt=n.useState(!1);tt[0];var nt=tt[1],at=n.useState(!1),st=at[0],it=at[1],ot=n.useRef(null),rt=n.useRef(new Set),lt=n.useState(null),ut=lt[0],dt=lt[1],ct=n.useState(!1),ht=ct[0],vt=ct[1],mt=n.useState(!1);mt[0],mt[1];var ft=n.useState(null);ft[0],ft[1],n.useRef(null),n.useRef(null);var gt=n.useRef(new Map),pt=n.useRef(""),Ct=n.useRef(0),_t=n.useRef(!0),xt=a.keyframes(j||(j=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 "]))),St=n.useMemo(function(){return""===(null==Se?void 0:Se.trim())||He},[Se,He]),yt=n.useMemo(function(){return L},[L]),bt=n.useMemo(function(){return St||He||L},[St,He,L]);n.useEffect(function(){null==re||re(He)},[He,re]),n.useEffect(function(){return _t.current=!0,function(){_t.current=!1,Ct.current+=1,pt.current&&M&&u.stopStreaming(pt.current,M,!1)}},[M]),n.useEffect(function(){var e=ge.current,t=function(){if(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;Je(n-t-a<=20)}};return e&&(e.addEventListener("scroll",t),t()),function(){e&&e.removeEventListener("scroll",t)}},[Re]);var Rt=_.useHeaderObserver({handlers:W,setResult:z}).processHeaderMessage;n.useEffect(function(){$&&it(!0)},[$]),n.useEffect(function(){if(ht){var e=setTimeout(function(){vt(!1)},3e3);return function(){return clearTimeout(e)}}},[ht]),n.useEffect(function(){A&&(Tt(new KeyboardEvent("keydown",{key:"Enter"}),!1,"Save this Learning"),I(!1))},[A]),n.useEffect(function(){if(D)try{if(D.startsWith("__SKELETON__:")){var t=D.split(":"),n=t[1],a=t.slice(2).join(":"),s={role:"user",content:"",id:n,time:new Date,isSkeleton:!0,skeletonContent:a};return je(function(t){return e.__spreadArray(e.__spreadArray([],t,!0),[s],!1)}),Tt(new KeyboardEvent("keydown",{key:"Enter"}),!1,a,!1,n),dt(n),q&&q(""),void setTimeout(function(){dt(null)},2e3)}if(D.startsWith("__SKELETON_END__::")){var i=D.split("::")[1]||"";return je(function(t){return t.map(function(t){return t.isSkeleton?e.__assign(e.__assign({},t),{isSkeleton:!1,content:t.skeletonContent||i}):t})}),void(q&&q(""))}var o=l.v4();Tt(new KeyboardEvent("keydown",{key:"Enter"}),!1,D,!1,o),dt(o),q&&q(""),setTimeout(function(){return dt(null)},2e3)}catch(e){console.error("Error handling sendMessageInChat signal",e)}},[D]),n.useEffect(function(){wt(),kt();var e=function(){var e,t=(null===(e=null==ot?void 0:ot.current)||void 0===e?void 0:e.clientHeight)||0,n="calc(100% - ".concat(t,"px - 10px)");Xe(n)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var jt=n.useCallback(function(e){var t="string"==typeof e?e:"smooth";Ce.current&&Ce.current.scrollIntoView({behavior:t,block:"end"}),pe.current&&setTimeout(function(){Ce.current&&pe.current&&Ce.current.scrollIntoView({behavior:t,block:"end"})},100)},[]);n.useEffect(function(){if(!He){var t="";if(st?t=ee||"Thank you teacher for teaching me, your rule has been saved successfully.":ne&&(t=se||"I'm sorry, I couldn't save your changes. Please try again."),t){var n={role:"assistant",content:t,id:l.v4(),citations:[],time:new Date};je(function(t){return e.__spreadArray(e.__spreadArray([],t,!0),[n],!1)}),it(!1),setTimeout(function(){return jt("smooth")},100)}}},[st,ne,He,ee,se,jt]),n.useEffect(function(){pe.current&&jt("smooth")},[jt]);var wt=function(){var e={method:"get",maxBodyLength:1/0,url:"".concat(fe,"/api/chatbot/getChatSettings?name=").concat(he,"&organizationName=").concat(o),headers:{}};r.http.request(e).then(function(e){var t,n,a;(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.chatSettings)&&""!==(null===(a=null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.chatSettings)||void 0===a?void 0:a.chatInitialMessage)&&qe(!0)}).catch(function(e){console.error(e)})},kt=function(){return e.__awaiter(void 0,void 0,void 0,function(){var t,n;return e.__generator(this,function(e){t="".concat(fe,"/api/chat/history?name=").concat(he,"&organizationName=").concat(o);try{n={method:"GET",params:{guestSessionId:ve.current},withCredentials:!0},r.http.get(t,n).then(function(e){var t=e.data;t.length>0?(je(t),jt()):qe(!0)}).catch(function(e){console.error(e)})}catch(e){Ee(!1),console.error(e)}return[2]})})};function Et(e){return null==e?void 0:e.replace(/<a [^>]*>.*?<\/a>/g,function(e){return null==e?void 0:e.replace(/\*/g,"&ast;")})}var Mt=function(t,n,a,s,i,o,r){var u,d,c,h,v,m,f,g,p,C,_,x,S,y,b,R,j,w,k,E,M,T,A,I,N,D,q,L,F,B,W,z,P,H;if(null===(d=null===(u=null==t?void 0:t.chatStream)||void 0===u?void 0:u.continueChatResult)||void 0===d?void 0:d.header_message){var U={header_message:t.chatStream.continueChatResult.header_message,responsedata:null===(v=null===(h=null===(c=null==t?void 0:t.chatStream)||void 0===c?void 0:c.continueChatResult)||void 0===h?void 0:h.message)||void 0===v?void 0:v.content};Rt(U)}var Z=null===(m=null==t?void 0:t.chatStream)||void 0===m?void 0:m.continueChatResult,K=null==Z?void 0:Z.isEnd,O=(null===(f=null==Z?void 0:Z.message)||void 0===f?void 0:f.citations)||[];K&&O.length>0&&V&&V(O);var G={role:"assistant",content:"",id:l.v4()};if(null===(_=null===(C=null===(p=null===(g=null==t?void 0:t.chatStream)||void 0===g?void 0:g.continueChatResult)||void 0===p?void 0:p.message)||void 0===C?void 0:C.content)||void 0===_?void 0:_.includes("WaitMessage: "))Te(!0),G.content=function(e){var t="WaitMessage: ",n=e.indexOf(t);if(-1!==n){var a=e.substring(n+13);return null==a?void 0:a.replaceAll("WaitMessage: ","")}return""}((null===(y=null===(S=null===(x=null==t?void 0:t.chatStream)||void 0===x?void 0:x.continueChatResult)||void 0===S?void 0:S.message)||void 0===y?void 0:y.content)+"\n\n"),""!==G.content&&(Ee(!1),je(e.__spreadArray(e.__spreadArray([],Re,!0),[{role:"user",content:i,time:s,isFirstQuestionSent:o||!1,id:r||(null===(R=null===(b=null==t?void 0:t.chatStream)||void 0===b?void 0:b.continueChatResult)||void 0===R?void 0:R.requestId)||"",reply:""},G],!1)));else{Te(!1),G.content=null===(E=Et(null===(k=null===(w=null===(j=null==t?void 0:t.chatStream)||void 0===j?void 0:j.continueChatResult)||void 0===w?void 0:w.message)||void 0===k?void 0:k.content))||void 0===E?void 0:E.replaceAll("WaitMessage: ","");var J=null===(T=null===(M=null==t?void 0:t.chatStream)||void 0===M?void 0:M.continueChatResult)||void 0===T?void 0:T.requestId;"string"==typeof J&&J&&X&&X(J);var Q=function(t,n,a){var s,i,o,r,u,d,c,h,v,m,f,g,p,C,_,x,S,y,b,R,j,w,k,E,M,T,A,I,N,D,q,L,F,B,W={role:"assistant",content:"",id:l.v4(),time:new Date,citations:[]};if(!1===(null===(i=null===(s=t.chatStream)||void 0===s?void 0:s.continueChatResult)||void 0===i?void 0:i.thinking_break)&&!0===(null===(r=null===(o=t.chatStream)||void 0===o?void 0:o.continueChatResult)||void 0===r?void 0:r.is_orchestrator)&&!1===(null===(d=null===(u=t.chatStream)||void 0===u?void 0:u.continueChatResult)||void 0===d?void 0:d.isEnd)&&(W.content=Et(t.chatStream.continueChatResult.message.content||"")),!0===(null===(h=null===(c=t.chatStream)||void 0===c?void 0:c.continueChatResult)||void 0===h?void 0:h.thinking_break)&&!0===(null===(m=null===(v=t.chatStream)||void 0===v?void 0:v.continueChatResult)||void 0===m?void 0:m.is_orchestrator)&&!1===(null===(g=null===(f=t.chatStream)||void 0===f?void 0:f.continueChatResult)||void 0===g?void 0:g.isEnd)&&(W.content="",n.push({responsedata:t.chatStream.continueChatResult.message.content,responseFrom:t.chatStream.continueChatResult.responded_by,header_message:t.chatStream.continueChatResult.header_message,finalResponseStatus:!1})),!1===(null===(C=null===(p=t.chatStream)||void 0===p?void 0:p.continueChatResult)||void 0===C?void 0:C.thinking_break)&&!0===(null===(x=null===(_=t.chatStream)||void 0===_?void 0:_.continueChatResult)||void 0===x?void 0:x.is_orchestrator)&&!0===(null===(y=null===(S=t.chatStream)||void 0===S?void 0:S.continueChatResult)||void 0===y?void 0:y.isEnd)&&(W.content=Et(t.chatStream.continueChatResult.message.content)),!1===(null===(R=null===(b=t.chatStream)||void 0===b?void 0:b.continueChatResult)||void 0===R?void 0:R.thinking_break)&&!1===(null===(w=null===(j=t.chatStream)||void 0===j?void 0:j.continueChatResult)||void 0===w?void 0:w.is_orchestrator)&&!1===(null===(E=null===(k=t.chatStream)||void 0===k?void 0:k.continueChatResult)||void 0===E?void 0:E.isEnd)){if((H=t.chatStream.continueChatResult).explainability_id&&H.responded_by){var z=H.explainability_id,P=H.responded_by;a.has(z)||a.set(z,{responded_by:P,index:n.length})}a.has(t.chatStream.continueChatResult.explainability_id)?n[null==(U=a.get(t.chatStream.continueChatResult.explainability_id))?void 0:U.index]={responsedata:t.chatStream.continueChatResult.message.content,responseFrom:t.chatStream.continueChatResult.responded_by,header_message:t.chatStream.continueChatResult.header_message,finalResponseStatus:!0,explainability_id:null!==(M=t.chatStream.continueChatResult.explainability_id)&&void 0!==M?M:"",isParallelToolResponse:!0}:n=e.__spreadArray(e.__spreadArray([],n,!0),[{responsedata:t.chatStream.continueChatResult.message.content,responseFrom:t.chatStream.continueChatResult.responded_by,header_message:t.chatStream.continueChatResult.header_message,finalResponseStatus:!0,explainability_id:null!==(T=t.chatStream.continueChatResult.explainability_id)&&void 0!==T?T:"",isParallelToolResponse:!1}],!1)}if(!0===(null===(I=null===(A=t.chatStream)||void 0===A?void 0:A.continueChatResult)||void 0===I?void 0:I.thinking_break)&&!1===(null===(D=null===(N=t.chatStream)||void 0===N?void 0:N.continueChatResult)||void 0===D?void 0:D.is_orchestrator)&&!1===(null===(L=null===(q=t.chatStream)||void 0===q?void 0:q.continueChatResult)||void 0===L?void 0:L.isEnd)){var H,U;(H=t.chatStream.continueChatResult).explainability_id&&H.responded_by&&(z=H.explainability_id,P=H.responded_by,a.has(z)||a.set(z,{responded_by:P,index:n.length})),a.has(t.chatStream.continueChatResult.explainability_id)?n[null==(U=a.get(t.chatStream.continueChatResult.explainability_id))?void 0:U.index]={responsedata:t.chatStream.continueChatResult.message.content,responseFrom:t.chatStream.continueChatResult.responded_by,header_message:t.chatStream.continueChatResult.header_message,finalResponseStatus:!1,explainability_id:null!==(F=t.chatStream.continueChatResult.explainability_id)&&void 0!==F?F:"",isParallelToolResponse:!0}:n.push({responsedata:t.chatStream.continueChatResult.message.content,responseFrom:t.chatStream.continueChatResult.responded_by,header_message:t.chatStream.continueChatResult.header_message,finalResponseStatus:!1,explainability_id:null!==(B=t.chatStream.continueChatResult.explainability_id)&&void 0!==B?B:"",isParallelToolResponse:!1})}return e.__assign({orchestratorAndAgentsMessages:n},W)}(t,a,n);Q.time=new Date,Q.citations=O,Q.isEnd=null===(I=null===(A=null==t?void 0:t.chatStream)||void 0===A?void 0:A.continueChatResult)||void 0===I?void 0:I.isEnd,Q.requestId=null===(D=null===(N=null==t?void 0:t.chatStream)||void 0===N?void 0:N.continueChatResult)||void 0===D?void 0:D.requestId,Q.sessionId=ve.current,null===(q=Q.orchestratorAndAgentsMessages)||void 0===q||q.forEach(function(e){e&&e.header_message&&Rt(e)}),(""!==(null==Q?void 0:Q.content)||(null==Q?void 0:Q.orchestratorAndAgentsMessages)&&(null==Q?void 0:Q.orchestratorAndAgentsMessages.length)>0)&&(Ee(!1),je(e.__spreadArray(e.__spreadArray([],Re,!0),[{role:"user",content:i||"",time:s,isFirstQuestionSent:o||!1,id:r||(null===(F=null===(L=null==t?void 0:t.chatStream)||void 0===L?void 0:L.continueChatResult)||void 0===F?void 0:F.requestId)||"",requestId:null!==(z=null===(W=null===(B=null==t?void 0:t.chatStream)||void 0===B?void 0:B.continueChatResult)||void 0===W?void 0:W.requestId)&&void 0!==z?z:""},Q],!1))),Ne(null===(H=null===(P=null==t?void 0:t.chatStream)||void 0===P?void 0:P.continueChatResult)||void 0===H?void 0:H.isEnd)}},Tt=function(t,n,a,s,i,r){var d,c,h=(void 0!==a?a:Se||"").trim(),v="Enter"===(null==t?void 0:t.key)&&!(null==t?void 0:t.shiftKey);if(v&&(null===(d=null==t?void 0:t.preventDefault)||void 0===d||d.call(t)),!(!h||He&&!a||(null==t?void 0:t.key)&&!v)){if("I want to add a rule description"===h){Ne(!1),pe.current=!0,Ue(!0),!$e&&h&&et(a||"manual_entry");var m=new Date;return je(function(t){return e.__spreadArray(e.__spreadArray([],t.map(function(t,n){var a;return e.__assign(e.__assign({},t),{content:null===(a=Et(t.content))||void 0===a?void 0:a.replace("WaitMessage: ","")})}),!0),[{role:"user",content:h,time:m,isFirstQuestionSent:!1,id:i||l.v4()}],!1)}),jt("smooth"),void setTimeout(function(){je(function(t){return e.__spreadArray(e.__spreadArray([],t,!0),[{role:"assistant",content:"I'd be happy to help you set up a new rule! To get started, could you tell me what kind of behavior or logic you would like this rule to follow?",id:l.v4(),citations:[],time:new Date}],!1)}),jt("smooth"),setTimeout(function(){Ue(!1),Ne(!0)},500)},500)}Ne(!1),pe.current=!0,Ue(!0),!$e&&h&&et(a||"manual_entry");var f=new Date,g=Ct.current;je(function(t){var n=t.map(function(t){var n;return e.__assign(e.__assign({},t),{content:null===(n=Et(t.content))||void 0===n?void 0:n.replace("WaitMessage: ","")})});return i&&n.some(function(e){return e.id===i})?n.map(function(t){return t.id===i?e.__assign(e.__assign({},t),{content:h}):t}):e.__spreadArray(e.__spreadArray([],n,!0),[{role:"user",content:h,time:f,isFirstQuestionSent:!1,id:i||l.v4()}],!1)}),jt("smooth");var p=new Map,C=[],_={WEBSOCKET_URL:M,organizationName:o,chatAssistantName:he,selectedAIModel:"gpt-4",replyMessage:"",userName:"Guest User",userEmailId:"guestUser@example.com",userId:"Guest User",query:h,requestId:"requestId-".concat(l.v4()),customPrompt:"",enableForBackend:!1,guestSessionId:ve.current,chatPreviewId:me.current,customMetaData:B,aiModel:"",additionalHeaders:(null==ce?void 0:ce.accessToken)?{Authorization:"Bearer ".concat(ce.accessToken)}:void 0,onStreamEvent:function(e){_t.current&&Ct.current===g&&Mt(e,p,C,f,h,n,i)},onStreamEnd:function(t){if(_t.current&&Ct.current===g){Ne(!0),Ue(!1),nt(!1);var n=Date.now(),a=gt.current.get(pt.current);if(a){var s=Math.round((n-a)/1e3).toFixed(1);je(function(t){var n=e.__spreadArray([],t,!0).reverse().findIndex(function(e){return"assistant"===e.role});if(-1===n)return t;var a=t.length-1-n;return t.map(function(t,n){return n===a?e.__assign(e.__assign({},t),{finalTimeTaken:s}):t})})}}},onError:function(e){_t.current&&Ct.current===g&&(console.error("Stream error:",e),Ne(!0),Ue(!1),nt(!1))}};if(h)Ee(!0),null===(c=_e.current)||void 0===c||c.blur(),ye(""),jt(),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."),gt.current.set(_.requestId,Date.now()),pt.current=_.requestId,u.startChatStream(_);r&&r(!1)}},At=n.useRef(null);n.useLayoutEffect(function(){At.current=Tt});var It=n.useCallback(function(){for(var t,n=[],a=0;a<arguments.length;a++)n[a]=arguments[a];return null===(t=At.current)||void 0===t?void 0:t.call.apply(t,e.__spreadArray([At],n,!1))},[]),Nt=n.useMemo(function(){return{p:function(n){n.node;var a=n.children;return e.__rest(n,["node","children"]),t.jsx("div",e.__assign({style:{margin:0,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"10px",fontFamily:"inherit"}},{children:a}))},button:function(n){n.node;var a=n.className,s=n.children,i=e.__rest(n,["node","className","children"]),o=_.extractTextFromChildren(s),r=i["data-value"],l=$e===o||$e===r,u=!!$e,d="Tester Genie"===o;return t.jsx(m.ActionableButton,e.__assign({},i,{className:a,handleStream:It,isStreamEnd:Ie,disabled:u,isLastMessage:!0,style:{margin:0},isTesterGenie:d,"data-selected":l?"true":$e?"false":void 0},{children:t.jsxs("span",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[s,d&&t.jsxs("svg",e.__assign({width:"16",height:"20",viewBox:"0 0 16 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[t.jsx("path",{d:"M7.20368 8.94768e-06C7.48895 -0.00208639 7.69331 0.364327 7.83856 0.57465C8.14381 1.01633 8.38012 1.87909 7.71077 2.14118C8.57167 2.21011 9.70406 2.93098 10.1785 3.64699C10.5932 4.27286 10.4559 5.16037 9.80301 5.56007L9.9502 7.16593C9.97671 7.44871 10.0265 7.87092 10.0299 8.14457C10.4213 8.23046 11.0787 8.55391 11.326 8.87592C11.5979 8.75656 11.9189 8.76963 12.1688 8.93469C12.3563 8.67751 12.5598 8.41456 12.7507 8.15787C12.3283 7.45155 12.5047 6.57745 13.2143 6.13784C13.5375 5.9377 13.9264 5.87277 14.2971 5.95705C14.0961 6.30964 13.8775 6.72182 13.6593 7.05857C13.7906 7.2436 13.9184 7.44225 14.044 7.63194L14.8022 7.63198C15.0349 7.30106 15.2515 6.90827 15.4835 6.59349C15.8623 7.0712 15.8156 7.79671 15.4734 8.28241C15.1318 8.76741 14.4886 8.9899 13.9118 8.88251C13.758 9.12108 13.5577 9.39243 13.3941 9.63201C13.7143 9.9316 13.7725 10.364 13.4067 10.6594C13.5231 10.8889 13.5309 11.1613 13.447 11.402C13.1502 12.2523 12.1724 12.5645 11.3474 12.5025C11.1171 12.4852 10.939 12.4698 10.7197 12.3953C10.8724 13.1271 10.7744 14.2031 10.5132 14.9051C10.1688 15.8304 9.43632 16.5569 8.54503 16.9655C7.90465 17.2706 7.21222 17.3607 6.50472 17.4505C5.74445 17.5471 4.75801 17.4362 4.08533 17.825C3.9327 17.9132 3.86566 18.0173 3.82943 18.1792C3.94996 18.5982 4.47858 18.6063 4.78474 18.8897C5.20191 19.2758 4.90716 19.9663 4.36611 19.9908C4.31476 19.9931 4.26867 19.9867 4.23186 19.9493C4.23089 19.8303 4.47587 19.7199 4.49787 19.5262C4.55075 19.0604 3.70014 19.0078 3.37835 18.8374C3.13013 18.706 2.99537 18.6309 2.82242 18.4021C2.63795 18.1579 2.58428 17.835 2.63138 17.5392C2.74868 16.7847 3.47123 16.393 4.12184 16.1497C4.61314 15.9659 5.46304 15.7158 5.52019 15.0793C5.58589 14.348 4.97543 13.5523 4.57739 12.9807C4.44275 12.7875 4.3039 12.579 4.16309 12.3919C4.18987 12.365 4.21049 12.3463 4.23916 12.3212C4.59619 12.6218 5.21209 12.6421 5.55038 12.2979C5.70457 12.144 5.78974 11.9342 5.78642 11.7164C5.78121 11.4493 5.63382 11.2002 5.4454 11.019C5.44704 10.9932 5.44824 10.9676 5.449 10.9419C5.4566 10.6648 5.37505 10.4902 5.1892 10.2943C5.18398 10.2538 5.17776 10.2134 5.17053 10.1732C5.08123 9.69297 4.71708 9.34182 4.23415 9.27108C4.16418 9.26083 3.96108 9.26105 3.92071 9.23344C3.90485 9.1828 3.9059 9.20792 3.91904 9.15527C4.22103 8.90139 4.14407 8.78214 4.31107 8.4846C4.42301 8.28513 4.73047 8.15239 4.95452 8.10701C4.96167 7.51076 5.03684 6.88562 5.10036 6.29144C5.12451 6.0655 5.12531 5.75046 5.1511 5.55257C4.11108 4.86747 4.39091 3.75946 5.25465 3.06391C5.84978 2.58469 6.34496 2.31002 7.10143 2.14517C7.01589 2.10416 6.93842 2.04811 6.87269 1.97972C6.77021 1.87349 6.70248 1.73857 6.67853 1.59293C6.60568 1.12096 7.04104 0.914625 7.18759 0.526392C7.26428 0.323403 7.03925 0.146075 7.20368 8.94768e-06Z",fill:"#475569"}),t.jsx("path",{d:"M7.459 4.5C7.48797 4.50312 7.71949 4.61154 7.76205 4.63061C8.27062 4.85835 8.87051 5.09164 9.35658 5.3582C9.36602 6.03495 9.37016 6.56625 8.70573 6.91519C8.6633 6.80883 8.63019 6.72409 8.56332 6.63044C8.43786 6.45568 8.24656 6.33963 8.03354 6.30909C7.8434 6.28211 7.65146 6.3197 7.49586 6.43503C7.21897 6.21256 6.76265 6.28197 6.5229 6.52486C6.39308 6.65639 6.34815 6.75074 6.28902 6.92344C5.59702 6.5957 5.58761 6.04267 5.60583 5.35582C5.89882 5.23844 6.21318 5.0724 6.50153 4.941C6.82145 4.79522 7.14482 4.6574 7.459 4.5Z",fill:"#D1EDFD"}),t.jsx("path",{d:"M11.0756 10.6406C11.1037 10.6701 11.1324 10.7706 11.1535 10.8145C11.2818 11.0817 11.4922 11.1945 11.7498 11.2977C11.5607 11.63 11.4567 11.8797 11.1034 12.0466L11.0839 12.0517C10.9262 12.0927 10.7996 12.0968 10.651 12.0135C10.4755 11.915 10.3807 11.6614 10.4792 11.478C10.6388 11.1809 10.8877 10.9272 11.0756 10.6406Z",fill:"#D1EDFD"}),t.jsx("path",{d:"M11.6036 9.1377C11.6993 9.11763 11.8391 9.16378 11.9294 9.19593C11.6952 9.50644 11.4706 9.81614 11.2327 10.1261L11.1572 10.2255C10.7581 9.73539 11.0333 9.24481 11.6036 9.1377Z",fill:"#D1EDFD"}),t.jsx("path",{d:"M7.49681 0.882812C7.53691 0.925159 7.61244 1.08523 7.63598 1.14156C7.74243 1.39673 7.75769 1.76908 7.38596 1.77504C7.28236 1.75599 7.15628 1.68938 7.13517 1.5783C7.0843 1.3107 7.35609 1.09964 7.48737 0.897583L7.49681 0.882812Z",fill:"#D1EDFD"}),t.jsx("path",{d:"M1.68305 6.17249C1.71659 6.1673 1.8134 6.16478 1.84892 6.16432C2.34052 6.15616 2.81496 6.34495 3.16655 6.68866C3.50847 7.01806 3.70349 7.47119 3.70765 7.94596C3.70896 8.42345 3.54045 8.85284 3.20281 9.19025C3.34033 9.28068 3.5321 9.52219 3.6543 9.65748C4.17158 9.39073 4.91447 9.69339 4.79675 10.3444C5.08751 10.5485 5.19656 10.8288 5.0585 11.1674C5.15418 11.2375 5.25595 11.3205 5.32383 11.4186C5.40228 11.5303 5.4309 11.6695 5.40291 11.8031C5.32228 12.1857 4.90085 12.3286 4.57669 12.1236C4.51367 12.0838 4.42258 11.9595 4.35299 11.9431C4.30669 11.9557 4.28453 11.9584 4.23644 11.9644C4.22885 11.9742 4.22118 11.9841 4.21343 11.9938C3.93597 12.3413 3.49234 12.4682 3.06933 12.5157C2.85285 12.518 2.70432 12.5146 2.49066 12.4609C1.80785 12.2892 1.50808 11.6167 1.70723 10.9639C1.829 10.5648 2.11891 10.2506 2.48939 10.0518C2.54655 10.132 2.57559 10.2191 2.64066 10.303C2.73571 10.2223 2.82048 10.1482 2.92363 10.0773C2.81023 9.95313 2.66811 9.7693 2.55817 9.63584C2.38871 9.6878 2.23026 9.72879 2.05298 9.74653C1.54239 9.80228 1.03118 9.64711 0.637735 9.31695C0.269964 9.01018 0.0453493 8.54827 0.00544736 8.07322C-0.0309495 7.60988 0.116099 7.15077 0.414918 6.79478C0.742554 6.41198 1.18728 6.21393 1.68305 6.17249Z",fill:"#475569"}),t.jsx("path",{d:"M1.79616 6.5951C2.54894 6.5619 3.18687 7.14364 3.22301 7.8963C3.25915 8.64894 2.67989 9.28913 1.92739 9.3282C1.17073 9.3675 0.526231 8.78435 0.489885 8.02753C0.45354 7.27071 1.03921 6.62849 1.79616 6.5951Z",fill:"#D1EDFD"}),t.jsx("path",{d:"M4.93607 11.4844C5.12839 11.6261 5.22049 11.9085 4.91876 11.9419C4.8067 11.8805 4.78491 11.8646 4.71094 11.7561C4.81572 11.6752 4.862 11.5925 4.93607 11.4844Z",fill:"#FEFEFD"}),t.jsx("path",{d:"M12.5164 3.58594L12.5715 3.59466C12.6589 3.65863 12.6908 3.94434 12.7882 4.05193C12.8789 4.15216 12.9155 4.17816 13.0326 4.24929C13.1363 4.31224 13.3325 4.34025 13.384 4.43124C13.3643 4.56218 13.0693 4.54857 12.9127 4.69344C12.6903 4.89898 12.7114 5.06971 12.5892 5.28622C12.5669 5.28439 12.5368 5.2868 12.5261 5.27346C12.4336 5.15843 12.4072 4.9308 12.3099 4.81465C12.1627 4.63903 11.9972 4.60054 11.7981 4.51372C11.7544 4.49467 11.7266 4.47099 11.7129 4.42649C11.7867 4.31876 12.0509 4.34309 12.2376 4.14892C12.43 3.94901 12.4155 3.72208 12.5164 3.58594Z",fill:"#475569"}),t.jsx("path",{d:"M2.13644 3.72656C2.24401 3.77084 2.29712 4.1268 2.431 4.25226C2.60327 4.41371 2.7311 4.41949 2.93246 4.52449C2.96024 4.53897 2.97173 4.56042 2.97671 4.58878C2.89584 4.6981 2.61854 4.70721 2.4596 4.85659C2.26275 5.04156 2.27341 5.29132 2.17022 5.42088C2.16192 5.41849 2.11671 5.40232 2.1156 5.40043C2.01291 5.21216 1.9836 5.04909 1.84812 4.87273C1.73599 4.72675 1.36534 4.69959 1.32812 4.56939C1.3835 4.47941 1.67823 4.44211 1.82291 4.30563C2.02737 4.11274 2.0042 3.8372 2.13644 3.72656Z",fill:"#475569"})]}))]}))}))}}},[It,Ie,$e]),Dt=n.useMemo(function(){return Re.some(function(e){return e.isSkeleton})},[Re]),qt=function(t){return e.__awaiter(void 0,void 0,void 0,function(){return e.__generator(this,function(n){switch(n.label){case 0:return de?[4,de(t)]:[3,2];case 1:n.sent(),je(function(t){return e.__spreadArray(e.__spreadArray([],t,!0),[{role:"assistant",content:"Thanks for your feedback — this will help improve future suggestions.",id:l.v4(),citations:[],time:new Date,isEnd:!0}],!1)}),setTimeout(function(){return jt("smooth")},100),n.label=2;case 2:return[2]}})})};return console.log(Re,"rendering messages"),t.jsxs("div",e.__assign({className:"".concat(p.default.customFont," ").concat(g.default.chatContainer),style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:oe&&!Dt?"0 0 20px 5px rgba(37, 99, 235, 0.5)":"none"}},{children:[t.jsxs("div",e.__assign({ref:ge,className:g.default.scrollWrapper},{children:[t.jsx("div",e.__assign({ref:ot,className:g.default.stickyHeader},{children:t.jsx(c.default,{resetChatHistory:function(){var e="".concat(fe,"/api/chat/resetHistory?name=").concat(he,"&organizationName=").concat(o);try{var t={method:"GET",params:{guestSessionId:ve.current},headers:(null==ce?void 0:ce.accessToken)?{Authorization:"Bearer ".concat(ce.accessToken)}:{},withCredentials:!0};r.http.get(e,t).then(function(){T(!0),Fe(""),et(null),rt.current.clear(),me.current="".concat(l.v4()),je([]),qe(!0),null==P||P(),N&&N()}).catch(function(e){console.error(e)}).finally(function(){ve.current="".concat(he,"-").concat(o,"-").concat(l.v4())})}catch(e){Ee(!1),console.error(e)}},isStreamEnd:Ie,chatTitle:F,onResize:O,chatSize:K,movingTowards:G})})),t.jsxs("div",e.__assign({className:g.default.messagesList},{children:[t.jsxs("div",e.__assign({className:g.default.initialMessageRow},{children:[t.jsx("div",e.__assign({className:g.default.iconWrapper},{children:t.jsx(S.default,{})})),t.jsx("div",e.__assign({className:g.default.welcomeTextWrapper},{children:t.jsx("div",e.__assign({className:g.default.welcomeMarkdownWrapper},{children:t.jsx("span",{children:t.jsx(k.default,e.__assign({rehypePlugins:[E.default],components:Nt},{children:U}))})}))}))]})),Re.length>0&&Re.map(function(n,a){return t.jsxs("div",e.__assign({className:g.default.messageRow},{children:["assistant"===n.role?t.jsx("div",e.__assign({className:g.default.assistantIconContainer},{children:t.jsx(S.default,{})})):t.jsx("div",{className:g.default.userSpacer}),t.jsx("div",e.__assign({className:g.default.messageContent},{children:"assistant"===n.role?t.jsxs(t.Fragment,{children:[n.orchestratorAndAgentsMessages&&n.orchestratorAndAgentsMessages.length>0&&t.jsx(d.WatchMeWork,{orchestratorAndAgentsMessages:null==n?void 0:n.orchestratorAndAgentsMessages,isStreamEnd:Ie,finalTimeTaken:null==n?void 0:n.finalTimeTaken},null==n?void 0:n.id),t.jsx(h.default,{index:a,content:null==n?void 0:n.content,role:null==n?void 0:n.role,messages:Re,handleStream:Tt,isLastMessage:a===Re.length-1,onSave:Z,citations:null==n?void 0:n.citations,setChatSize:O,chatSize:K,isStreamEnd:Ie,messageIsEnd:null==n?void 0:n.isEnd,onViewComparison:le,onTypeResponseClick:function(){var e;vt(!0),null===(e=_e.current)||void 0===e||e.focus()},onComparisonLinkClick:ue,baseURL:fe,onFeedbackSubmit:qt}),t.jsx("div",e.__assign({className:g.default.timestamp},{children:n.time&&!isNaN(new Date(n.time).getTime())?new Date(n.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}):t.jsxs("div",e.__assign({className:g.default.userMessageWrapper},{children:[t.jsxs("div",e.__assign({className:g.default.userMessageBubble,style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:n.isSkeleton||Dt||n.id!==ut?"none":"0 0 15px 3px rgba(37, 99, 235, 0.6)"}},{children:[n.isSkeleton?t.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:"12px",minWidth:"280px",padding:"8px 0"}},{children:[t.jsx(v.Skeleton,{variant:"text",width:"100%",height:16}),t.jsx(v.Skeleton,{variant:"text",width:"80%",height:16})]})):t.jsx(h.default,{index:a,content:null==n?void 0:n.content,role:null==n?void 0:n.role,messages:Re,handleStream:Tt,isLastMessage:a===Re.length-1,onSave:Z,citations:null==n?void 0:n.citations,isStreamEnd:Ie,messageIsEnd:null==n?void 0:n.isEnd,onViewComparison:le,onComparisonLinkClick:ue,baseURL:fe,onFeedbackSubmit:qt}),t.jsx("div",e.__assign({style:{marginTop:"0.5rem"}},{children:t.jsx(y.UserIcon,{})}))]})),t.jsx("div",e.__assign({className:g.default.userTimestamp},{children:new Date(n.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}))}))]}),n.id)}),ke&&t.jsxs("div",e.__assign({className:g.default.loadingRow},{children:[t.jsx("div",e.__assign({className:g.default.iconWrapper,style:{marginTop:"0.2rem"}},{children:t.jsx(S.default,{})})),t.jsx("div",e.__assign({className:g.default.loadingTextWrapper},{children:t.jsx("span",{children:We})}))]})),t.jsx("div",{ref:Ce,style:{float:"left",clear:"both"}})]}))]})),t.jsxs("div",e.__assign({className:g.default.inputAreaWrapper},{children:[He&&t.jsxs(a.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:"8px",paddingBottom:"8px",paddingLeft:"4px",fontFamily:'"Plus Jakarta Sans", sans-serif',fontSize:"0.875rem",color:"#6b7280",width:"100%"}},{children:[t.jsx("span",{children:"Instant Learning AI is thinking"}),t.jsx(a.Box,{sx:{width:"5px",height:"5px",bgcolor:"#6b7280",borderRadius:"50%",animation:"".concat(xt," 1.4s infinite ease-in-out both"),animationDelay:"-0.32s"}}),t.jsx(a.Box,{sx:{width:"5px",height:"5px",bgcolor:"#6b7280",borderRadius:"50%",animation:"".concat(xt," 1.4s infinite ease-in-out both"),animationDelay:"-0.16s"}}),t.jsx(a.Box,{sx:{width:"5px",height:"5px",bgcolor:"#6b7280",borderRadius:"50%",animation:"".concat(xt," 1.4s infinite ease-in-out both")}})]})),t.jsx(w.default,e.__assign({title:L?"Please wait for the validation to be completed.":""},{children:t.jsxs("div",e.__assign({className:"".concat(g.default.inputBoxContainer," ").concat(yt?g.default.disabled:""),style:ht?{boxShadow:"0 0 15px 3px rgba(37, 99, 235, 0.5)",borderColor:"#2563eb",transition:"box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out"}:{transition:"box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out"}},{children:[Re.length>0&&!Ve&&t.jsx("div",e.__assign({onMouseDown:function(e){e.preventDefault(),jt("smooth")},className:g.default.scrollToBottomBtn},{children:t.jsx(C.ScrollToBottom,{})})),t.jsxs("div",e.__assign({style:{width:"100%",display:"flex"}},{children:[t.jsx("textarea",{ref:_e,placeholder:Q,value:Se||"",onChange:function(e){ye(e.target.value)},onFocus:function(){return Oe(!0)},onBlur:function(){return Oe(!1)},onKeyDown:function(e){return Tt(e)},disabled:yt,className:"no-scrollbar ".concat(g.default.chatTextarea),style:{minHeight:Ke?"120px":"50px",height:Ke?"120px":"50px",maxHeight:"120px"}}),t.jsx("span",e.__assign({className:g.default.sendButtonWrapper},{children:t.jsx("button",e.__assign({onClick:function(e){Tt(new KeyboardEvent("keydown",{key:"Enter"}))},disabled:bt,className:"".concat(g.default.sendButton," ").concat(bt?g.default.disabled:g.default.active)},{children:t.jsx(x.SendButton,{})}))}))]}))]}))}))]})),t.jsxs("div",e.__assign({className:g.default.footerTools},{children:[t.jsx(w.default,e.__assign({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:t.jsx("span",e.__assign({className:g.default.footerToolItem},{children:t.jsx(f.default,{amplitude:1,variant:"speaker",isActive:!1,onClick:function(){return null},disabled:!1})}))})),t.jsx(w.default,e.__assign({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:t.jsx("span",e.__assign({className:g.default.footerToolItem},{children:t.jsx(f.default,{amplitude:1,variant:"microphone",isActive:!1,onClick:function(){return null},disabled:!1})}))}))]}))]}))};
2
2
  //# sourceMappingURL=NormalChat.js.map
@@ -1,2 +1,2 @@
1
- import{__makeTemplateObject as e,__spreadArray as n,__assign as t,__awaiter as o,__generator as r,__rest as i}from"tslib";import{jsx as a,jsxs as s,Fragment as l}from"react/jsx-runtime";import{useRef as c,useState as d,useMemo as u,useEffect as v,useCallback as m,useLayoutEffect as h}from"react";import{keyframes as g,Dialog as p,Box as f}from"@mui/material";import C from"@mui/material/Tooltip";import b from"react-markdown";import y from"rehype-raw";import{http as S}from"../../../../api/transport.js";import{v4 as w}from"uuid";import{stopStreaming as x,startChatStream as k}from"@e-llm-studio/streaming-response";import{WatchMeWork as I}from"@e-llm-studio/watch-me-work";import T from"./ChatHeader.js";import _ from"../MessageRendering/MessageRendering.js";import{Skeleton as E}from"../atoms/SkeletonLoader/SkeletonLoader.js";import{ActionableButton as M}from"../MessageRendering/ClickableChatComponents.js";import R from"../AudioWaveform.js";import D from"./ChatComponent.module.css.js";import N from"../../InstantLearning.module.css.js";import{ScrollToBottom as q}from"../_svg/ScrollToBottom.js";import{useHeaderObserver as F,extractTextFromChildren as L}from"../../helpers/utils.js";import{SendButton as A}from"../_svg/SendButton.js";import W from"../_svg/SparkleIcon.js";import{UserIcon as z}from"../_svg/UserIcon.js";import P from"../../../LearningManagement/store/useAuthStore.js";var j,B=function(e,n){return S.post("".concat(e||"https://devllmstudio.creativeworkspace.ai","/api/chat/chatResponse"),{name:"ilggcautopromptgen",organizationName:"techolution",prompt:n||"Generate a query"},{headers:{"Content-Type":"application/json"},withCredentials:!0}).then(function(e){return e.data}).catch(function(e){throw console.error("Error calling auto-generate API:",e),e})},O=function(B){var O=B.chatAssistantName,H=B.organizationName,U=B.baseUrl,G=B.baseWebsocketUrl,Z=B.setIsNewChatClicked;B.ThinkingBulbIconComponent;var K=B.isFormSaveClicked,V=B.setIsFormSavedClicked,Q=B.onResetLearningData,J=B.sendMessageInChat,$=B.setSendMessageInChat,X=B.isFormValidating,Y=B.chatTitle,ee=B.customMetaData,ne=B.headerMessageHandlers;B.aiResponse;var te=B.setAIResponse,oe=B.onResetChat,re=B.initialChatMessage,ie=void 0===re?"":re,ae=B.onSave,se=B.chatSize,le=B.setChatSize,ce=B.movingTowards,de=B.setCitations,ue=B.textareaPlaceholder,ve=void 0===ue?"Tell me more about this learning...":ue,me=B.setCurrentRequestId,he=B.showSavedMessage,ge=void 0!==he&&he,pe=B.savedMessage,fe=B.isError,Ce=void 0!==fe&&fe,be=B.errorMessage,ye=void 0===be?"There was an error saving your changes.":be;B.isSaving;var Se=B.isHighlighted,we=void 0!==Se&&Se,xe=B.onStreamingStateChange,ke=B.onViewComparison;B.isCopyEnabled;var Ie=B.onComparisonLinkClick,Te=B.onSubmitFeedback,_e=B.userDetails,Ee=B.isGlobalEditActive,Me=B.socketTimeOutInMilliSeconds,Re=B.initialDraftMessage,De=void 0===Re?"":Re,Ne=B.onValidateSession,qe=B.onCloseSessionModal,Fe=B.fieldLabelMap,Le=B.enableChatLogs,Ae=void 0!==Le&&Le,We=P().user,ze=O,Pe=c("".concat(ze,"-").concat(H,"-").concat(w())),je=c("".concat(w())),Be=U,Oe=c(null),He=c(!0),Ue=c(null),Ge=c(null),Ze=d(De),Ke=Ze[0],Ve=Ze[1],Qe=d([]),Je=Qe[0],$e=Qe[1],Xe=d(!1),Ye=Xe[0],en=Xe[1],nn=d(!1);nn[0];var tn=nn[1],on=d(!0),rn=on[0],an=on[1],sn=d(!0);sn[0];var ln=sn[1],cn=d("");cn[0];var dn=cn[1],un=d(""),vn=un[0],mn=un[1],hn=d(!1),gn=hn[0],pn=hn[1],fn=d(!1),Cn=fn[0],bn=fn[1],yn=d(!0),Sn=yn[0],wn=yn[1],xn=d("100%");xn[0];var kn=xn[1],In=d(null),Tn=In[0],_n=In[1],En=d(!1);En[0];var Mn=En[1],Rn=d(!1),Dn=Rn[0],Nn=Rn[1],qn=c(null),Fn=c(new Set),Ln=d(null),An=Ln[0],Wn=Ln[1],zn=d(!1),Pn=zn[0],jn=zn[1],Bn=d(!1);Bn[0],Bn[1];var On=d(null);On[0],On[1],c(null),c(null);var Hn=c(new Map),Un=c(""),Gn=c(new Set),Zn=c(0),Kn=c(!0),Vn=c(new Map),Qn=c(!1),Jn=c(0),$n=c(new Map),Xn=c(null),Yn=d(!1),et=Yn[0],nt=Yn[1];g(j||(j=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 tt=u(function(){return""===(null==Ke?void 0:Ke.trim())||gn},[Ke,gn]),ot=u(function(){return X},[X]),rt=u(function(){var e;return Je.length>0&&"user"===(null===(e=Je[Je.length-1])||void 0===e?void 0:e.role)},[Je]),it=u(function(){return tt||X||!!Ee||rt},[tt,X,Ee,rt]);v(function(){De&&!Ke&&(Ve(De),bn(!0),setTimeout(function(){if(Ge.current){Ge.current.focus();var e=De.length;Ge.current.setSelectionRange(e,e)}},400))},[De]),v(function(){null==xe||xe(gn)},[gn,xe]),v(function(){return Kn.current=!0,function(){Kn.current=!1,Zn.current+=1,$n.current.forEach(function(e){return clearTimeout(e)}),$n.current.clear(),Un.current&&G&&x(Un.current,G,!1)}},[G]),v(function(){var e=Oe.current,n=function(){if(e){var n=e.scrollTop,t=e.scrollHeight,o=e.clientHeight;wn(t-n-o<=20)}};return e&&(e.addEventListener("scroll",n),n()),function(){e&&e.removeEventListener("scroll",n)}},[Je]);var at=F({handlers:ne,setResult:te}).processHeaderMessage;v(function(){ge&&Nn(!0)},[ge]),v(function(){if(Pn){var e=setTimeout(function(){jn(!1)},3e3);return function(){return clearTimeout(e)}}},[Pn]),v(function(){K&&!Ee&&(gt(new KeyboardEvent("keydown",{key:"Enter"}),!1,"Save this Learning"),V(!1))},[K]),v(function(){if(J)try{if(J.startsWith("__SKELETON__:")){var e=J.split(":"),o=e[1],r=e.slice(2).join(":"),i={role:"user",content:"",id:o,time:new Date,isSkeleton:!0,skeletonContent:r};return $e(function(e){return n(n([],e,!0),[i],!1)}),gt(new KeyboardEvent("keydown",{key:"Enter"}),!1,r,!1,o),Wn(o),$&&$(""),void setTimeout(function(){Wn(null)},2e3)}if(J.startsWith("__SKELETON_END__::")){var a=J.split("::")[1]||"";return $e(function(e){return e.map(function(e){return e.isSkeleton?t(t({},e),{isSkeleton:!1,content:e.skeletonContent||a}):e})}),void($&&$(""))}var s=w();gt(new KeyboardEvent("keydown",{key:"Enter"}),!1,J,!1,s),Wn(s),$&&$(""),setTimeout(function(){return Wn(null)},2e3)}catch(e){console.error("Error handling sendMessageInChat signal",e)}},[J]),v(function(){lt(),ct();var e=function(){var e,n=(null===(e=null==qn?void 0:qn.current)||void 0===e?void 0:e.clientHeight)||0,t="calc(100% - ".concat(n,"px - 10px)");kn(t)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var st=m(function(e){var n="string"==typeof e?e:"smooth";Ue.current&&Ue.current.scrollIntoView({behavior:n,block:"end"}),He.current&&setTimeout(function(){Ue.current&&He.current&&Ue.current.scrollIntoView({behavior:n,block:"end"})},100)},[]);v(function(){if(!gn){var e="";if(Dn?e=pe||"Thank you teacher for teaching me, your rule has been saved successfully.":Ce&&(e=ye||"I'm sorry, I couldn't save your changes. Please try again."),e){var t={role:"assistant",content:e,id:w(),citations:[],time:new Date};$e(function(e){return n(n([],e,!0),[t],!1)}),Nn(!1),setTimeout(function(){return st("smooth")},100)}}},[Dn,Ce,gn,pe,ye,st]),v(function(){He.current&&st("smooth")},[st]);var lt=function(){var e={method:"get",maxBodyLength:1/0,url:"".concat(Be,"/api/chatbot/getChatSettings?name=").concat(ze,"&organizationName=").concat(H),headers:{}};S.request(e).then(function(e){var n,t,o;(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.chatSettings)&&""!==(null===(o=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.chatSettings)||void 0===o?void 0:o.chatInitialMessage)&&ln(!0)}).catch(function(e){console.error(e)})},ct=function(){return o(void 0,void 0,void 0,function(){var e,n;return r(this,function(t){e="".concat(Be,"/api/chat/history?name=").concat(ze,"&organizationName=").concat(H);try{n={method:"GET",params:{guestSessionId:Pe.current},withCredentials:!0},S.get(e,n).then(function(e){var n=e.data;n.length>0?($e(n),st()):ln(!0)}).catch(function(e){console.error(e)})}catch(e){en(!1),console.error(e)}return[2]})})},dt=function(){var e="".concat(Be,"/api/chat/resetHistory?name=").concat(ze,"&organizationName=").concat(H);try{var n={method:"GET",params:{guestSessionId:Pe.current},withCredentials:!0};S.get(e,n).then(function(){Z(!0),dn(""),_n(null),Fn.current.clear(),Vn.current.clear(),je.current="".concat(w()),$e([]),ln(!0),Xn.current=null,null==oe||oe(),Q&&Q()}).catch(function(e){console.error(e)}).finally(function(){Pe.current="".concat(ze,"-").concat(H,"-").concat(w())})}catch(e){en(!1),console.error(e)}};function ut(e){return null==e?void 0:e.replace(/<a [^>]*>.*?<\/a>/g,function(e){return null==e?void 0:e.replace(/\*/g,"&ast;")})}var vt=function(e,o,r,i,a,s,l){var c,d,u,v,m,h,g,p,f,C,b,y,S,x,k,I,T,_,E,M,R,D,N,q,F,L,A,W,z,P;if(null===(d=null===(c=null==e?void 0:e.chatStream)||void 0===c?void 0:c.continueChatResult)||void 0===d?void 0:d.header_message){var j={header_message:e.chatStream.continueChatResult.header_message,responsedata:null===(m=null===(v=null===(u=null==e?void 0:e.chatStream)||void 0===u?void 0:u.continueChatResult)||void 0===v?void 0:v.message)||void 0===m?void 0:m.content};at(j)}var B=null===(h=null==e?void 0:e.chatStream)||void 0===h?void 0:h.continueChatResult,O=null==B?void 0:B.isEnd,H=(null===(g=null==B?void 0:B.message)||void 0===g?void 0:g.citations)||[];O&&H.length>0&&de&&de(H);var U={role:"assistant",content:"",id:w()};if(null===(b=null===(C=null===(f=null===(p=null==e?void 0:e.chatStream)||void 0===p?void 0:p.continueChatResult)||void 0===f?void 0:f.message)||void 0===C?void 0:C.content)||void 0===b?void 0:b.includes("WaitMessage: "))tn(!0),U.content=function(e){var n="WaitMessage: ",t=e.indexOf(n);if(-1!==t){var o=e.substring(t+13);return null==o?void 0:o.replaceAll("WaitMessage: ","")}return""}((null===(x=null===(S=null===(y=null==e?void 0:e.chatStream)||void 0===y?void 0:y.continueChatResult)||void 0===S?void 0:S.message)||void 0===x?void 0:x.content)+"\n\n"),""!==U.content&&(en(!1),$e(n(n([],Je,!0),[{role:"user",content:a,time:i,isFirstQuestionSent:s||!1,id:l||(null===(I=null===(k=null==e?void 0:e.chatStream)||void 0===k?void 0:k.continueChatResult)||void 0===I?void 0:I.requestId)||"",reply:""},U],!1)));else{tn(!1);var G=null===(_=null===(T=null==e?void 0:e.chatStream)||void 0===T?void 0:T.continueChatResult)||void 0===_?void 0:_.requestId;"string"==typeof G&&G&&me&&me(G);var Z=function(e,o,r,i){var a,s,l,c,d,u,v,m={role:"assistant",content:"",id:w(),time:new Date,citations:[]},h=(null===(a=null==e?void 0:e.chatStream)||void 0===a?void 0:a.continueChatResult)||{},g=null==h?void 0:h.requestId,p=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)||"",b=null==h?void 0:h.is_orchestrator,y=null==h?void 0:h.thinking_break,S=(null===(l=null==h?void 0:h.message)||void 0===l?void 0:l.citations)||[];if(g&&p&&C&&!f){var x=i.current.get(g)||[];x[x.length-1]!==C&&(x.push(C),i.current.set(g,x))}var k=(g&&i.current.get(g)||[]).join("\n\n"),I="";if(f)I=k&&""!==k.trim()?k:C;else if(p)I=k;else{var T=C.replace(/<!--(?![\s\S]*-->)[\s\S]*$/,"").trimEnd(),_=!1===b||y||0!==S.length?"":T;I=k?"".concat(k,"\n\n").concat(_):_}if(m.content=ut(I),!0===(null==h?void 0:h.thinking_break)&&!0===(null==h?void 0:h.is_orchestrator)&&!1===(null==h?void 0:h.isEnd)&&o.push({responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!1}),!1===(null==h?void 0:h.thinking_break)&&!1===(null==h?void 0:h.is_orchestrator)&&!1===(null==h?void 0:h.isEnd)){if(h.explainability_id&&h.responded_by){var E=h.explainability_id,M=h.responded_by;r.has(E)||r.set(E,{responded_by:M,index:o.length})}r.has(h.explainability_id)?o[null==(R=r.get(h.explainability_id))?void 0:R.index]={responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!0,explainability_id:null!==(c=h.explainability_id)&&void 0!==c?c:"",isParallelToolResponse:!0}:o=n(n([],o,!0),[{responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!0,explainability_id:null!==(d=h.explainability_id)&&void 0!==d?d:"",isParallelToolResponse:!1}],!1)}if(!0===(null==h?void 0:h.thinking_break)&&!1===(null==h?void 0:h.is_orchestrator)&&!1===(null==h?void 0:h.isEnd)){var R;h.explainability_id&&h.responded_by&&(E=h.explainability_id,M=h.responded_by,r.has(E)||r.set(E,{responded_by:M,index:o.length})),r.has(h.explainability_id)?o[null==(R=r.get(h.explainability_id))?void 0:R.index]={responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!1,explainability_id:null!==(u=h.explainability_id)&&void 0!==u?u:"",isParallelToolResponse:!0}:o.push({responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!1,explainability_id:null!==(v=h.explainability_id)&&void 0!==v?v:"",isParallelToolResponse:!1})}return t({orchestratorAndAgentsMessages:o},m)}(e,r,o,Vn);Z.time=new Date,Z.citations=H,Z.isEnd=null===(M=null===(E=null==e?void 0:e.chatStream)||void 0===E?void 0:E.continueChatResult)||void 0===M?void 0:M.isEnd,Z.requestId=null===(D=null===(R=null==e?void 0:e.chatStream)||void 0===R?void 0:R.continueChatResult)||void 0===D?void 0:D.requestId,Z.sessionId=Pe.current,null===(N=Z.orchestratorAndAgentsMessages)||void 0===N||N.forEach(function(e){e&&e.header_message&&at(e)}),(""!==(null==Z?void 0:Z.content)||(null==Z?void 0:Z.orchestratorAndAgentsMessages)&&(null==Z?void 0:Z.orchestratorAndAgentsMessages.length)>0)&&(en(!1),$e(n(n([],Je,!0),[{role:"user",content:a||"",time:i,isFirstQuestionSent:s||!1,id:l||(null===(F=null===(q=null==e?void 0:e.chatStream)||void 0===q?void 0:q.continueChatResult)||void 0===F?void 0:F.requestId)||"",requestId:null!==(W=null===(A=null===(L=null==e?void 0:e.chatStream)||void 0===L?void 0:L.continueChatResult)||void 0===A?void 0:A.requestId)&&void 0!==W?W:""},Z],!1))),an(null===(P=null===(z=null==e?void 0:e.chatStream)||void 0===z?void 0:z.continueChatResult)||void 0===P?void 0:P.isEnd)}},mt=m(function(e,t){void 0===t&&(t="inactivity"),console.error("🛑 Stream failed or timed out due to:reason=".concat(t," requestId=").concat(e," at ").concat((new Date).toISOString()));var o=$n.current.get(e);o&&(clearTimeout(o),$n.current.delete(e)),e&&G&&(x(e,G,!1),Vn.current.delete(e)),e===Un.current?(Qn.current=!1,an(!0),pn(!1),Mn(!1),en(!1),tn(!1),$e(function(e){var o=n([],e,!0).reverse().find(function(e){return"user"===e.role}),r=((null==o?void 0:o.content)||"").replace(/"/g,"&quot;"),i=n([],e,!0),a=i[i.length-1];a&&"assistant"===a.role&&!a.isEnd&&i.pop();var s="I ran into an unexpected issue while trying to process this learning.";return"inactivity"===t?s="Something went wrong—teaching is taking longer than expected.":"websocket_error"===t&&(s="I lost connection to the server while working on that."),n(n([],i,!0),[{role:"assistant",content:"".concat(s,' Please try again.\n\n<button class="clickable-button" data-value="').concat(r,'">Retry</button>'),id:w(),time:new Date,isEnd:!0,citations:[]}],!1)})):console.warn("🛑 [handleStreamTimeout] Ignoring stale timeout for superseded requestId=".concat(e,"; active=").concat(Un.current))},[Me,G]),ht=m(function(e){var n=$n.current.get(e);if(n&&clearTimeout(n),Me&&Me>0){console.log("⏱️ [Timeout armed] requestId=".concat(e," timeout=").concat(Me,"ms at ").concat((new Date).toISOString()));var t=setTimeout(function(){console.warn("⏱️ [Timeout FIRED — auto stop] requestId=".concat(e," at ").concat((new Date).toISOString())),mt(e,"inactivity")},Me);$n.current.set(e,t)}},[mt,Me]),gt=function(e,i,a,s,l,c){return o(void 0,void 0,void 0,function(){var o,s,d,u,v,m,h,g,p,f,C,b,y,S,x,I,T;return r(this,function(r){switch(r.label){case 0:if(o=(void 0!==a?a:Ke||"").trim(),(s="Enter"===(null==e?void 0:e.key)&&!(null==e?void 0:e.shiftKey)&&!Ee)&&(null===(b=null==e?void 0:e.preventDefault)||void 0===b||b.call(e)),d="user"===(null===(y=Je[Je.length-1])||void 0===y?void 0:y.role),!o||gn||Qn.current||d||(null==e?void 0:e.key)&&!s)return[2];if(Xn.current||(Xn.current=(new Date).toISOString(),console.log("Session start time set to ".concat(Xn.current))),!Ne)return[3,5];en(!0),mn("Validating session..."),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,Ne(Xn.current)];case 2:return r.sent()?[3,4]:(nt(!0),en(!1),c&&c(!1),[2]);case 3:return u=r.sent(),console.error("Validation error:",u),nt(!0),en(!1),c&&c(!1),[2];case 4:en(!1),r.label=5;case 5:return Qn.current=!0,"I want to add a rule description"===o?(an(!1),He.current=!0,pn(!0),!Tn&&o&&_n(a||"manual_entry"),v=new Date,$e(function(e){return n(n([],e.map(function(e,n){var o;return t(t({},e),{content:null===(o=ut(e.content))||void 0===o?void 0:o.replace("WaitMessage: ","")})}),!0),[{role:"user",content:o,time:v,isFirstQuestionSent:!1,id:l||w()}],!1)}),st("smooth"),setTimeout(function(){$e(function(e){return n(n([],e,!0),[{role:"assistant",content:"I'd be happy to help you set up a new rule! To get started, could you tell me what kind of behavior or logic you would like this rule to follow?",id:w(),citations:[],time:new Date}],!1)}),st("smooth"),setTimeout(function(){pn(!1),an(!0)},500)},500),[2]):(an(!1),He.current=!0,pn(!0),!Tn&&o&&_n(a||"manual_entry"),m=new Date,h=Zn.current,$e(function(e){var r=e.map(function(e){var n;return t(t({},e),{content:null===(n=ut(e.content))||void 0===n?void 0:n.replace("WaitMessage: ","")})});return l&&r.some(function(e){return e.id===l})?r.map(function(e){return e.id===l?t(t({},e),{content:o}):e}):n(n([],r,!0),[{role:"user",content:o,time:m,isFirstQuestionSent:!1,id:l||w()}],!1)}),st("smooth"),g=new Map,p=[],f=function(e){var n;if(!e)return{};var t=Object.keys(e);return 1===t.length&&"current"===t[0]?null!==(n=e.current)&&void 0!==n?n:{}:e},C={WEBSOCKET_URL:G,organizationName:H,chatAssistantName:ze,selectedAIModel:"gpt-4",replyMessage:"",userName:null!==(S=null==_e?void 0:_e.name)&&void 0!==S?S:"Guest User",userEmailId:null!==(x=null==_e?void 0:_e.email)&&void 0!==x?x:"guestUser@example.com",userId:null!==(I=null==_e?void 0:_e.id)&&void 0!==I?I:"Guest User",query:o,requestId:"requestId-".concat(w()),customPrompt:"",enableForBackend:!1,guestSessionId:Pe.current,chatPreviewId:je.current,customMetaData:f(ee),aiModel:"",enableLogs:!0,logControls:{infoLogs:Ae,debugLogs:Ae},additionalHeaders:(null==We?void 0:We.accessToken)?{Authorization:"Bearer ".concat(We.accessToken)}:void 0,onStreamEvent:function(e){var n,t,r,a,s,c;if(Kn.current&&Zn.current===h){var d=null===(t=null===(n=null==e?void 0:e.chatStream)||void 0===n?void 0:n.continueChatResult)||void 0===t?void 0:t.requestId,u=null===(a=null===(r=null==e?void 0:e.chatStream)||void 0===r?void 0:r.continueChatResult)||void 0===a?void 0:a.header_message;console.log("📦 [Stream Chunk Received] With RequestID and header_message: ".concat(d,",").concat(u)),ht(C.requestId);var v=null===(c=null===(s=null==e?void 0:e.chatStream)||void 0===s?void 0:s.continueChatResult)||void 0===c?void 0:c.error_state;if(Array.isArray(v)&&v.length>0)return console.error("⚠️ Agent returned an error_state during stream:",{requestId:d,errorState:v}),void mt(C.requestId,"agent_error");vt(e,g,p,m,o,i,l)}},onStreamEnd:function(e){var o,r;if(Kn.current&&Zn.current===h){var i=null===(r=null===(o=null==e?void 0:e.chatStream)||void 0===o?void 0:o.continueChatResult)||void 0===r?void 0:r.requestId;Gn.current.add(C.requestId),console.log("✅ [Stream Completed] RequestID: ".concat(i));var a=$n.current.get(C.requestId);a&&(clearTimeout(a),$n.current.delete(C.requestId)),Qn.current=!1,an(!0),pn(!1),Mn(!1);var s=Date.now(),l=Hn.current.get(C.requestId);if(l){var c=Math.round((s-l)/1e3).toFixed(1);$e(function(e){var o=n([],e,!0).reverse().findIndex(function(e){return"assistant"===e.role});if(-1===o)return e;var r=e.length-1-o;return e.map(function(e,n){return n===r?t(t({},e),{finalTimeTaken:c}):e})})}}},onError:function(e){if(Kn.current&&Zn.current===h){var n=$n.current.get(C.requestId);if(n&&(clearTimeout(n),$n.current.delete(C.requestId)),Gn.current.has(C.requestId))return console.warn("Ignoring post-completion error for already-finished request:",C.requestId),void Gn.current.delete(C.requestId);console.error("Stream error:",e),mt(C.requestId,"websocket_error")}}},o&&(en(!0),null===(T=Ge.current)||void 0===T||T.blur(),Ve(""),st(),mn(l?"Just a moment, processing your request...":"Okay, got it. Let me take a moment to work on this and I'll get back to you shortly."),Hn.current.set(C.requestId,Date.now()),Un.current=C.requestId,console.log("Chat Stream Params:",C),ht(C.requestId),Jn.current+=1,console.log("🚀 [UI Action] stream started (Total UI invocations: ".concat(Jn.current,") | RequestID: ").concat(C.requestId,' | Query: "').concat(o,'"')),k(C)),c&&c(!1),[2])}})})},pt=c(null);h(function(){pt.current=gt});var ft=m(function(){for(var e,t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return null===(e=pt.current)||void 0===e?void 0:e.call.apply(e,n([pt],t,!1))},[]),Ct=u(function(){return{p:function(e){e.node;var n=e.children;return i(e,["node","children"]),a("div",t({style:{margin:0,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"10px",fontFamily:"inherit"}},{children:n}))},button:function(e){e.node;var n=e.className,o=e.children,r=i(e,["node","className","children"]),l=L(o),c=r["data-value"],d="Tester Genie"===l;return a(M,t({},r,{className:n,handleStream:ft,isStreamEnd:rn,disabled:!!Tn||!!Ee,isLastMessage:!0,style:{margin:0},isTesterGenie:d,"data-selected":Tn===l||Tn===c?"true":Tn?"false":void 0},{children:s("span",t({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[o,d&&s("svg",t({width:"16",height:"20",viewBox:"0 0 16 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[a("path",{d:"M7.20368 8.94768e-06C7.48895 -0.00208639 7.69331 0.364327 7.83856 0.57465C8.14381 1.01633 8.38012 1.87909 7.71077 2.14118C8.57167 2.21011 9.70406 2.93098 10.1785 3.64699C10.5932 4.27286 10.4559 5.16037 9.80301 5.56007L9.9502 7.16593C9.97671 7.44871 10.0265 7.87092 10.0299 8.14457C10.4213 8.23046 11.0787 8.55391 11.326 8.87592C11.5979 8.75656 11.9189 8.76963 12.1688 8.93469C12.3563 8.67751 12.5598 8.41456 12.7507 8.15787C12.3283 7.45155 12.5047 6.57745 13.2143 6.13784C13.5375 5.9377 13.9264 5.87277 14.2971 5.95705C14.0961 6.30964 13.8775 6.72182 13.6593 7.05857C13.7906 7.2436 13.9184 7.44225 14.044 7.63194L14.8022 7.63198C15.0349 7.30106 15.2515 6.90827 15.4835 6.59349C15.8623 7.0712 15.8156 7.79671 15.4734 8.28241C15.1318 8.76741 14.4886 8.9899 13.9118 8.88251C13.758 9.12108 13.5577 9.39243 13.3941 9.63201C13.7143 9.9316 13.7725 10.364 13.4067 10.6594C13.5231 10.8889 13.5309 11.1613 13.447 11.402C13.1502 12.2523 12.1724 12.5645 11.3474 12.5025C11.1171 12.4852 10.939 12.4698 10.7197 12.3953C10.8724 13.1271 10.7744 14.2031 10.5132 14.9051C10.1688 15.8304 9.43632 16.5569 8.54503 16.9655C7.90465 17.2706 7.21222 17.3607 6.50472 17.4505C5.74445 17.5471 4.75801 17.4362 4.08533 17.825C3.9327 17.9132 3.86566 18.0173 3.82943 18.1792C3.94996 18.5982 4.47858 18.6063 4.78474 18.8897C5.20191 19.2758 4.90716 19.9663 4.36611 19.9908C4.31476 19.9931 4.26867 19.9867 4.23186 19.9493C4.23089 19.8303 4.47587 19.7199 4.49787 19.5262C4.55075 19.0604 3.70014 19.0078 3.37835 18.8374C3.13013 18.706 2.99537 18.6309 2.82242 18.4021C2.63795 18.1579 2.58428 17.835 2.63138 17.5392C2.74868 16.7847 3.47123 16.393 4.12184 16.1497C4.61314 15.9659 5.46304 15.7158 5.52019 15.0793C5.58589 14.348 4.97543 13.5523 4.57739 12.9807C4.44275 12.7875 4.3039 12.579 4.16309 12.3919C4.18987 12.365 4.21049 12.3463 4.23916 12.3212C4.59619 12.6218 5.21209 12.6421 5.55038 12.2979C5.70457 12.144 5.78974 11.9342 5.78642 11.7164C5.78121 11.4493 5.63382 11.2002 5.4454 11.019C5.44704 10.9932 5.44824 10.9676 5.449 10.9419C5.4566 10.6648 5.37505 10.4902 5.1892 10.2943C5.18398 10.2538 5.17776 10.2134 5.17053 10.1732C5.08123 9.69297 4.71708 9.34182 4.23415 9.27108C4.16418 9.26083 3.96108 9.26105 3.92071 9.23344C3.90485 9.1828 3.9059 9.20792 3.91904 9.15527C4.22103 8.90139 4.14407 8.78214 4.31107 8.4846C4.42301 8.28513 4.73047 8.15239 4.95452 8.10701C4.96167 7.51076 5.03684 6.88562 5.10036 6.29144C5.12451 6.0655 5.12531 5.75046 5.1511 5.55257C4.11108 4.86747 4.39091 3.75946 5.25465 3.06391C5.84978 2.58469 6.34496 2.31002 7.10143 2.14517C7.01589 2.10416 6.93842 2.04811 6.87269 1.97972C6.77021 1.87349 6.70248 1.73857 6.67853 1.59293C6.60568 1.12096 7.04104 0.914625 7.18759 0.526392C7.26428 0.323403 7.03925 0.146075 7.20368 8.94768e-06Z",fill:"#475569"}),a("path",{d:"M7.459 4.5C7.48797 4.50312 7.71949 4.61154 7.76205 4.63061C8.27062 4.85835 8.87051 5.09164 9.35658 5.3582C9.36602 6.03495 9.37016 6.56625 8.70573 6.91519C8.6633 6.80883 8.63019 6.72409 8.56332 6.63044C8.43786 6.45568 8.24656 6.33963 8.03354 6.30909C7.8434 6.28211 7.65146 6.3197 7.49586 6.43503C7.21897 6.21256 6.76265 6.28197 6.5229 6.52486C6.39308 6.65639 6.34815 6.75074 6.28902 6.92344C5.59702 6.5957 5.58761 6.04267 5.60583 5.35582C5.89882 5.23844 6.21318 5.0724 6.50153 4.941C6.82145 4.79522 7.14482 4.6574 7.459 4.5Z",fill:"#D1EDFD"}),a("path",{d:"M11.0756 10.6406C11.1037 10.6701 11.1324 10.7706 11.1535 10.8145C11.2818 11.0817 11.4922 11.1945 11.7498 11.2977C11.5607 11.63 11.4567 11.8797 11.1034 12.0466L11.0839 12.0517C10.9262 12.0927 10.7996 12.0968 10.651 12.0135C10.4755 11.915 10.3807 11.6614 10.4792 11.478C10.6388 11.1809 10.8877 10.9272 11.0756 10.6406Z",fill:"#D1EDFD"}),a("path",{d:"M11.6036 9.1377C11.6993 9.11763 11.8391 9.16378 11.9294 9.19593C11.6952 9.50644 11.4706 9.81614 11.2327 10.1261L11.1572 10.2255C10.7581 9.73539 11.0333 9.24481 11.6036 9.1377Z",fill:"#D1EDFD"}),a("path",{d:"M7.49681 0.882812C7.53691 0.925159 7.61244 1.08523 7.63598 1.14156C7.74243 1.39673 7.75769 1.76908 7.38596 1.77504C7.28236 1.75599 7.15628 1.68938 7.13517 1.5783C7.0843 1.3107 7.35609 1.09964 7.48737 0.897583L7.49681 0.882812Z",fill:"#D1EDFD"}),a("path",{d:"M1.68305 6.17249C1.71659 6.1673 1.8134 6.16478 1.84892 6.16432C2.34052 6.15616 2.81496 6.34495 3.16655 6.68866C3.50847 7.01806 3.70349 7.47119 3.70765 7.94596C3.70896 8.42345 3.54045 8.85284 3.20281 9.19025C3.34033 9.28068 3.5321 9.52219 3.6543 9.65748C4.17158 9.39073 4.91447 9.69339 4.79675 10.3444C5.08751 10.5485 5.19656 10.8288 5.0585 11.1674C5.15418 11.2375 5.25595 11.3205 5.32383 11.4186C5.40228 11.5303 5.4309 11.6695 5.40291 11.8031C5.32228 12.1857 4.90085 12.3286 4.57669 12.1236C4.51367 12.0838 4.42258 11.9595 4.35299 11.9431C4.30669 11.9557 4.28453 11.9584 4.23644 11.9644C4.22885 11.9742 4.22118 11.9841 4.21343 11.9938C3.93597 12.3413 3.49234 12.4682 3.06933 12.5157C2.85285 12.518 2.70432 12.5146 2.49066 12.4609C1.80785 12.2892 1.50808 11.6167 1.70723 10.9639C1.829 10.5648 2.11891 10.2506 2.48939 10.0518C2.54655 10.132 2.57559 10.2191 2.64066 10.303C2.73571 10.2223 2.82048 10.1482 2.92363 10.0773C2.81023 9.95313 2.66811 9.7693 2.55817 9.63584C2.38871 9.6878 2.23026 9.72879 2.05298 9.74653C1.54239 9.80228 1.03118 9.64711 0.637735 9.31695C0.269964 9.01018 0.0453493 8.54827 0.00544736 8.07322C-0.0309495 7.60988 0.116099 7.15077 0.414918 6.79478C0.742554 6.41198 1.18728 6.21393 1.68305 6.17249Z",fill:"#475569"}),a("path",{d:"M1.79616 6.5951C2.54894 6.5619 3.18687 7.14364 3.22301 7.8963C3.25915 8.64894 2.67989 9.28913 1.92739 9.3282C1.17073 9.3675 0.526231 8.78435 0.489885 8.02753C0.45354 7.27071 1.03921 6.62849 1.79616 6.5951Z",fill:"#D1EDFD"}),a("path",{d:"M4.93607 11.4844C5.12839 11.6261 5.22049 11.9085 4.91876 11.9419C4.8067 11.8805 4.78491 11.8646 4.71094 11.7561C4.81572 11.6752 4.862 11.5925 4.93607 11.4844Z",fill:"#FEFEFD"}),a("path",{d:"M12.5164 3.58594L12.5715 3.59466C12.6589 3.65863 12.6908 3.94434 12.7882 4.05193C12.8789 4.15216 12.9155 4.17816 13.0326 4.24929C13.1363 4.31224 13.3325 4.34025 13.384 4.43124C13.3643 4.56218 13.0693 4.54857 12.9127 4.69344C12.6903 4.89898 12.7114 5.06971 12.5892 5.28622C12.5669 5.28439 12.5368 5.2868 12.5261 5.27346C12.4336 5.15843 12.4072 4.9308 12.3099 4.81465C12.1627 4.63903 11.9972 4.60054 11.7981 4.51372C11.7544 4.49467 11.7266 4.47099 11.7129 4.42649C11.7867 4.31876 12.0509 4.34309 12.2376 4.14892C12.43 3.94901 12.4155 3.72208 12.5164 3.58594Z",fill:"#475569"}),a("path",{d:"M2.13644 3.72656C2.24401 3.77084 2.29712 4.1268 2.431 4.25226C2.60327 4.41371 2.7311 4.41949 2.93246 4.52449C2.96024 4.53897 2.97173 4.56042 2.97671 4.58878C2.89584 4.6981 2.61854 4.70721 2.4596 4.85659C2.26275 5.04156 2.27341 5.29132 2.17022 5.42088C2.16192 5.41849 2.11671 5.40232 2.1156 5.40043C2.01291 5.21216 1.9836 5.04909 1.84812 4.87273C1.73599 4.72675 1.36534 4.69959 1.32812 4.56939C1.3835 4.47941 1.67823 4.44211 1.82291 4.30563C2.02737 4.11274 2.0042 3.8372 2.13644 3.72656Z",fill:"#475569"})]}))]}))}))}}},[ft,rn,Tn,Ee]),bt=u(function(){return Je.some(function(e){return e.isSkeleton})},[Je]),yt=function(e){return o(void 0,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return Te?[4,Te(e)]:[3,2];case 1:t.sent(),$e(function(e){return n(n([],e,!0),[{role:"assistant",content:"Thanks for your feedback — this will help improve future suggestions.",id:w(),citations:[],time:new Date,isEnd:!0}],!1)}),setTimeout(function(){return st("smooth")},100),t.label=2;case 2:return[2]}})})};return s("div",t({className:"".concat(N.customFont," ").concat(D.chatContainer),style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:we&&!bt?"0 0 20px 5px rgba(37, 99, 235, 0.5)":"none"}},{children:[s("div",t({ref:Oe,className:D.scrollWrapper},{children:[a("div",t({ref:qn,className:D.stickyHeader},{children:a(T,{resetChatHistory:dt,isStreamEnd:rn,chatTitle:Y,onResize:le,chatSize:se,movingTowards:ce})})),s("div",t({className:D.messagesList},{children:[s("div",t({className:D.initialMessageRow},{children:[a("div",t({className:D.iconWrapper},{children:a(W,{})})),a("div",t({className:D.welcomeTextWrapper},{children:a("div",t({className:D.welcomeMarkdownWrapper},{children:a("span",{children:a(b,t({rehypePlugins:[y],components:Ct},{children:ie}))})}))}))]})),Je.length>0&&Je.map(function(e,n){var o,r;return s("div",t({className:D.messageRow},{children:["assistant"===e.role?a("div",t({className:D.assistantIconContainer},{children:a(W,{})})):a("div",{className:D.userSpacer}),a("div",t({className:D.messageContent},{children:"assistant"===e.role?s(l,{children:[e.orchestratorAndAgentsMessages&&e.orchestratorAndAgentsMessages.length>0&&a(I,{orchestratorAndAgentsMessages:null==e?void 0:e.orchestratorAndAgentsMessages,isStreamEnd:rn,finalTimeTaken:null==e?void 0:e.finalTimeTaken},null!==(o=null==e?void 0:e.finalTimeTaken)&&void 0!==o?o:null==e?void 0:e.id),a(_,{index:n,content:null==e?void 0:e.content,role:null==e?void 0:e.role,messages:Je,handleStream:ft,isLastMessage:n===Je.length-1,onSave:ae,citations:null==e?void 0:e.citations,setChatSize:le,chatSize:se,isStreamEnd:rn,messageIsEnd:null==e?void 0:e.isEnd,onViewComparison:ke,onTypeResponseClick:function(){var e;jn(!0),null===(e=Ge.current)||void 0===e||e.focus()},onComparisonLinkClick:Ie,baseURL:Be,onFeedbackSubmit:yt,isGlobalEditActive:Ee,fieldLabelMap:Fe}),e.hasOwnProperty("isEnd")&&!(null==e?void 0:e.isEnd)&&(null===(r=null==e?void 0:e.content)||void 0===r?void 0:r.length)>0&&s(l,{children:[a(E,{variant:"text",width:"50%",height:20}),a("div",{style:{marginTop:"10px"}}),a(E,{variant:"text",width:"100%",height:40})]}),a("div",t({className:D.timestamp},{children:e.time&&!isNaN(new Date(e.time).getTime())?new Date(e.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}):s("div",t({className:D.userMessageWrapper},{children:[s("div",t({className:D.userMessageBubble,style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:e.isSkeleton||bt||e.id!==An?"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(E,{variant:"text",width:"100%",height:16}),a(E,{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:ft,isLastMessage:n===Je.length-1,onSave:ae,citations:null==e?void 0:e.citations,isStreamEnd:rn,isGlobalEditActive:Ee,messageIsEnd:null==e?void 0:e.isEnd,onViewComparison:ke,onComparisonLinkClick:Ie,baseURL:Be,onFeedbackSubmit:yt,fieldLabelMap:Fe}),a("div",t({style:{marginTop:"0.5rem"}},{children:a(z,{})}))]})),a("div",t({className:D.userTimestamp},{children:new Date(e.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}))}))]}),e.id)}),Ye&&s("div",t({className:D.loadingRow},{children:[a("div",t({className:D.iconWrapper,style:{marginTop:"0.2rem"}},{children:a(W,{})})),a("div",t({className:D.loadingTextWrapper},{children:a("span",{children:vn})}))]})),a("div",{ref:Ue,style:{float:"left",clear:"both"}})]}))]})),a("div",t({className:D.inputAreaWrapper},{children:a(C,t({title:X?"Please wait for the validation to be completed.":""},{children:s("div",t({className:"".concat(D.inputBoxContainer," ").concat(ot?D.disabled:""),style:Pn?{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&&!Sn&&a("div",t({onMouseDown:function(e){e.preventDefault(),st("smooth")},className:D.scrollToBottomBtn},{children:a(q,{})})),s("div",t({style:{width:"100%",display:"flex"}},{children:[a("textarea",{ref:Ge,placeholder:ve,value:Ke||"",onChange:function(e){Ve(e.target.value)},onFocus:function(){return bn(!0)},onBlur:function(){return bn(!1)},onKeyDown:function(e){return gt(e)},disabled:ot,className:"no-scrollbar ".concat(D.chatTextarea),style:{minHeight:Cn||Ke&&Ke.length>40?"120px":"50px",height:Cn||Ke&&Ke.length>40?"120px":"50px",maxHeight:"120px"}}),a("span",t({className:D.sendButtonWrapper},{children:a("button",t({onClick:function(e){it||gt(new KeyboardEvent("keydown",{key:"Enter"}))},disabled:it,className:"".concat(D.sendButton," ").concat(it?D.disabled:D.active)},{children:a(A,{})}))}))]}))]}))}))})),s("div",t({className:D.footerTools},{children:[a(C,t({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:a("span",t({className:D.footerToolItem},{children:a(R,{amplitude:1,variant:"speaker",isActive:!1,onClick:function(){return null},disabled:!1})}))})),a(C,t({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:a("span",t({className:D.footerToolItem},{children:a(R,{amplitude:1,variant:"microphone",isActive:!1,onClick:function(){return null},disabled:!1})}))}))]})),a(p,t({open:et,onClose:function(){},PaperProps:{sx:{borderRadius:"12px",padding:"8px",maxWidth:"400px",backgroundColor:"var(--il-surface, #ffffff)",color:"var(--il-foreground, #0F172A)"}}},{children:s(f,t({sx:{p:3,textAlign:"center",fontFamily:"'Plus Jakarta Sans', sans-serif"}},{children:[a("h3",t({style:{fontSize:"18px",fontWeight:600,color:"var(--il-foreground, #0F172A)",marginBottom:"10px"}},{children:"Session Expired"})),a("p",t({style:{fontSize:"14px",color:"var(--il-muted, #64748B)",lineHeight:"1.5",marginBottom:"20px"}},{children:"Changes were made to the learnings in this scope while you were editing. To avoid conflicts, concurrent edits aren’t allowed."})),s(f,t({sx:{display:"flex",gap:2,justifyContent:"center"}},{children:[a("button",t({onClick:function(){nt(!1),dt()},style:{flex:1,padding:"10px 16px",cursor:"pointer",backgroundColor:"var(--il-secondary-bg, white)",border:"1px solid var(--il-border, #E2E8F0)",borderRadius:"8px",fontSize:"14px",fontWeight:500,color:"var(--il-secondary-fg, #475569)",transition:"all 0.2s"},onMouseOver:function(e){return e.currentTarget.style.backgroundColor="var(--il-hover, #F8FAFC)"},onMouseOut:function(e){return e.currentTarget.style.backgroundColor="var(--il-secondary-bg, white)"}},{children:"Reset Session"})),a("button",t({onClick:function(){nt(!1),null==qe||qe()},style:{flex:1,padding:"10px 16px",backgroundColor:"var(--il-danger, #EF4444)",color:"var(--il-primary-fg, white)",border:"none",borderRadius:"8px",fontSize:"14px",fontWeight:500,cursor:"pointer",transition:"background-color 0.2s"},onMouseOver:function(e){return e.currentTarget.style.backgroundColor="var(--il-danger-hover, #DC2626)"},onMouseOut:function(e){return e.currentTarget.style.backgroundColor="var(--il-danger, #EF4444)"}},{children:"Discard & Close"}))]}))]}))}))]}))};export{B as autoGeneratePrompt,O as default};
1
+ import{__makeTemplateObject as e,__spreadArray as n,__assign as t,__awaiter as o,__generator as r,__rest as i}from"tslib";import{jsx as a,jsxs as s,Fragment as l}from"react/jsx-runtime";import{useRef as c,useState as d,useMemo as u,useEffect as v,useCallback as m,useLayoutEffect as h}from"react";import{keyframes as g,Dialog as p,Box as f}from"@mui/material";import C from"@mui/material/Tooltip";import b from"react-markdown";import y from"rehype-raw";import{http as S}from"../../../../api/transport.js";import{v4 as w}from"uuid";import{stopStreaming as x,startChatStream as k}from"@e-llm-studio/streaming-response";import{WatchMeWork as I}from"@e-llm-studio/watch-me-work";import T from"./ChatHeader.js";import _ from"../MessageRendering/MessageRendering.js";import{Skeleton as E}from"../atoms/SkeletonLoader/SkeletonLoader.js";import{ActionableButton as M}from"../MessageRendering/ClickableChatComponents.js";import R from"../AudioWaveform.js";import D from"./ChatComponent.module.css.js";import N from"../../InstantLearning.module.css.js";import{ScrollToBottom as q}from"../_svg/ScrollToBottom.js";import{useHeaderObserver as A,extractTextFromChildren as F}from"../../helpers/utils.js";import{SendButton as L}from"../_svg/SendButton.js";import W from"../_svg/SparkleIcon.js";import{UserIcon as z}from"../_svg/UserIcon.js";import P from"../../../LearningManagement/store/useAuthStore.js";var j,B=function(e,n){return S.post("".concat(e||"https://devllmstudio.creativeworkspace.ai","/api/chat/chatResponse"),{name:"ilggcautopromptgen",organizationName:"techolution",prompt:n||"Generate a query"},{headers:{"Content-Type":"application/json"},withCredentials:!0}).then(function(e){return e.data}).catch(function(e){throw console.error("Error calling auto-generate API:",e),e})},O=function(B){var O=B.chatAssistantName,H=B.organizationName,U=B.baseUrl,G=B.baseWebsocketUrl,Z=B.setIsNewChatClicked;B.ThinkingBulbIconComponent;var K=B.isFormSaveClicked,V=B.setIsFormSavedClicked,Q=B.onResetLearningData,J=B.sendMessageInChat,$=B.setSendMessageInChat,X=B.isFormValidating,Y=B.chatTitle,ee=B.customMetaData,ne=B.headerMessageHandlers;B.aiResponse;var te=B.setAIResponse,oe=B.onResetChat,re=B.initialChatMessage,ie=void 0===re?"":re,ae=B.onSave,se=B.chatSize,le=B.setChatSize,ce=B.movingTowards,de=B.setCitations,ue=B.textareaPlaceholder,ve=void 0===ue?"Tell me more about this learning...":ue,me=B.setCurrentRequestId,he=B.showSavedMessage,ge=void 0!==he&&he,pe=B.savedMessage,fe=B.isError,Ce=void 0!==fe&&fe,be=B.errorMessage,ye=void 0===be?"There was an error saving your changes.":be;B.isSaving;var Se=B.isHighlighted,we=void 0!==Se&&Se,xe=B.onStreamingStateChange,ke=B.onViewComparison;B.isCopyEnabled;var Ie=B.onComparisonLinkClick,Te=B.onSubmitFeedback,_e=B.userDetails,Ee=B.isGlobalEditActive,Me=B.socketTimeOutInMilliSeconds,Re=B.initialDraftMessage,De=void 0===Re?"":Re,Ne=B.onValidateSession,qe=B.onCloseSessionModal,Ae=B.fieldLabelMap,Fe=B.enableChatLogs,Le=void 0!==Fe&&Fe,We=P().user,ze=O,Pe=c("".concat(ze,"-").concat(H,"-").concat(w())),je=c("".concat(w())),Be=U,Oe=c(null),He=c(!0),Ue=c(null),Ge=c(null),Ze=d(De),Ke=Ze[0],Ve=Ze[1],Qe=d([]),Je=Qe[0],$e=Qe[1],Xe=d(!1),Ye=Xe[0],en=Xe[1],nn=d(!1);nn[0];var tn=nn[1],on=d(!0),rn=on[0],an=on[1],sn=d(!0);sn[0];var ln=sn[1],cn=d("");cn[0];var dn=cn[1],un=d(""),vn=un[0],mn=un[1],hn=d(!1),gn=hn[0],pn=hn[1],fn=d(!1),Cn=fn[0],bn=fn[1],yn=d(!0),Sn=yn[0],wn=yn[1],xn=d("100%");xn[0];var kn=xn[1],In=d(null),Tn=In[0],_n=In[1],En=d(!1);En[0];var Mn=En[1],Rn=d(!1),Dn=Rn[0],Nn=Rn[1],qn=c(null),An=c(new Set),Fn=d(null),Ln=Fn[0],Wn=Fn[1],zn=d(!1),Pn=zn[0],jn=zn[1],Bn=d(!1);Bn[0],Bn[1];var On=d(null);On[0],On[1],c(null),c(null);var Hn=c(new Map),Un=c(""),Gn=c(new Set),Zn=c(0),Kn=c(!0),Vn=c(new Map),Qn=c(!1),Jn=c(0),$n=c(new Map),Xn=c(null),Yn=d(!1),et=Yn[0],nt=Yn[1];g(j||(j=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 tt=u(function(){return""===(null==Ke?void 0:Ke.trim())||gn},[Ke,gn]),ot=u(function(){return X},[X]),rt=u(function(){var e;return Je.length>0&&"user"===(null===(e=Je[Je.length-1])||void 0===e?void 0:e.role)},[Je]),it=u(function(){return tt||X||!!Ee||rt},[tt,X,Ee,rt]);v(function(){De&&!Ke&&(Ve(De),bn(!0),setTimeout(function(){if(Ge.current){Ge.current.focus();var e=De.length;Ge.current.setSelectionRange(e,e)}},400))},[De]),v(function(){null==xe||xe(gn)},[gn,xe]),v(function(){return Kn.current=!0,function(){Kn.current=!1,Zn.current+=1,$n.current.forEach(function(e){return clearTimeout(e)}),$n.current.clear(),Un.current&&G&&x(Un.current,G,!1)}},[G]),v(function(){var e=Oe.current,n=function(){if(e){var n=e.scrollTop,t=e.scrollHeight,o=e.clientHeight;wn(t-n-o<=20)}};return e&&(e.addEventListener("scroll",n),n()),function(){e&&e.removeEventListener("scroll",n)}},[Je]);var at=A({handlers:ne,setResult:te}).processHeaderMessage;v(function(){ge&&Nn(!0)},[ge]),v(function(){if(Pn){var e=setTimeout(function(){jn(!1)},3e3);return function(){return clearTimeout(e)}}},[Pn]),v(function(){K&&!Ee&&(gt(new KeyboardEvent("keydown",{key:"Enter"}),!1,"Save this Learning"),V(!1))},[K]),v(function(){if(J)try{if(J.startsWith("__SKELETON__:")){var e=J.split(":"),o=e[1],r=e.slice(2).join(":"),i={role:"user",content:"",id:o,time:new Date,isSkeleton:!0,skeletonContent:r};return $e(function(e){return n(n([],e,!0),[i],!1)}),gt(new KeyboardEvent("keydown",{key:"Enter"}),!1,r,!1,o),Wn(o),$&&$(""),void setTimeout(function(){Wn(null)},2e3)}if(J.startsWith("__SKELETON_END__::")){var a=J.split("::")[1]||"";return $e(function(e){return e.map(function(e){return e.isSkeleton?t(t({},e),{isSkeleton:!1,content:e.skeletonContent||a}):e})}),void($&&$(""))}var s=w();gt(new KeyboardEvent("keydown",{key:"Enter"}),!1,J,!1,s),Wn(s),$&&$(""),setTimeout(function(){return Wn(null)},2e3)}catch(e){console.error("Error handling sendMessageInChat signal",e)}},[J]),v(function(){lt(),ct();var e=function(){var e,n=(null===(e=null==qn?void 0:qn.current)||void 0===e?void 0:e.clientHeight)||0,t="calc(100% - ".concat(n,"px - 10px)");kn(t)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var st=m(function(e){var n="string"==typeof e?e:"smooth";Ue.current&&Ue.current.scrollIntoView({behavior:n,block:"end"}),He.current&&setTimeout(function(){Ue.current&&He.current&&Ue.current.scrollIntoView({behavior:n,block:"end"})},100)},[]);v(function(){if(!gn){var e="";if(Dn?e=pe||"Thank you teacher for teaching me, your rule has been saved successfully.":Ce&&(e=ye||"I'm sorry, I couldn't save your changes. Please try again."),e){var t={role:"assistant",content:e,id:w(),citations:[],time:new Date};$e(function(e){return n(n([],e,!0),[t],!1)}),Nn(!1),setTimeout(function(){return st("smooth")},100)}}},[Dn,Ce,gn,pe,ye,st]),v(function(){He.current&&st("smooth")},[st]);var lt=function(){var e={method:"get",maxBodyLength:1/0,url:"".concat(Be,"/api/chatbot/getChatSettings?name=").concat(ze,"&organizationName=").concat(H),headers:{}};S.request(e).then(function(e){var n,t,o;(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.chatSettings)&&""!==(null===(o=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.chatSettings)||void 0===o?void 0:o.chatInitialMessage)&&ln(!0)}).catch(function(e){console.error(e)})},ct=function(){return o(void 0,void 0,void 0,function(){var e,n;return r(this,function(t){e="".concat(Be,"/api/chat/history?name=").concat(ze,"&organizationName=").concat(H);try{n={method:"GET",params:{guestSessionId:Pe.current},withCredentials:!0},S.get(e,n).then(function(e){var n=e.data;n.length>0?($e(n),st()):ln(!0)}).catch(function(e){console.error(e)})}catch(e){en(!1),console.error(e)}return[2]})})},dt=function(){var e="".concat(Be,"/api/chat/resetHistory?name=").concat(ze,"&organizationName=").concat(H);try{var n={method:"GET",params:{guestSessionId:Pe.current},headers:(null==We?void 0:We.accessToken)?{Authorization:"Bearer ".concat(We.accessToken)}:{},withCredentials:!0};S.get(e,n).then(function(){Z(!0),dn(""),_n(null),An.current.clear(),Vn.current.clear(),je.current="".concat(w()),$e([]),ln(!0),Xn.current=null,null==oe||oe(),Q&&Q()}).catch(function(e){console.error(e)}).finally(function(){Pe.current="".concat(ze,"-").concat(H,"-").concat(w())})}catch(e){en(!1),console.error(e)}};function ut(e){return null==e?void 0:e.replace(/<a [^>]*>.*?<\/a>/g,function(e){return null==e?void 0:e.replace(/\*/g,"&ast;")})}var vt=function(e,o,r,i,a,s,l){var c,d,u,v,m,h,g,p,f,C,b,y,S,x,k,I,T,_,E,M,R,D,N,q,A,F,L,W,z,P;if(null===(d=null===(c=null==e?void 0:e.chatStream)||void 0===c?void 0:c.continueChatResult)||void 0===d?void 0:d.header_message){var j={header_message:e.chatStream.continueChatResult.header_message,responsedata:null===(m=null===(v=null===(u=null==e?void 0:e.chatStream)||void 0===u?void 0:u.continueChatResult)||void 0===v?void 0:v.message)||void 0===m?void 0:m.content};at(j)}var B=null===(h=null==e?void 0:e.chatStream)||void 0===h?void 0:h.continueChatResult,O=null==B?void 0:B.isEnd,H=(null===(g=null==B?void 0:B.message)||void 0===g?void 0:g.citations)||[];O&&H.length>0&&de&&de(H);var U={role:"assistant",content:"",id:w()};if(null===(b=null===(C=null===(f=null===(p=null==e?void 0:e.chatStream)||void 0===p?void 0:p.continueChatResult)||void 0===f?void 0:f.message)||void 0===C?void 0:C.content)||void 0===b?void 0:b.includes("WaitMessage: "))tn(!0),U.content=function(e){var n="WaitMessage: ",t=e.indexOf(n);if(-1!==t){var o=e.substring(t+13);return null==o?void 0:o.replaceAll("WaitMessage: ","")}return""}((null===(x=null===(S=null===(y=null==e?void 0:e.chatStream)||void 0===y?void 0:y.continueChatResult)||void 0===S?void 0:S.message)||void 0===x?void 0:x.content)+"\n\n"),""!==U.content&&(en(!1),$e(n(n([],Je,!0),[{role:"user",content:a,time:i,isFirstQuestionSent:s||!1,id:l||(null===(I=null===(k=null==e?void 0:e.chatStream)||void 0===k?void 0:k.continueChatResult)||void 0===I?void 0:I.requestId)||"",reply:""},U],!1)));else{tn(!1);var G=null===(_=null===(T=null==e?void 0:e.chatStream)||void 0===T?void 0:T.continueChatResult)||void 0===_?void 0:_.requestId;"string"==typeof G&&G&&me&&me(G);var Z=function(e,o,r,i){var a,s,l,c,d,u,v,m={role:"assistant",content:"",id:w(),time:new Date,citations:[]},h=(null===(a=null==e?void 0:e.chatStream)||void 0===a?void 0:a.continueChatResult)||{},g=null==h?void 0:h.requestId,p=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)||"",b=null==h?void 0:h.is_orchestrator,y=null==h?void 0:h.thinking_break,S=(null===(l=null==h?void 0:h.message)||void 0===l?void 0:l.citations)||[];if(g&&p&&C&&!f){var x=i.current.get(g)||[];x[x.length-1]!==C&&(x.push(C),i.current.set(g,x))}var k=(g&&i.current.get(g)||[]).join("\n\n"),I="";if(f)I=k&&""!==k.trim()?k:C;else if(p)I=k;else{var T=C.replace(/<!--(?![\s\S]*-->)[\s\S]*$/,"").trimEnd(),_=!1===b||y||0!==S.length?"":T;I=k?"".concat(k,"\n\n").concat(_):_}if(m.content=ut(I),!0===(null==h?void 0:h.thinking_break)&&!0===(null==h?void 0:h.is_orchestrator)&&!1===(null==h?void 0:h.isEnd)&&o.push({responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!1}),!1===(null==h?void 0:h.thinking_break)&&!1===(null==h?void 0:h.is_orchestrator)&&!1===(null==h?void 0:h.isEnd)){if(h.explainability_id&&h.responded_by){var E=h.explainability_id,M=h.responded_by;r.has(E)||r.set(E,{responded_by:M,index:o.length})}r.has(h.explainability_id)?o[null==(R=r.get(h.explainability_id))?void 0:R.index]={responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!0,explainability_id:null!==(c=h.explainability_id)&&void 0!==c?c:"",isParallelToolResponse:!0}:o=n(n([],o,!0),[{responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!0,explainability_id:null!==(d=h.explainability_id)&&void 0!==d?d:"",isParallelToolResponse:!1}],!1)}if(!0===(null==h?void 0:h.thinking_break)&&!1===(null==h?void 0:h.is_orchestrator)&&!1===(null==h?void 0:h.isEnd)){var R;h.explainability_id&&h.responded_by&&(E=h.explainability_id,M=h.responded_by,r.has(E)||r.set(E,{responded_by:M,index:o.length})),r.has(h.explainability_id)?o[null==(R=r.get(h.explainability_id))?void 0:R.index]={responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!1,explainability_id:null!==(u=h.explainability_id)&&void 0!==u?u:"",isParallelToolResponse:!0}:o.push({responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!1,explainability_id:null!==(v=h.explainability_id)&&void 0!==v?v:"",isParallelToolResponse:!1})}return t({orchestratorAndAgentsMessages:o},m)}(e,r,o,Vn);Z.time=new Date,Z.citations=H,Z.isEnd=null===(M=null===(E=null==e?void 0:e.chatStream)||void 0===E?void 0:E.continueChatResult)||void 0===M?void 0:M.isEnd,Z.requestId=null===(D=null===(R=null==e?void 0:e.chatStream)||void 0===R?void 0:R.continueChatResult)||void 0===D?void 0:D.requestId,Z.sessionId=Pe.current,null===(N=Z.orchestratorAndAgentsMessages)||void 0===N||N.forEach(function(e){e&&e.header_message&&at(e)}),(""!==(null==Z?void 0:Z.content)||(null==Z?void 0:Z.orchestratorAndAgentsMessages)&&(null==Z?void 0:Z.orchestratorAndAgentsMessages.length)>0)&&(en(!1),$e(n(n([],Je,!0),[{role:"user",content:a||"",time:i,isFirstQuestionSent:s||!1,id:l||(null===(A=null===(q=null==e?void 0:e.chatStream)||void 0===q?void 0:q.continueChatResult)||void 0===A?void 0:A.requestId)||"",requestId:null!==(W=null===(L=null===(F=null==e?void 0:e.chatStream)||void 0===F?void 0:F.continueChatResult)||void 0===L?void 0:L.requestId)&&void 0!==W?W:""},Z],!1))),an(null===(P=null===(z=null==e?void 0:e.chatStream)||void 0===z?void 0:z.continueChatResult)||void 0===P?void 0:P.isEnd)}},mt=m(function(e,t){void 0===t&&(t="inactivity"),console.error("🛑 Stream failed or timed out due to:reason=".concat(t," requestId=").concat(e," at ").concat((new Date).toISOString()));var o=$n.current.get(e);o&&(clearTimeout(o),$n.current.delete(e)),e&&G&&(x(e,G,!1),Vn.current.delete(e)),e===Un.current?(Qn.current=!1,an(!0),pn(!1),Mn(!1),en(!1),tn(!1),$e(function(e){var o=n([],e,!0).reverse().find(function(e){return"user"===e.role}),r=((null==o?void 0:o.content)||"").replace(/"/g,"&quot;"),i=n([],e,!0),a=i[i.length-1];a&&"assistant"===a.role&&!a.isEnd&&i.pop();var s="I ran into an unexpected issue while trying to process this learning.";return"inactivity"===t?s="Something went wrong—teaching is taking longer than expected.":"websocket_error"===t&&(s="I lost connection to the server while working on that."),n(n([],i,!0),[{role:"assistant",content:"".concat(s,' Please try again.\n\n<button class="clickable-button" data-value="').concat(r,'">Retry</button>'),id:w(),time:new Date,isEnd:!0,citations:[]}],!1)})):console.warn("🛑 [handleStreamTimeout] Ignoring stale timeout for superseded requestId=".concat(e,"; active=").concat(Un.current))},[Me,G]),ht=m(function(e){var n=$n.current.get(e);if(n&&clearTimeout(n),Me&&Me>0){console.log("⏱️ [Timeout armed] requestId=".concat(e," timeout=").concat(Me,"ms at ").concat((new Date).toISOString()));var t=setTimeout(function(){console.warn("⏱️ [Timeout FIRED — auto stop] requestId=".concat(e," at ").concat((new Date).toISOString())),mt(e,"inactivity")},Me);$n.current.set(e,t)}},[mt,Me]),gt=function(e,i,a,s,l,c){return o(void 0,void 0,void 0,function(){var o,s,d,u,v,m,h,g,p,f,C,b,y,S,x,I,T;return r(this,function(r){switch(r.label){case 0:if(o=(void 0!==a?a:Ke||"").trim(),(s="Enter"===(null==e?void 0:e.key)&&!(null==e?void 0:e.shiftKey)&&!Ee)&&(null===(b=null==e?void 0:e.preventDefault)||void 0===b||b.call(e)),d="user"===(null===(y=Je[Je.length-1])||void 0===y?void 0:y.role),!o||gn||Qn.current||d||(null==e?void 0:e.key)&&!s)return[2];if(Xn.current||(Xn.current=(new Date).toISOString(),console.log("Session start time set to ".concat(Xn.current))),!Ne)return[3,5];en(!0),mn("Validating session..."),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,Ne(Xn.current)];case 2:return r.sent()?[3,4]:(nt(!0),en(!1),c&&c(!1),[2]);case 3:return u=r.sent(),console.error("Validation error:",u),nt(!0),en(!1),c&&c(!1),[2];case 4:en(!1),r.label=5;case 5:return Qn.current=!0,"I want to add a rule description"===o?(an(!1),He.current=!0,pn(!0),!Tn&&o&&_n(a||"manual_entry"),v=new Date,$e(function(e){return n(n([],e.map(function(e,n){var o;return t(t({},e),{content:null===(o=ut(e.content))||void 0===o?void 0:o.replace("WaitMessage: ","")})}),!0),[{role:"user",content:o,time:v,isFirstQuestionSent:!1,id:l||w()}],!1)}),st("smooth"),setTimeout(function(){$e(function(e){return n(n([],e,!0),[{role:"assistant",content:"I'd be happy to help you set up a new rule! To get started, could you tell me what kind of behavior or logic you would like this rule to follow?",id:w(),citations:[],time:new Date}],!1)}),st("smooth"),setTimeout(function(){pn(!1),an(!0)},500)},500),[2]):(an(!1),He.current=!0,pn(!0),!Tn&&o&&_n(a||"manual_entry"),m=new Date,h=Zn.current,$e(function(e){var r=e.map(function(e){var n;return t(t({},e),{content:null===(n=ut(e.content))||void 0===n?void 0:n.replace("WaitMessage: ","")})});return l&&r.some(function(e){return e.id===l})?r.map(function(e){return e.id===l?t(t({},e),{content:o}):e}):n(n([],r,!0),[{role:"user",content:o,time:m,isFirstQuestionSent:!1,id:l||w()}],!1)}),st("smooth"),g=new Map,p=[],f=function(e){var n;if(!e)return{};var t=Object.keys(e);return 1===t.length&&"current"===t[0]?null!==(n=e.current)&&void 0!==n?n:{}:e},C={WEBSOCKET_URL:G,organizationName:H,chatAssistantName:ze,selectedAIModel:"gpt-4",replyMessage:"",userName:null!==(S=null==_e?void 0:_e.name)&&void 0!==S?S:"Guest User",userEmailId:null!==(x=null==_e?void 0:_e.email)&&void 0!==x?x:"guestUser@example.com",userId:null!==(I=null==_e?void 0:_e.id)&&void 0!==I?I:"Guest User",query:o,requestId:"requestId-".concat(w()),customPrompt:"",enableForBackend:!1,guestSessionId:Pe.current,chatPreviewId:je.current,customMetaData:f(ee),aiModel:"",enableLogs:!0,logControls:{infoLogs:Le,debugLogs:Le},additionalHeaders:(null==We?void 0:We.accessToken)?{Authorization:"Bearer ".concat(We.accessToken)}:void 0,onStreamEvent:function(e){var n,t,r,a,s,c;if(Kn.current&&Zn.current===h){var d=null===(t=null===(n=null==e?void 0:e.chatStream)||void 0===n?void 0:n.continueChatResult)||void 0===t?void 0:t.requestId,u=null===(a=null===(r=null==e?void 0:e.chatStream)||void 0===r?void 0:r.continueChatResult)||void 0===a?void 0:a.header_message;console.log("📦 [Stream Chunk Received] With RequestID and header_message: ".concat(d,",").concat(u)),ht(C.requestId);var v=null===(c=null===(s=null==e?void 0:e.chatStream)||void 0===s?void 0:s.continueChatResult)||void 0===c?void 0:c.error_state;if(Array.isArray(v)&&v.length>0)return console.error("⚠️ Agent returned an error_state during stream:",{requestId:d,errorState:v}),void mt(C.requestId,"agent_error");vt(e,g,p,m,o,i,l)}},onStreamEnd:function(e){var o,r;if(Kn.current&&Zn.current===h){var i=null===(r=null===(o=null==e?void 0:e.chatStream)||void 0===o?void 0:o.continueChatResult)||void 0===r?void 0:r.requestId;Gn.current.add(C.requestId),console.log("✅ [Stream Completed] RequestID: ".concat(i));var a=$n.current.get(C.requestId);a&&(clearTimeout(a),$n.current.delete(C.requestId)),Qn.current=!1,an(!0),pn(!1),Mn(!1);var s=Date.now(),l=Hn.current.get(C.requestId);if(l){var c=Math.round((s-l)/1e3).toFixed(1);$e(function(e){var o=n([],e,!0).reverse().findIndex(function(e){return"assistant"===e.role});if(-1===o)return e;var r=e.length-1-o;return e.map(function(e,n){return n===r?t(t({},e),{finalTimeTaken:c}):e})})}}},onError:function(e){if(Kn.current&&Zn.current===h){var n=$n.current.get(C.requestId);if(n&&(clearTimeout(n),$n.current.delete(C.requestId)),Gn.current.has(C.requestId))return console.warn("Ignoring post-completion error for already-finished request:",C.requestId),void Gn.current.delete(C.requestId);console.error("Stream error:",e),mt(C.requestId,"websocket_error")}}},o&&(en(!0),null===(T=Ge.current)||void 0===T||T.blur(),Ve(""),st(),mn(l?"Just a moment, processing your request...":"Okay, got it. Let me take a moment to work on this and I'll get back to you shortly."),Hn.current.set(C.requestId,Date.now()),Un.current=C.requestId,console.log("Chat Stream Params:",C),ht(C.requestId),Jn.current+=1,console.log("🚀 [UI Action] stream started (Total UI invocations: ".concat(Jn.current,") | RequestID: ").concat(C.requestId,' | Query: "').concat(o,'"')),k(C)),c&&c(!1),[2])}})})},pt=c(null);h(function(){pt.current=gt});var ft=m(function(){for(var e,t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return null===(e=pt.current)||void 0===e?void 0:e.call.apply(e,n([pt],t,!1))},[]),Ct=u(function(){return{p:function(e){e.node;var n=e.children;return i(e,["node","children"]),a("div",t({style:{margin:0,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"10px",fontFamily:"inherit"}},{children:n}))},button:function(e){e.node;var n=e.className,o=e.children,r=i(e,["node","className","children"]),l=F(o),c=r["data-value"],d="Tester Genie"===l;return a(M,t({},r,{className:n,handleStream:ft,isStreamEnd:rn,disabled:!!Tn||!!Ee,isLastMessage:!0,style:{margin:0},isTesterGenie:d,"data-selected":Tn===l||Tn===c?"true":Tn?"false":void 0},{children:s("span",t({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[o,d&&s("svg",t({width:"16",height:"20",viewBox:"0 0 16 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[a("path",{d:"M7.20368 8.94768e-06C7.48895 -0.00208639 7.69331 0.364327 7.83856 0.57465C8.14381 1.01633 8.38012 1.87909 7.71077 2.14118C8.57167 2.21011 9.70406 2.93098 10.1785 3.64699C10.5932 4.27286 10.4559 5.16037 9.80301 5.56007L9.9502 7.16593C9.97671 7.44871 10.0265 7.87092 10.0299 8.14457C10.4213 8.23046 11.0787 8.55391 11.326 8.87592C11.5979 8.75656 11.9189 8.76963 12.1688 8.93469C12.3563 8.67751 12.5598 8.41456 12.7507 8.15787C12.3283 7.45155 12.5047 6.57745 13.2143 6.13784C13.5375 5.9377 13.9264 5.87277 14.2971 5.95705C14.0961 6.30964 13.8775 6.72182 13.6593 7.05857C13.7906 7.2436 13.9184 7.44225 14.044 7.63194L14.8022 7.63198C15.0349 7.30106 15.2515 6.90827 15.4835 6.59349C15.8623 7.0712 15.8156 7.79671 15.4734 8.28241C15.1318 8.76741 14.4886 8.9899 13.9118 8.88251C13.758 9.12108 13.5577 9.39243 13.3941 9.63201C13.7143 9.9316 13.7725 10.364 13.4067 10.6594C13.5231 10.8889 13.5309 11.1613 13.447 11.402C13.1502 12.2523 12.1724 12.5645 11.3474 12.5025C11.1171 12.4852 10.939 12.4698 10.7197 12.3953C10.8724 13.1271 10.7744 14.2031 10.5132 14.9051C10.1688 15.8304 9.43632 16.5569 8.54503 16.9655C7.90465 17.2706 7.21222 17.3607 6.50472 17.4505C5.74445 17.5471 4.75801 17.4362 4.08533 17.825C3.9327 17.9132 3.86566 18.0173 3.82943 18.1792C3.94996 18.5982 4.47858 18.6063 4.78474 18.8897C5.20191 19.2758 4.90716 19.9663 4.36611 19.9908C4.31476 19.9931 4.26867 19.9867 4.23186 19.9493C4.23089 19.8303 4.47587 19.7199 4.49787 19.5262C4.55075 19.0604 3.70014 19.0078 3.37835 18.8374C3.13013 18.706 2.99537 18.6309 2.82242 18.4021C2.63795 18.1579 2.58428 17.835 2.63138 17.5392C2.74868 16.7847 3.47123 16.393 4.12184 16.1497C4.61314 15.9659 5.46304 15.7158 5.52019 15.0793C5.58589 14.348 4.97543 13.5523 4.57739 12.9807C4.44275 12.7875 4.3039 12.579 4.16309 12.3919C4.18987 12.365 4.21049 12.3463 4.23916 12.3212C4.59619 12.6218 5.21209 12.6421 5.55038 12.2979C5.70457 12.144 5.78974 11.9342 5.78642 11.7164C5.78121 11.4493 5.63382 11.2002 5.4454 11.019C5.44704 10.9932 5.44824 10.9676 5.449 10.9419C5.4566 10.6648 5.37505 10.4902 5.1892 10.2943C5.18398 10.2538 5.17776 10.2134 5.17053 10.1732C5.08123 9.69297 4.71708 9.34182 4.23415 9.27108C4.16418 9.26083 3.96108 9.26105 3.92071 9.23344C3.90485 9.1828 3.9059 9.20792 3.91904 9.15527C4.22103 8.90139 4.14407 8.78214 4.31107 8.4846C4.42301 8.28513 4.73047 8.15239 4.95452 8.10701C4.96167 7.51076 5.03684 6.88562 5.10036 6.29144C5.12451 6.0655 5.12531 5.75046 5.1511 5.55257C4.11108 4.86747 4.39091 3.75946 5.25465 3.06391C5.84978 2.58469 6.34496 2.31002 7.10143 2.14517C7.01589 2.10416 6.93842 2.04811 6.87269 1.97972C6.77021 1.87349 6.70248 1.73857 6.67853 1.59293C6.60568 1.12096 7.04104 0.914625 7.18759 0.526392C7.26428 0.323403 7.03925 0.146075 7.20368 8.94768e-06Z",fill:"#475569"}),a("path",{d:"M7.459 4.5C7.48797 4.50312 7.71949 4.61154 7.76205 4.63061C8.27062 4.85835 8.87051 5.09164 9.35658 5.3582C9.36602 6.03495 9.37016 6.56625 8.70573 6.91519C8.6633 6.80883 8.63019 6.72409 8.56332 6.63044C8.43786 6.45568 8.24656 6.33963 8.03354 6.30909C7.8434 6.28211 7.65146 6.3197 7.49586 6.43503C7.21897 6.21256 6.76265 6.28197 6.5229 6.52486C6.39308 6.65639 6.34815 6.75074 6.28902 6.92344C5.59702 6.5957 5.58761 6.04267 5.60583 5.35582C5.89882 5.23844 6.21318 5.0724 6.50153 4.941C6.82145 4.79522 7.14482 4.6574 7.459 4.5Z",fill:"#D1EDFD"}),a("path",{d:"M11.0756 10.6406C11.1037 10.6701 11.1324 10.7706 11.1535 10.8145C11.2818 11.0817 11.4922 11.1945 11.7498 11.2977C11.5607 11.63 11.4567 11.8797 11.1034 12.0466L11.0839 12.0517C10.9262 12.0927 10.7996 12.0968 10.651 12.0135C10.4755 11.915 10.3807 11.6614 10.4792 11.478C10.6388 11.1809 10.8877 10.9272 11.0756 10.6406Z",fill:"#D1EDFD"}),a("path",{d:"M11.6036 9.1377C11.6993 9.11763 11.8391 9.16378 11.9294 9.19593C11.6952 9.50644 11.4706 9.81614 11.2327 10.1261L11.1572 10.2255C10.7581 9.73539 11.0333 9.24481 11.6036 9.1377Z",fill:"#D1EDFD"}),a("path",{d:"M7.49681 0.882812C7.53691 0.925159 7.61244 1.08523 7.63598 1.14156C7.74243 1.39673 7.75769 1.76908 7.38596 1.77504C7.28236 1.75599 7.15628 1.68938 7.13517 1.5783C7.0843 1.3107 7.35609 1.09964 7.48737 0.897583L7.49681 0.882812Z",fill:"#D1EDFD"}),a("path",{d:"M1.68305 6.17249C1.71659 6.1673 1.8134 6.16478 1.84892 6.16432C2.34052 6.15616 2.81496 6.34495 3.16655 6.68866C3.50847 7.01806 3.70349 7.47119 3.70765 7.94596C3.70896 8.42345 3.54045 8.85284 3.20281 9.19025C3.34033 9.28068 3.5321 9.52219 3.6543 9.65748C4.17158 9.39073 4.91447 9.69339 4.79675 10.3444C5.08751 10.5485 5.19656 10.8288 5.0585 11.1674C5.15418 11.2375 5.25595 11.3205 5.32383 11.4186C5.40228 11.5303 5.4309 11.6695 5.40291 11.8031C5.32228 12.1857 4.90085 12.3286 4.57669 12.1236C4.51367 12.0838 4.42258 11.9595 4.35299 11.9431C4.30669 11.9557 4.28453 11.9584 4.23644 11.9644C4.22885 11.9742 4.22118 11.9841 4.21343 11.9938C3.93597 12.3413 3.49234 12.4682 3.06933 12.5157C2.85285 12.518 2.70432 12.5146 2.49066 12.4609C1.80785 12.2892 1.50808 11.6167 1.70723 10.9639C1.829 10.5648 2.11891 10.2506 2.48939 10.0518C2.54655 10.132 2.57559 10.2191 2.64066 10.303C2.73571 10.2223 2.82048 10.1482 2.92363 10.0773C2.81023 9.95313 2.66811 9.7693 2.55817 9.63584C2.38871 9.6878 2.23026 9.72879 2.05298 9.74653C1.54239 9.80228 1.03118 9.64711 0.637735 9.31695C0.269964 9.01018 0.0453493 8.54827 0.00544736 8.07322C-0.0309495 7.60988 0.116099 7.15077 0.414918 6.79478C0.742554 6.41198 1.18728 6.21393 1.68305 6.17249Z",fill:"#475569"}),a("path",{d:"M1.79616 6.5951C2.54894 6.5619 3.18687 7.14364 3.22301 7.8963C3.25915 8.64894 2.67989 9.28913 1.92739 9.3282C1.17073 9.3675 0.526231 8.78435 0.489885 8.02753C0.45354 7.27071 1.03921 6.62849 1.79616 6.5951Z",fill:"#D1EDFD"}),a("path",{d:"M4.93607 11.4844C5.12839 11.6261 5.22049 11.9085 4.91876 11.9419C4.8067 11.8805 4.78491 11.8646 4.71094 11.7561C4.81572 11.6752 4.862 11.5925 4.93607 11.4844Z",fill:"#FEFEFD"}),a("path",{d:"M12.5164 3.58594L12.5715 3.59466C12.6589 3.65863 12.6908 3.94434 12.7882 4.05193C12.8789 4.15216 12.9155 4.17816 13.0326 4.24929C13.1363 4.31224 13.3325 4.34025 13.384 4.43124C13.3643 4.56218 13.0693 4.54857 12.9127 4.69344C12.6903 4.89898 12.7114 5.06971 12.5892 5.28622C12.5669 5.28439 12.5368 5.2868 12.5261 5.27346C12.4336 5.15843 12.4072 4.9308 12.3099 4.81465C12.1627 4.63903 11.9972 4.60054 11.7981 4.51372C11.7544 4.49467 11.7266 4.47099 11.7129 4.42649C11.7867 4.31876 12.0509 4.34309 12.2376 4.14892C12.43 3.94901 12.4155 3.72208 12.5164 3.58594Z",fill:"#475569"}),a("path",{d:"M2.13644 3.72656C2.24401 3.77084 2.29712 4.1268 2.431 4.25226C2.60327 4.41371 2.7311 4.41949 2.93246 4.52449C2.96024 4.53897 2.97173 4.56042 2.97671 4.58878C2.89584 4.6981 2.61854 4.70721 2.4596 4.85659C2.26275 5.04156 2.27341 5.29132 2.17022 5.42088C2.16192 5.41849 2.11671 5.40232 2.1156 5.40043C2.01291 5.21216 1.9836 5.04909 1.84812 4.87273C1.73599 4.72675 1.36534 4.69959 1.32812 4.56939C1.3835 4.47941 1.67823 4.44211 1.82291 4.30563C2.02737 4.11274 2.0042 3.8372 2.13644 3.72656Z",fill:"#475569"})]}))]}))}))}}},[ft,rn,Tn,Ee]),bt=u(function(){return Je.some(function(e){return e.isSkeleton})},[Je]),yt=function(e){return o(void 0,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return Te?[4,Te(e)]:[3,2];case 1:t.sent(),$e(function(e){return n(n([],e,!0),[{role:"assistant",content:"Thanks for your feedback — this will help improve future suggestions.",id:w(),citations:[],time:new Date,isEnd:!0}],!1)}),setTimeout(function(){return st("smooth")},100),t.label=2;case 2:return[2]}})})};return s("div",t({className:"".concat(N.customFont," ").concat(D.chatContainer),style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:we&&!bt?"0 0 20px 5px rgba(37, 99, 235, 0.5)":"none"}},{children:[s("div",t({ref:Oe,className:D.scrollWrapper},{children:[a("div",t({ref:qn,className:D.stickyHeader},{children:a(T,{resetChatHistory:dt,isStreamEnd:rn,chatTitle:Y,onResize:le,chatSize:se,movingTowards:ce})})),s("div",t({className:D.messagesList},{children:[s("div",t({className:D.initialMessageRow},{children:[a("div",t({className:D.iconWrapper},{children:a(W,{})})),a("div",t({className:D.welcomeTextWrapper},{children:a("div",t({className:D.welcomeMarkdownWrapper},{children:a("span",{children:a(b,t({rehypePlugins:[y],components:Ct},{children:ie}))})}))}))]})),Je.length>0&&Je.map(function(e,n){var o,r;return s("div",t({className:D.messageRow},{children:["assistant"===e.role?a("div",t({className:D.assistantIconContainer},{children:a(W,{})})):a("div",{className:D.userSpacer}),a("div",t({className:D.messageContent},{children:"assistant"===e.role?s(l,{children:[e.orchestratorAndAgentsMessages&&e.orchestratorAndAgentsMessages.length>0&&a(I,{orchestratorAndAgentsMessages:null==e?void 0:e.orchestratorAndAgentsMessages,isStreamEnd:rn,finalTimeTaken:null==e?void 0:e.finalTimeTaken},null!==(o=null==e?void 0:e.finalTimeTaken)&&void 0!==o?o:null==e?void 0:e.id),a(_,{index:n,content:null==e?void 0:e.content,role:null==e?void 0:e.role,messages:Je,handleStream:ft,isLastMessage:n===Je.length-1,onSave:ae,citations:null==e?void 0:e.citations,setChatSize:le,chatSize:se,isStreamEnd:rn,messageIsEnd:null==e?void 0:e.isEnd,onViewComparison:ke,onTypeResponseClick:function(){var e;jn(!0),null===(e=Ge.current)||void 0===e||e.focus()},onComparisonLinkClick:Ie,baseURL:Be,onFeedbackSubmit:yt,isGlobalEditActive:Ee,fieldLabelMap:Ae}),e.hasOwnProperty("isEnd")&&!(null==e?void 0:e.isEnd)&&(null===(r=null==e?void 0:e.content)||void 0===r?void 0:r.length)>0&&s(l,{children:[a(E,{variant:"text",width:"50%",height:20}),a("div",{style:{marginTop:"10px"}}),a(E,{variant:"text",width:"100%",height:40})]}),a("div",t({className:D.timestamp},{children:e.time&&!isNaN(new Date(e.time).getTime())?new Date(e.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}):s("div",t({className:D.userMessageWrapper},{children:[s("div",t({className:D.userMessageBubble,style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:e.isSkeleton||bt||e.id!==Ln?"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(E,{variant:"text",width:"100%",height:16}),a(E,{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:ft,isLastMessage:n===Je.length-1,onSave:ae,citations:null==e?void 0:e.citations,isStreamEnd:rn,isGlobalEditActive:Ee,messageIsEnd:null==e?void 0:e.isEnd,onViewComparison:ke,onComparisonLinkClick:Ie,baseURL:Be,onFeedbackSubmit:yt,fieldLabelMap:Ae}),a("div",t({style:{marginTop:"0.5rem"}},{children:a(z,{})}))]})),a("div",t({className:D.userTimestamp},{children:new Date(e.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}))}))]}),e.id)}),Ye&&s("div",t({className:D.loadingRow},{children:[a("div",t({className:D.iconWrapper,style:{marginTop:"0.2rem"}},{children:a(W,{})})),a("div",t({className:D.loadingTextWrapper},{children:a("span",{children:vn})}))]})),a("div",{ref:Ue,style:{float:"left",clear:"both"}})]}))]})),a("div",t({className:D.inputAreaWrapper},{children:a(C,t({title:X?"Please wait for the validation to be completed.":""},{children:s("div",t({className:"".concat(D.inputBoxContainer," ").concat(ot?D.disabled:""),style:Pn?{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&&!Sn&&a("div",t({onMouseDown:function(e){e.preventDefault(),st("smooth")},className:D.scrollToBottomBtn},{children:a(q,{})})),s("div",t({style:{width:"100%",display:"flex"}},{children:[a("textarea",{ref:Ge,placeholder:ve,value:Ke||"",onChange:function(e){Ve(e.target.value)},onFocus:function(){return bn(!0)},onBlur:function(){return bn(!1)},onKeyDown:function(e){return gt(e)},disabled:ot,className:"no-scrollbar ".concat(D.chatTextarea),style:{minHeight:Cn||Ke&&Ke.length>40?"120px":"50px",height:Cn||Ke&&Ke.length>40?"120px":"50px",maxHeight:"120px"}}),a("span",t({className:D.sendButtonWrapper},{children:a("button",t({onClick:function(e){it||gt(new KeyboardEvent("keydown",{key:"Enter"}))},disabled:it,className:"".concat(D.sendButton," ").concat(it?D.disabled:D.active)},{children:a(L,{})}))}))]}))]}))}))})),s("div",t({className:D.footerTools},{children:[a(C,t({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:a("span",t({className:D.footerToolItem},{children:a(R,{amplitude:1,variant:"speaker",isActive:!1,onClick:function(){return null},disabled:!1})}))})),a(C,t({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:a("span",t({className:D.footerToolItem},{children:a(R,{amplitude:1,variant:"microphone",isActive:!1,onClick:function(){return null},disabled:!1})}))}))]})),a(p,t({open:et,onClose:function(){},PaperProps:{sx:{borderRadius:"12px",padding:"8px",maxWidth:"400px",backgroundColor:"var(--il-surface, #ffffff)",color:"var(--il-foreground, #0F172A)"}}},{children:s(f,t({sx:{p:3,textAlign:"center",fontFamily:"'Plus Jakarta Sans', sans-serif"}},{children:[a("h3",t({style:{fontSize:"18px",fontWeight:600,color:"var(--il-foreground, #0F172A)",marginBottom:"10px"}},{children:"Session Expired"})),a("p",t({style:{fontSize:"14px",color:"var(--il-muted, #64748B)",lineHeight:"1.5",marginBottom:"20px"}},{children:"Changes were made to the learnings in this scope while you were editing. To avoid conflicts, concurrent edits aren’t allowed."})),s(f,t({sx:{display:"flex",gap:2,justifyContent:"center"}},{children:[a("button",t({onClick:function(){nt(!1),dt()},style:{flex:1,padding:"10px 16px",cursor:"pointer",backgroundColor:"var(--il-secondary-bg, white)",border:"1px solid var(--il-border, #E2E8F0)",borderRadius:"8px",fontSize:"14px",fontWeight:500,color:"var(--il-secondary-fg, #475569)",transition:"all 0.2s"},onMouseOver:function(e){return e.currentTarget.style.backgroundColor="var(--il-hover, #F8FAFC)"},onMouseOut:function(e){return e.currentTarget.style.backgroundColor="var(--il-secondary-bg, white)"}},{children:"Reset Session"})),a("button",t({onClick:function(){nt(!1),null==qe||qe()},style:{flex:1,padding:"10px 16px",backgroundColor:"var(--il-danger, #EF4444)",color:"var(--il-primary-fg, white)",border:"none",borderRadius:"8px",fontSize:"14px",fontWeight:500,cursor:"pointer",transition:"background-color 0.2s"},onMouseOver:function(e){return e.currentTarget.style.backgroundColor="var(--il-danger-hover, #DC2626)"},onMouseOut:function(e){return e.currentTarget.style.backgroundColor="var(--il-danger, #EF4444)"}},{children:"Discard & Close"}))]}))]}))}))]}))};export{B as autoGeneratePrompt,O as default};
2
2
  //# sourceMappingURL=ChatComponent.js.map
@@ -1,2 +1,2 @@
1
- import{__makeTemplateObject as e,__spreadArray as t,__assign as n,__awaiter as i,__generator as o,__rest as a}from"tslib";import{jsx as r,jsxs as s,Fragment as l}from"react/jsx-runtime";import{useRef as c,useState as d,useMemo as u,useEffect as h,useCallback as m,useLayoutEffect as v}from"react";import{keyframes as p,Box as C}from"@mui/material";import g from"@mui/material/Tooltip";import f from"react-markdown";import S from"rehype-raw";import{http as b}from"../../../../api/transport.js";import{v4 as y}from"uuid";import{stopStreaming as x,startChatStream as w}from"@e-llm-studio/streaming-response";import{WatchMeWork as R}from"@e-llm-studio/watch-me-work";import k from"./ChatHeader.js";import _ from"../MessageRendering/MessageRendering.js";import{Skeleton as E}from"../atoms/SkeletonLoader/SkeletonLoader.js";import{ActionableButton as T}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 L,extractTextFromChildren as F}from"../../helpers/utils.js";import{SendButton as A}from"../_svg/SendButton.js";import W from"../_svg/SparkleIcon.js";import{UserIcon as z}from"../_svg/UserIcon.js";import j from"../../../LearningManagement/store/useAuthStore.js";var B,q=function(q){var P=q.chatAssistantName,H=q.organizationName,Z=q.baseUrl,K=q.baseWebsocketUrl,U=q.setIsNewChatClicked;q.ThinkingBulbIconComponent;var G=q.isFormSaveClicked,V=q.setIsFormSavedClicked,O=q.onResetLearningData,J=q.sendMessageInChat,Q=q.setSendMessageInChat,X=q.isFormValidating,Y=q.chatTitle,$=q.customMetaData,ee=q.headerMessageHandlers;q.aiResponse;var te=q.setAIResponse,ne=q.onResetChat,ie=q.initialChatMessage,oe=void 0===ie?"":ie,ae=q.onSave,re=q.chatSize,se=q.setChatSize,le=q.movingTowards,ce=q.setCitations,de=q.textareaPlaceholder,ue=void 0===de?"Tell me more about this learning...":de,he=q.setCurrentRequestId,me=q.showSavedMessage,ve=void 0!==me&&me,pe=q.savedMessage,Ce=q.isError,ge=void 0!==Ce&&Ce,fe=q.errorMessage,Se=void 0===fe?"There was an error saving your changes.":fe;q.isSaving;var be=q.isHighlighted,ye=void 0!==be&&be,xe=q.onStreamingStateChange,we=q.onViewComparison;q.isCopyEnabled;var Re=q.onComparisonLinkClick,ke=q.onSubmitFeedback,_e=j().user,Ee=P,Te=c("".concat(Ee,"-").concat(H,"-").concat(y())),Me=c("".concat(y())),Ie=Z,Ne=c(null),De=c(!0),Le=c(null),Fe=c(null),Ae=d(""),We=Ae[0],ze=Ae[1],je=d([]),Be=je[0],qe=je[1],Pe=d(!1),He=Pe[0],Ze=Pe[1],Ke=d(!1);Ke[0];var Ue=Ke[1],Ge=d(!0),Ve=Ge[0],Oe=Ge[1],Je=d(!0);Je[0];var Qe=Je[1],Xe=d("");Xe[0];var Ye=Xe[1],$e=d(""),et=$e[0],tt=$e[1],nt=d(!1),it=nt[0],ot=nt[1],at=d(!1),rt=at[0],st=at[1],lt=d(!0),ct=lt[0],dt=lt[1],ut=d("100%");ut[0];var ht=ut[1],mt=d(null),vt=mt[0],pt=mt[1],Ct=d(!1);Ct[0];var gt=Ct[1],ft=d(!1),St=ft[0],bt=ft[1],yt=c(null),xt=c(new Set),wt=d(null),Rt=wt[0],kt=wt[1],_t=d(!1),Et=_t[0],Tt=_t[1],Mt=d(!1);Mt[0],Mt[1];var It=d(null);It[0],It[1],c(null),c(null);var Nt=c(new Map),Dt=c(""),Lt=c(0),Ft=c(!0),At=p(B||(B=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 "]))),Wt=u(function(){return""===(null==We?void 0:We.trim())||it},[We,it]),zt=u(function(){return X},[X]),jt=u(function(){return Wt||it||X},[Wt,it,X]);h(function(){null==xe||xe(it)},[it,xe]),h(function(){return Ft.current=!0,function(){Ft.current=!1,Lt.current+=1,Dt.current&&K&&x(Dt.current,K,!1)}},[K]),h(function(){var e=Ne.current,t=function(){if(e){var t=e.scrollTop,n=e.scrollHeight,i=e.clientHeight;dt(n-t-i<=20)}};return e&&(e.addEventListener("scroll",t),t()),function(){e&&e.removeEventListener("scroll",t)}},[Be]);var Bt=L({handlers:ee,setResult:te}).processHeaderMessage;h(function(){ve&&bt(!0)},[ve]),h(function(){if(Et){var e=setTimeout(function(){Tt(!1)},3e3);return function(){return clearTimeout(e)}}},[Et]),h(function(){G&&(Ut(new KeyboardEvent("keydown",{key:"Enter"}),!1,"Save this Learning"),V(!1))},[G]),h(function(){if(J)try{if(J.startsWith("__SKELETON__:")){var e=J.split(":"),i=e[1],o=e.slice(2).join(":"),a={role:"user",content:"",id:i,time:new Date,isSkeleton:!0,skeletonContent:o};return qe(function(e){return t(t([],e,!0),[a],!1)}),Ut(new KeyboardEvent("keydown",{key:"Enter"}),!1,o,!1,i),kt(i),Q&&Q(""),void setTimeout(function(){kt(null)},2e3)}if(J.startsWith("__SKELETON_END__::")){var r=J.split("::")[1]||"";return qe(function(e){return e.map(function(e){return e.isSkeleton?n(n({},e),{isSkeleton:!1,content:e.skeletonContent||r}):e})}),void(Q&&Q(""))}var s=y();Ut(new KeyboardEvent("keydown",{key:"Enter"}),!1,J,!1,s),kt(s),Q&&Q(""),setTimeout(function(){return kt(null)},2e3)}catch(e){console.error("Error handling sendMessageInChat signal",e)}},[J]),h(function(){Pt(),Ht();var e=function(){var e,t=(null===(e=null==yt?void 0:yt.current)||void 0===e?void 0:e.clientHeight)||0,n="calc(100% - ".concat(t,"px - 10px)");ht(n)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var qt=m(function(e){var t="string"==typeof e?e:"smooth";Le.current&&Le.current.scrollIntoView({behavior:t,block:"end"}),De.current&&setTimeout(function(){Le.current&&De.current&&Le.current.scrollIntoView({behavior:t,block:"end"})},100)},[]);h(function(){if(!it){var e="";if(St?e=pe||"Thank you teacher for teaching me, your rule has been saved successfully.":ge&&(e=Se||"I'm sorry, I couldn't save your changes. Please try again."),e){var n={role:"assistant",content:e,id:y(),citations:[],time:new Date};qe(function(e){return t(t([],e,!0),[n],!1)}),bt(!1),setTimeout(function(){return qt("smooth")},100)}}},[St,ge,it,pe,Se,qt]),h(function(){De.current&&qt("smooth")},[qt]);var Pt=function(){var e={method:"get",maxBodyLength:1/0,url:"".concat(Ie,"/api/chatbot/getChatSettings?name=").concat(Ee,"&organizationName=").concat(H),headers:{}};b.request(e).then(function(e){var t,n,i;(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.chatSettings)&&""!==(null===(i=null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.chatSettings)||void 0===i?void 0:i.chatInitialMessage)&&Qe(!0)}).catch(function(e){console.error(e)})},Ht=function(){return i(void 0,void 0,void 0,function(){var e,t;return o(this,function(n){e="".concat(Ie,"/api/chat/history?name=").concat(Ee,"&organizationName=").concat(H);try{t={method:"GET",params:{guestSessionId:Te.current},withCredentials:!0},b.get(e,t).then(function(e){var t=e.data;t.length>0?(qe(t),qt()):Qe(!0)}).catch(function(e){console.error(e)})}catch(e){Ze(!1),console.error(e)}return[2]})})};function Zt(e){return null==e?void 0:e.replace(/<a [^>]*>.*?<\/a>/g,function(e){return null==e?void 0:e.replace(/\*/g,"&ast;")})}var Kt=function(e,i,o,a,r,s,l){var c,d,u,h,m,v,p,C,g,f,S,b,x,w,R,k,_,E,T,M,I,N,D,L,F,A,W,z,j,B,q,P,H,Z;if(null===(d=null===(c=null==e?void 0:e.chatStream)||void 0===c?void 0:c.continueChatResult)||void 0===d?void 0:d.header_message){var K={header_message:e.chatStream.continueChatResult.header_message,responsedata:null===(m=null===(h=null===(u=null==e?void 0:e.chatStream)||void 0===u?void 0:u.continueChatResult)||void 0===h?void 0:h.message)||void 0===m?void 0:m.content};Bt(K)}var U=null===(v=null==e?void 0:e.chatStream)||void 0===v?void 0:v.continueChatResult,G=null==U?void 0:U.isEnd,V=(null===(p=null==U?void 0:U.message)||void 0===p?void 0:p.citations)||[];G&&V.length>0&&ce&&ce(V);var O={role:"assistant",content:"",id:y()};if(null===(S=null===(f=null===(g=null===(C=null==e?void 0:e.chatStream)||void 0===C?void 0:C.continueChatResult)||void 0===g?void 0:g.message)||void 0===f?void 0:f.content)||void 0===S?void 0:S.includes("WaitMessage: "))Ue(!0),O.content=function(e){var t="WaitMessage: ",n=e.indexOf(t);if(-1!==n){var i=e.substring(n+13);return null==i?void 0:i.replaceAll("WaitMessage: ","")}return""}((null===(w=null===(x=null===(b=null==e?void 0:e.chatStream)||void 0===b?void 0:b.continueChatResult)||void 0===x?void 0:x.message)||void 0===w?void 0:w.content)+"\n\n"),""!==O.content&&(Ze(!1),qe(t(t([],Be,!0),[{role:"user",content:r,time:a,isFirstQuestionSent:s||!1,id:l||(null===(k=null===(R=null==e?void 0:e.chatStream)||void 0===R?void 0:R.continueChatResult)||void 0===k?void 0:k.requestId)||"",reply:""},O],!1)));else{Ue(!1),O.content=null===(M=Zt(null===(T=null===(E=null===(_=null==e?void 0:e.chatStream)||void 0===_?void 0:_.continueChatResult)||void 0===E?void 0:E.message)||void 0===T?void 0:T.content))||void 0===M?void 0:M.replaceAll("WaitMessage: ","");var J=null===(N=null===(I=null==e?void 0:e.chatStream)||void 0===I?void 0:I.continueChatResult)||void 0===N?void 0:N.requestId;"string"==typeof J&&J&&he&&he(J);var Q=function(e,i,o){var a,r,s,l,c,d,u,h,m,v,p,C,g,f,S,b,x,w,R,k,_,E,T,M,I,N,D,L,F,A,W,z,j,B,q={role:"assistant",content:"",id:y(),time:new Date,citations:[]};if(!1===(null===(r=null===(a=e.chatStream)||void 0===a?void 0:a.continueChatResult)||void 0===r?void 0:r.thinking_break)&&!0===(null===(l=null===(s=e.chatStream)||void 0===s?void 0:s.continueChatResult)||void 0===l?void 0:l.is_orchestrator)&&!1===(null===(d=null===(c=e.chatStream)||void 0===c?void 0:c.continueChatResult)||void 0===d?void 0:d.isEnd)&&(q.content=Zt(e.chatStream.continueChatResult.message.content||"")),!0===(null===(h=null===(u=e.chatStream)||void 0===u?void 0:u.continueChatResult)||void 0===h?void 0:h.thinking_break)&&!0===(null===(v=null===(m=e.chatStream)||void 0===m?void 0:m.continueChatResult)||void 0===v?void 0:v.is_orchestrator)&&!1===(null===(C=null===(p=e.chatStream)||void 0===p?void 0:p.continueChatResult)||void 0===C?void 0:C.isEnd)&&(q.content="",i.push({responsedata:e.chatStream.continueChatResult.message.content,responseFrom:e.chatStream.continueChatResult.responded_by,header_message:e.chatStream.continueChatResult.header_message,finalResponseStatus:!1})),!1===(null===(f=null===(g=e.chatStream)||void 0===g?void 0:g.continueChatResult)||void 0===f?void 0:f.thinking_break)&&!0===(null===(b=null===(S=e.chatStream)||void 0===S?void 0:S.continueChatResult)||void 0===b?void 0:b.is_orchestrator)&&!0===(null===(w=null===(x=e.chatStream)||void 0===x?void 0:x.continueChatResult)||void 0===w?void 0:w.isEnd)&&(q.content=Zt(e.chatStream.continueChatResult.message.content)),!1===(null===(k=null===(R=e.chatStream)||void 0===R?void 0:R.continueChatResult)||void 0===k?void 0:k.thinking_break)&&!1===(null===(E=null===(_=e.chatStream)||void 0===_?void 0:_.continueChatResult)||void 0===E?void 0:E.is_orchestrator)&&!1===(null===(M=null===(T=e.chatStream)||void 0===T?void 0:T.continueChatResult)||void 0===M?void 0:M.isEnd)){if((Z=e.chatStream.continueChatResult).explainability_id&&Z.responded_by){var P=Z.explainability_id,H=Z.responded_by;o.has(P)||o.set(P,{responded_by:H,index:i.length})}o.has(e.chatStream.continueChatResult.explainability_id)?i[null==(K=o.get(e.chatStream.continueChatResult.explainability_id))?void 0:K.index]={responsedata:e.chatStream.continueChatResult.message.content,responseFrom:e.chatStream.continueChatResult.responded_by,header_message:e.chatStream.continueChatResult.header_message,finalResponseStatus:!0,explainability_id:null!==(I=e.chatStream.continueChatResult.explainability_id)&&void 0!==I?I:"",isParallelToolResponse:!0}:i=t(t([],i,!0),[{responsedata:e.chatStream.continueChatResult.message.content,responseFrom:e.chatStream.continueChatResult.responded_by,header_message:e.chatStream.continueChatResult.header_message,finalResponseStatus:!0,explainability_id:null!==(N=e.chatStream.continueChatResult.explainability_id)&&void 0!==N?N:"",isParallelToolResponse:!1}],!1)}if(!0===(null===(L=null===(D=e.chatStream)||void 0===D?void 0:D.continueChatResult)||void 0===L?void 0:L.thinking_break)&&!1===(null===(A=null===(F=e.chatStream)||void 0===F?void 0:F.continueChatResult)||void 0===A?void 0:A.is_orchestrator)&&!1===(null===(z=null===(W=e.chatStream)||void 0===W?void 0:W.continueChatResult)||void 0===z?void 0:z.isEnd)){var Z,K;(Z=e.chatStream.continueChatResult).explainability_id&&Z.responded_by&&(P=Z.explainability_id,H=Z.responded_by,o.has(P)||o.set(P,{responded_by:H,index:i.length})),o.has(e.chatStream.continueChatResult.explainability_id)?i[null==(K=o.get(e.chatStream.continueChatResult.explainability_id))?void 0:K.index]={responsedata:e.chatStream.continueChatResult.message.content,responseFrom:e.chatStream.continueChatResult.responded_by,header_message:e.chatStream.continueChatResult.header_message,finalResponseStatus:!1,explainability_id:null!==(j=e.chatStream.continueChatResult.explainability_id)&&void 0!==j?j:"",isParallelToolResponse:!0}:i.push({responsedata:e.chatStream.continueChatResult.message.content,responseFrom:e.chatStream.continueChatResult.responded_by,header_message:e.chatStream.continueChatResult.header_message,finalResponseStatus:!1,explainability_id:null!==(B=e.chatStream.continueChatResult.explainability_id)&&void 0!==B?B:"",isParallelToolResponse:!1})}return n({orchestratorAndAgentsMessages:i},q)}(e,o,i);Q.time=new Date,Q.citations=V,Q.isEnd=null===(L=null===(D=null==e?void 0:e.chatStream)||void 0===D?void 0:D.continueChatResult)||void 0===L?void 0:L.isEnd,Q.requestId=null===(A=null===(F=null==e?void 0:e.chatStream)||void 0===F?void 0:F.continueChatResult)||void 0===A?void 0:A.requestId,Q.sessionId=Te.current,null===(W=Q.orchestratorAndAgentsMessages)||void 0===W||W.forEach(function(e){e&&e.header_message&&Bt(e)}),(""!==(null==Q?void 0:Q.content)||(null==Q?void 0:Q.orchestratorAndAgentsMessages)&&(null==Q?void 0:Q.orchestratorAndAgentsMessages.length)>0)&&(Ze(!1),qe(t(t([],Be,!0),[{role:"user",content:r||"",time:a,isFirstQuestionSent:s||!1,id:l||(null===(j=null===(z=null==e?void 0:e.chatStream)||void 0===z?void 0:z.continueChatResult)||void 0===j?void 0:j.requestId)||"",requestId:null!==(P=null===(q=null===(B=null==e?void 0:e.chatStream)||void 0===B?void 0:B.continueChatResult)||void 0===q?void 0:q.requestId)&&void 0!==P?P:""},Q],!1))),Oe(null===(Z=null===(H=null==e?void 0:e.chatStream)||void 0===H?void 0:H.continueChatResult)||void 0===Z?void 0:Z.isEnd)}},Ut=function(e,i,o,a,r,s){var l,c,d=(void 0!==o?o:We||"").trim(),u="Enter"===(null==e?void 0:e.key)&&!(null==e?void 0:e.shiftKey);if(u&&(null===(l=null==e?void 0:e.preventDefault)||void 0===l||l.call(e)),!(!d||it&&!o||(null==e?void 0:e.key)&&!u)){if("I want to add a rule description"===d){Oe(!1),De.current=!0,ot(!0),!vt&&d&&pt(o||"manual_entry");var h=new Date;return qe(function(e){return t(t([],e.map(function(e,t){var i;return n(n({},e),{content:null===(i=Zt(e.content))||void 0===i?void 0:i.replace("WaitMessage: ","")})}),!0),[{role:"user",content:d,time:h,isFirstQuestionSent:!1,id:r||y()}],!1)}),qt("smooth"),void setTimeout(function(){qe(function(e){return t(t([],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:y(),citations:[],time:new Date}],!1)}),qt("smooth"),setTimeout(function(){ot(!1),Oe(!0)},500)},500)}Oe(!1),De.current=!0,ot(!0),!vt&&d&&pt(o||"manual_entry");var m=new Date,v=Lt.current;qe(function(e){var i=e.map(function(e){var t;return n(n({},e),{content:null===(t=Zt(e.content))||void 0===t?void 0:t.replace("WaitMessage: ","")})});return r&&i.some(function(e){return e.id===r})?i.map(function(e){return e.id===r?n(n({},e),{content:d}):e}):t(t([],i,!0),[{role:"user",content:d,time:m,isFirstQuestionSent:!1,id:r||y()}],!1)}),qt("smooth");var p=new Map,C=[],g={WEBSOCKET_URL:K,organizationName:H,chatAssistantName:Ee,selectedAIModel:"gpt-4",replyMessage:"",userName:"Guest User",userEmailId:"guestUser@example.com",userId:"Guest User",query:d,requestId:"requestId-".concat(y()),customPrompt:"",enableForBackend:!1,guestSessionId:Te.current,chatPreviewId:Me.current,customMetaData:$,aiModel:"",additionalHeaders:(null==_e?void 0:_e.accessToken)?{Authorization:"Bearer ".concat(_e.accessToken)}:void 0,onStreamEvent:function(e){Ft.current&&Lt.current===v&&Kt(e,p,C,m,d,i,r)},onStreamEnd:function(e){if(Ft.current&&Lt.current===v){Oe(!0),ot(!1),gt(!1);var i=Date.now(),o=Nt.current.get(Dt.current);if(o){var a=Math.round((i-o)/1e3).toFixed(1);qe(function(e){var i=t([],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,t){return t===o?n(n({},e),{finalTimeTaken:a}):e})})}}},onError:function(e){Ft.current&&Lt.current===v&&(console.error("Stream error:",e),Oe(!0),ot(!1),gt(!1))}};if(d)Ze(!0),null===(c=Fe.current)||void 0===c||c.blur(),ze(""),qt(),tt(r?"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."),Nt.current.set(g.requestId,Date.now()),Dt.current=g.requestId,w(g);s&&s(!1)}},Gt=c(null);v(function(){Gt.current=Ut});var Vt=m(function(){for(var e,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return null===(e=Gt.current)||void 0===e?void 0:e.call.apply(e,t([Gt],n,!1))},[]),Ot=u(function(){return{p:function(e){e.node;var t=e.children;return a(e,["node","children"]),r("div",n({style:{margin:0,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"10px",fontFamily:"inherit"}},{children:t}))},button:function(e){e.node;var t=e.className,i=e.children,o=a(e,["node","className","children"]),l=F(i),c=o["data-value"],d="Tester Genie"===l;return r(T,n({},o,{className:t,handleStream:Vt,isStreamEnd:Ve,disabled:!!vt,isLastMessage:!0,style:{margin:0},isTesterGenie:d,"data-selected":vt===l||vt===c?"true":vt?"false":void 0},{children:s("span",n({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[i,d&&s("svg",n({width:"16",height:"20",viewBox:"0 0 16 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[r("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"}),r("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"}),r("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"}),r("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"}),r("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"}),r("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"}),r("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"}),r("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"}),r("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"}),r("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"})]}))]}))}))}}},[Vt,Ve,vt]),Jt=u(function(){return Be.some(function(e){return e.isSkeleton})},[Be]),Qt=function(e){return i(void 0,void 0,void 0,function(){return o(this,function(n){switch(n.label){case 0:return ke?[4,ke(e)]:[3,2];case 1:n.sent(),qe(function(e){return t(t([],e,!0),[{role:"assistant",content:"Thanks for your feedback — this will help improve future suggestions.",id:y(),citations:[],time:new Date,isEnd:!0}],!1)}),setTimeout(function(){return qt("smooth")},100),n.label=2;case 2:return[2]}})})};return console.log(Be,"rendering messages"),s("div",n({className:"".concat(N.customFont," ").concat(I.chatContainer),style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:ye&&!Jt?"0 0 20px 5px rgba(37, 99, 235, 0.5)":"none"}},{children:[s("div",n({ref:Ne,className:I.scrollWrapper},{children:[r("div",n({ref:yt,className:I.stickyHeader},{children:r(k,{resetChatHistory:function(){var e="".concat(Ie,"/api/chat/resetHistory?name=").concat(Ee,"&organizationName=").concat(H);try{var t={method:"GET",params:{guestSessionId:Te.current},withCredentials:!0};b.get(e,t).then(function(){U(!0),Ye(""),pt(null),xt.current.clear(),Me.current="".concat(y()),qe([]),Qe(!0),null==ne||ne(),O&&O()}).catch(function(e){console.error(e)}).finally(function(){Te.current="".concat(Ee,"-").concat(H,"-").concat(y())})}catch(e){Ze(!1),console.error(e)}},isStreamEnd:Ve,chatTitle:Y,onResize:se,chatSize:re,movingTowards:le})})),s("div",n({className:I.messagesList},{children:[s("div",n({className:I.initialMessageRow},{children:[r("div",n({className:I.iconWrapper},{children:r(W,{})})),r("div",n({className:I.welcomeTextWrapper},{children:r("div",n({className:I.welcomeMarkdownWrapper},{children:r("span",{children:r(f,n({rehypePlugins:[S],components:Ot},{children:oe}))})}))}))]})),Be.length>0&&Be.map(function(e,t){return s("div",n({className:I.messageRow},{children:["assistant"===e.role?r("div",n({className:I.assistantIconContainer},{children:r(W,{})})):r("div",{className:I.userSpacer}),r("div",n({className:I.messageContent},{children:"assistant"===e.role?s(l,{children:[e.orchestratorAndAgentsMessages&&e.orchestratorAndAgentsMessages.length>0&&r(R,{orchestratorAndAgentsMessages:null==e?void 0:e.orchestratorAndAgentsMessages,isStreamEnd:Ve,finalTimeTaken:null==e?void 0:e.finalTimeTaken},null==e?void 0:e.id),r(_,{index:t,content:null==e?void 0:e.content,role:null==e?void 0:e.role,messages:Be,handleStream:Ut,isLastMessage:t===Be.length-1,onSave:ae,citations:null==e?void 0:e.citations,setChatSize:se,chatSize:re,isStreamEnd:Ve,messageIsEnd:null==e?void 0:e.isEnd,onViewComparison:we,onTypeResponseClick:function(){var e;Tt(!0),null===(e=Fe.current)||void 0===e||e.focus()},onComparisonLinkClick:Re,baseURL:Ie,onFeedbackSubmit:Qt}),r("div",n({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",n({className:I.userMessageWrapper},{children:[s("div",n({className:I.userMessageBubble,style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:e.isSkeleton||Jt||e.id!==Rt?"none":"0 0 15px 3px rgba(37, 99, 235, 0.6)"}},{children:[e.isSkeleton?s("div",n({style:{display:"flex",flexDirection:"column",gap:"12px",minWidth:"280px",padding:"8px 0"}},{children:[r(E,{variant:"text",width:"100%",height:16}),r(E,{variant:"text",width:"80%",height:16})]})):r(_,{index:t,content:null==e?void 0:e.content,role:null==e?void 0:e.role,messages:Be,handleStream:Ut,isLastMessage:t===Be.length-1,onSave:ae,citations:null==e?void 0:e.citations,isStreamEnd:Ve,messageIsEnd:null==e?void 0:e.isEnd,onViewComparison:we,onComparisonLinkClick:Re,baseURL:Ie,onFeedbackSubmit:Qt}),r("div",n({style:{marginTop:"0.5rem"}},{children:r(z,{})}))]})),r("div",n({className:I.userTimestamp},{children:new Date(e.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}))}))]}),e.id)}),He&&s("div",n({className:I.loadingRow},{children:[r("div",n({className:I.iconWrapper,style:{marginTop:"0.2rem"}},{children:r(W,{})})),r("div",n({className:I.loadingTextWrapper},{children:r("span",{children:et})}))]})),r("div",{ref:Le,style:{float:"left",clear:"both"}})]}))]})),s("div",n({className:I.inputAreaWrapper},{children:[it&&s(C,n({sx:{display:"flex",alignItems:"center",gap:"8px",paddingBottom:"8px",paddingLeft:"4px",fontFamily:'"Plus Jakarta Sans", sans-serif',fontSize:"0.875rem",color:"#6b7280",width:"100%"}},{children:[r("span",{children:"Instant Learning AI is thinking"}),r(C,{sx:{width:"5px",height:"5px",bgcolor:"#6b7280",borderRadius:"50%",animation:"".concat(At," 1.4s infinite ease-in-out both"),animationDelay:"-0.32s"}}),r(C,{sx:{width:"5px",height:"5px",bgcolor:"#6b7280",borderRadius:"50%",animation:"".concat(At," 1.4s infinite ease-in-out both"),animationDelay:"-0.16s"}}),r(C,{sx:{width:"5px",height:"5px",bgcolor:"#6b7280",borderRadius:"50%",animation:"".concat(At," 1.4s infinite ease-in-out both")}})]})),r(g,n({title:X?"Please wait for the validation to be completed.":""},{children:s("div",n({className:"".concat(I.inputBoxContainer," ").concat(zt?I.disabled:""),style:Et?{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&&!ct&&r("div",n({onMouseDown:function(e){e.preventDefault(),qt("smooth")},className:I.scrollToBottomBtn},{children:r(D,{})})),s("div",n({style:{width:"100%",display:"flex"}},{children:[r("textarea",{ref:Fe,placeholder:ue,value:We||"",onChange:function(e){ze(e.target.value)},onFocus:function(){return st(!0)},onBlur:function(){return st(!1)},onKeyDown:function(e){return Ut(e)},disabled:zt,className:"no-scrollbar ".concat(I.chatTextarea),style:{minHeight:rt?"120px":"50px",height:rt?"120px":"50px",maxHeight:"120px"}}),r("span",n({className:I.sendButtonWrapper},{children:r("button",n({onClick:function(e){Ut(new KeyboardEvent("keydown",{key:"Enter"}))},disabled:jt,className:"".concat(I.sendButton," ").concat(jt?I.disabled:I.active)},{children:r(A,{})}))}))]}))]}))}))]})),s("div",n({className:I.footerTools},{children:[r(g,n({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:r("span",n({className:I.footerToolItem},{children:r(M,{amplitude:1,variant:"speaker",isActive:!1,onClick:function(){return null},disabled:!1})}))})),r(g,n({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:r("span",n({className:I.footerToolItem},{children:r(M,{amplitude:1,variant:"microphone",isActive:!1,onClick:function(){return null},disabled:!1})}))}))]}))]}))};export{q as default};
1
+ import{__makeTemplateObject as e,__spreadArray as t,__assign as n,__awaiter as i,__generator as o,__rest as a}from"tslib";import{jsx as r,jsxs as s,Fragment as l}from"react/jsx-runtime";import{useRef as c,useState as d,useMemo as u,useEffect as h,useCallback as m,useLayoutEffect as v}from"react";import{keyframes as p,Box as C}from"@mui/material";import g from"@mui/material/Tooltip";import f from"react-markdown";import S from"rehype-raw";import{http as b}from"../../../../api/transport.js";import{v4 as y}from"uuid";import{stopStreaming as x,startChatStream as w}from"@e-llm-studio/streaming-response";import{WatchMeWork as R}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 L,extractTextFromChildren as F}from"../../helpers/utils.js";import{SendButton as A}from"../_svg/SendButton.js";import W from"../_svg/SparkleIcon.js";import{UserIcon as z}from"../_svg/UserIcon.js";import B from"../../../LearningManagement/store/useAuthStore.js";var j,q=function(q){var P=q.chatAssistantName,H=q.organizationName,Z=q.baseUrl,K=q.baseWebsocketUrl,U=q.setIsNewChatClicked;q.ThinkingBulbIconComponent;var G=q.isFormSaveClicked,V=q.setIsFormSavedClicked,O=q.onResetLearningData,J=q.sendMessageInChat,Q=q.setSendMessageInChat,X=q.isFormValidating,Y=q.chatTitle,$=q.customMetaData,ee=q.headerMessageHandlers;q.aiResponse;var te=q.setAIResponse,ne=q.onResetChat,ie=q.initialChatMessage,oe=void 0===ie?"":ie,ae=q.onSave,re=q.chatSize,se=q.setChatSize,le=q.movingTowards,ce=q.setCitations,de=q.textareaPlaceholder,ue=void 0===de?"Tell me more about this learning...":de,he=q.setCurrentRequestId,me=q.showSavedMessage,ve=void 0!==me&&me,pe=q.savedMessage,Ce=q.isError,ge=void 0!==Ce&&Ce,fe=q.errorMessage,Se=void 0===fe?"There was an error saving your changes.":fe;q.isSaving;var be=q.isHighlighted,ye=void 0!==be&&be,xe=q.onStreamingStateChange,we=q.onViewComparison;q.isCopyEnabled;var Re=q.onComparisonLinkClick,ke=q.onSubmitFeedback,_e=B().user,Te=P,Ee=c("".concat(Te,"-").concat(H,"-").concat(y())),Me=c("".concat(y())),Ie=Z,Ne=c(null),De=c(!0),Le=c(null),Fe=c(null),Ae=d(""),We=Ae[0],ze=Ae[1],Be=d([]),je=Be[0],qe=Be[1],Pe=d(!1),He=Pe[0],Ze=Pe[1],Ke=d(!1);Ke[0];var Ue=Ke[1],Ge=d(!0),Ve=Ge[0],Oe=Ge[1],Je=d(!0);Je[0];var Qe=Je[1],Xe=d("");Xe[0];var Ye=Xe[1],$e=d(""),et=$e[0],tt=$e[1],nt=d(!1),it=nt[0],ot=nt[1],at=d(!1),rt=at[0],st=at[1],lt=d(!0),ct=lt[0],dt=lt[1],ut=d("100%");ut[0];var ht=ut[1],mt=d(null),vt=mt[0],pt=mt[1],Ct=d(!1);Ct[0];var gt=Ct[1],ft=d(!1),St=ft[0],bt=ft[1],yt=c(null),xt=c(new Set),wt=d(null),Rt=wt[0],kt=wt[1],_t=d(!1),Tt=_t[0],Et=_t[1],Mt=d(!1);Mt[0],Mt[1];var It=d(null);It[0],It[1],c(null),c(null);var Nt=c(new Map),Dt=c(""),Lt=c(0),Ft=c(!0),At=p(j||(j=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 "]))),Wt=u(function(){return""===(null==We?void 0:We.trim())||it},[We,it]),zt=u(function(){return X},[X]),Bt=u(function(){return Wt||it||X},[Wt,it,X]);h(function(){null==xe||xe(it)},[it,xe]),h(function(){return Ft.current=!0,function(){Ft.current=!1,Lt.current+=1,Dt.current&&K&&x(Dt.current,K,!1)}},[K]),h(function(){var e=Ne.current,t=function(){if(e){var t=e.scrollTop,n=e.scrollHeight,i=e.clientHeight;dt(n-t-i<=20)}};return e&&(e.addEventListener("scroll",t),t()),function(){e&&e.removeEventListener("scroll",t)}},[je]);var jt=L({handlers:ee,setResult:te}).processHeaderMessage;h(function(){ve&&bt(!0)},[ve]),h(function(){if(Tt){var e=setTimeout(function(){Et(!1)},3e3);return function(){return clearTimeout(e)}}},[Tt]),h(function(){G&&(Ut(new KeyboardEvent("keydown",{key:"Enter"}),!1,"Save this Learning"),V(!1))},[G]),h(function(){if(J)try{if(J.startsWith("__SKELETON__:")){var e=J.split(":"),i=e[1],o=e.slice(2).join(":"),a={role:"user",content:"",id:i,time:new Date,isSkeleton:!0,skeletonContent:o};return qe(function(e){return t(t([],e,!0),[a],!1)}),Ut(new KeyboardEvent("keydown",{key:"Enter"}),!1,o,!1,i),kt(i),Q&&Q(""),void setTimeout(function(){kt(null)},2e3)}if(J.startsWith("__SKELETON_END__::")){var r=J.split("::")[1]||"";return qe(function(e){return e.map(function(e){return e.isSkeleton?n(n({},e),{isSkeleton:!1,content:e.skeletonContent||r}):e})}),void(Q&&Q(""))}var s=y();Ut(new KeyboardEvent("keydown",{key:"Enter"}),!1,J,!1,s),kt(s),Q&&Q(""),setTimeout(function(){return kt(null)},2e3)}catch(e){console.error("Error handling sendMessageInChat signal",e)}},[J]),h(function(){Pt(),Ht();var e=function(){var e,t=(null===(e=null==yt?void 0:yt.current)||void 0===e?void 0:e.clientHeight)||0,n="calc(100% - ".concat(t,"px - 10px)");ht(n)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var qt=m(function(e){var t="string"==typeof e?e:"smooth";Le.current&&Le.current.scrollIntoView({behavior:t,block:"end"}),De.current&&setTimeout(function(){Le.current&&De.current&&Le.current.scrollIntoView({behavior:t,block:"end"})},100)},[]);h(function(){if(!it){var e="";if(St?e=pe||"Thank you teacher for teaching me, your rule has been saved successfully.":ge&&(e=Se||"I'm sorry, I couldn't save your changes. Please try again."),e){var n={role:"assistant",content:e,id:y(),citations:[],time:new Date};qe(function(e){return t(t([],e,!0),[n],!1)}),bt(!1),setTimeout(function(){return qt("smooth")},100)}}},[St,ge,it,pe,Se,qt]),h(function(){De.current&&qt("smooth")},[qt]);var Pt=function(){var e={method:"get",maxBodyLength:1/0,url:"".concat(Ie,"/api/chatbot/getChatSettings?name=").concat(Te,"&organizationName=").concat(H),headers:{}};b.request(e).then(function(e){var t,n,i;(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.chatSettings)&&""!==(null===(i=null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.chatSettings)||void 0===i?void 0:i.chatInitialMessage)&&Qe(!0)}).catch(function(e){console.error(e)})},Ht=function(){return i(void 0,void 0,void 0,function(){var e,t;return o(this,function(n){e="".concat(Ie,"/api/chat/history?name=").concat(Te,"&organizationName=").concat(H);try{t={method:"GET",params:{guestSessionId:Ee.current},withCredentials:!0},b.get(e,t).then(function(e){var t=e.data;t.length>0?(qe(t),qt()):Qe(!0)}).catch(function(e){console.error(e)})}catch(e){Ze(!1),console.error(e)}return[2]})})};function Zt(e){return null==e?void 0:e.replace(/<a [^>]*>.*?<\/a>/g,function(e){return null==e?void 0:e.replace(/\*/g,"&ast;")})}var Kt=function(e,i,o,a,r,s,l){var c,d,u,h,m,v,p,C,g,f,S,b,x,w,R,k,_,T,E,M,I,N,D,L,F,A,W,z,B,j,q,P,H,Z;if(null===(d=null===(c=null==e?void 0:e.chatStream)||void 0===c?void 0:c.continueChatResult)||void 0===d?void 0:d.header_message){var K={header_message:e.chatStream.continueChatResult.header_message,responsedata:null===(m=null===(h=null===(u=null==e?void 0:e.chatStream)||void 0===u?void 0:u.continueChatResult)||void 0===h?void 0:h.message)||void 0===m?void 0:m.content};jt(K)}var U=null===(v=null==e?void 0:e.chatStream)||void 0===v?void 0:v.continueChatResult,G=null==U?void 0:U.isEnd,V=(null===(p=null==U?void 0:U.message)||void 0===p?void 0:p.citations)||[];G&&V.length>0&&ce&&ce(V);var O={role:"assistant",content:"",id:y()};if(null===(S=null===(f=null===(g=null===(C=null==e?void 0:e.chatStream)||void 0===C?void 0:C.continueChatResult)||void 0===g?void 0:g.message)||void 0===f?void 0:f.content)||void 0===S?void 0:S.includes("WaitMessage: "))Ue(!0),O.content=function(e){var t="WaitMessage: ",n=e.indexOf(t);if(-1!==n){var i=e.substring(n+13);return null==i?void 0:i.replaceAll("WaitMessage: ","")}return""}((null===(w=null===(x=null===(b=null==e?void 0:e.chatStream)||void 0===b?void 0:b.continueChatResult)||void 0===x?void 0:x.message)||void 0===w?void 0:w.content)+"\n\n"),""!==O.content&&(Ze(!1),qe(t(t([],je,!0),[{role:"user",content:r,time:a,isFirstQuestionSent:s||!1,id:l||(null===(k=null===(R=null==e?void 0:e.chatStream)||void 0===R?void 0:R.continueChatResult)||void 0===k?void 0:k.requestId)||"",reply:""},O],!1)));else{Ue(!1),O.content=null===(M=Zt(null===(E=null===(T=null===(_=null==e?void 0:e.chatStream)||void 0===_?void 0:_.continueChatResult)||void 0===T?void 0:T.message)||void 0===E?void 0:E.content))||void 0===M?void 0:M.replaceAll("WaitMessage: ","");var J=null===(N=null===(I=null==e?void 0:e.chatStream)||void 0===I?void 0:I.continueChatResult)||void 0===N?void 0:N.requestId;"string"==typeof J&&J&&he&&he(J);var Q=function(e,i,o){var a,r,s,l,c,d,u,h,m,v,p,C,g,f,S,b,x,w,R,k,_,T,E,M,I,N,D,L,F,A,W,z,B,j,q={role:"assistant",content:"",id:y(),time:new Date,citations:[]};if(!1===(null===(r=null===(a=e.chatStream)||void 0===a?void 0:a.continueChatResult)||void 0===r?void 0:r.thinking_break)&&!0===(null===(l=null===(s=e.chatStream)||void 0===s?void 0:s.continueChatResult)||void 0===l?void 0:l.is_orchestrator)&&!1===(null===(d=null===(c=e.chatStream)||void 0===c?void 0:c.continueChatResult)||void 0===d?void 0:d.isEnd)&&(q.content=Zt(e.chatStream.continueChatResult.message.content||"")),!0===(null===(h=null===(u=e.chatStream)||void 0===u?void 0:u.continueChatResult)||void 0===h?void 0:h.thinking_break)&&!0===(null===(v=null===(m=e.chatStream)||void 0===m?void 0:m.continueChatResult)||void 0===v?void 0:v.is_orchestrator)&&!1===(null===(C=null===(p=e.chatStream)||void 0===p?void 0:p.continueChatResult)||void 0===C?void 0:C.isEnd)&&(q.content="",i.push({responsedata:e.chatStream.continueChatResult.message.content,responseFrom:e.chatStream.continueChatResult.responded_by,header_message:e.chatStream.continueChatResult.header_message,finalResponseStatus:!1})),!1===(null===(f=null===(g=e.chatStream)||void 0===g?void 0:g.continueChatResult)||void 0===f?void 0:f.thinking_break)&&!0===(null===(b=null===(S=e.chatStream)||void 0===S?void 0:S.continueChatResult)||void 0===b?void 0:b.is_orchestrator)&&!0===(null===(w=null===(x=e.chatStream)||void 0===x?void 0:x.continueChatResult)||void 0===w?void 0:w.isEnd)&&(q.content=Zt(e.chatStream.continueChatResult.message.content)),!1===(null===(k=null===(R=e.chatStream)||void 0===R?void 0:R.continueChatResult)||void 0===k?void 0:k.thinking_break)&&!1===(null===(T=null===(_=e.chatStream)||void 0===_?void 0:_.continueChatResult)||void 0===T?void 0:T.is_orchestrator)&&!1===(null===(M=null===(E=e.chatStream)||void 0===E?void 0:E.continueChatResult)||void 0===M?void 0:M.isEnd)){if((Z=e.chatStream.continueChatResult).explainability_id&&Z.responded_by){var P=Z.explainability_id,H=Z.responded_by;o.has(P)||o.set(P,{responded_by:H,index:i.length})}o.has(e.chatStream.continueChatResult.explainability_id)?i[null==(K=o.get(e.chatStream.continueChatResult.explainability_id))?void 0:K.index]={responsedata:e.chatStream.continueChatResult.message.content,responseFrom:e.chatStream.continueChatResult.responded_by,header_message:e.chatStream.continueChatResult.header_message,finalResponseStatus:!0,explainability_id:null!==(I=e.chatStream.continueChatResult.explainability_id)&&void 0!==I?I:"",isParallelToolResponse:!0}:i=t(t([],i,!0),[{responsedata:e.chatStream.continueChatResult.message.content,responseFrom:e.chatStream.continueChatResult.responded_by,header_message:e.chatStream.continueChatResult.header_message,finalResponseStatus:!0,explainability_id:null!==(N=e.chatStream.continueChatResult.explainability_id)&&void 0!==N?N:"",isParallelToolResponse:!1}],!1)}if(!0===(null===(L=null===(D=e.chatStream)||void 0===D?void 0:D.continueChatResult)||void 0===L?void 0:L.thinking_break)&&!1===(null===(A=null===(F=e.chatStream)||void 0===F?void 0:F.continueChatResult)||void 0===A?void 0:A.is_orchestrator)&&!1===(null===(z=null===(W=e.chatStream)||void 0===W?void 0:W.continueChatResult)||void 0===z?void 0:z.isEnd)){var Z,K;(Z=e.chatStream.continueChatResult).explainability_id&&Z.responded_by&&(P=Z.explainability_id,H=Z.responded_by,o.has(P)||o.set(P,{responded_by:H,index:i.length})),o.has(e.chatStream.continueChatResult.explainability_id)?i[null==(K=o.get(e.chatStream.continueChatResult.explainability_id))?void 0:K.index]={responsedata:e.chatStream.continueChatResult.message.content,responseFrom:e.chatStream.continueChatResult.responded_by,header_message:e.chatStream.continueChatResult.header_message,finalResponseStatus:!1,explainability_id:null!==(B=e.chatStream.continueChatResult.explainability_id)&&void 0!==B?B:"",isParallelToolResponse:!0}:i.push({responsedata:e.chatStream.continueChatResult.message.content,responseFrom:e.chatStream.continueChatResult.responded_by,header_message:e.chatStream.continueChatResult.header_message,finalResponseStatus:!1,explainability_id:null!==(j=e.chatStream.continueChatResult.explainability_id)&&void 0!==j?j:"",isParallelToolResponse:!1})}return n({orchestratorAndAgentsMessages:i},q)}(e,o,i);Q.time=new Date,Q.citations=V,Q.isEnd=null===(L=null===(D=null==e?void 0:e.chatStream)||void 0===D?void 0:D.continueChatResult)||void 0===L?void 0:L.isEnd,Q.requestId=null===(A=null===(F=null==e?void 0:e.chatStream)||void 0===F?void 0:F.continueChatResult)||void 0===A?void 0:A.requestId,Q.sessionId=Ee.current,null===(W=Q.orchestratorAndAgentsMessages)||void 0===W||W.forEach(function(e){e&&e.header_message&&jt(e)}),(""!==(null==Q?void 0:Q.content)||(null==Q?void 0:Q.orchestratorAndAgentsMessages)&&(null==Q?void 0:Q.orchestratorAndAgentsMessages.length)>0)&&(Ze(!1),qe(t(t([],je,!0),[{role:"user",content:r||"",time:a,isFirstQuestionSent:s||!1,id:l||(null===(B=null===(z=null==e?void 0:e.chatStream)||void 0===z?void 0:z.continueChatResult)||void 0===B?void 0:B.requestId)||"",requestId:null!==(P=null===(q=null===(j=null==e?void 0:e.chatStream)||void 0===j?void 0:j.continueChatResult)||void 0===q?void 0:q.requestId)&&void 0!==P?P:""},Q],!1))),Oe(null===(Z=null===(H=null==e?void 0:e.chatStream)||void 0===H?void 0:H.continueChatResult)||void 0===Z?void 0:Z.isEnd)}},Ut=function(e,i,o,a,r,s){var l,c,d=(void 0!==o?o:We||"").trim(),u="Enter"===(null==e?void 0:e.key)&&!(null==e?void 0:e.shiftKey);if(u&&(null===(l=null==e?void 0:e.preventDefault)||void 0===l||l.call(e)),!(!d||it&&!o||(null==e?void 0:e.key)&&!u)){if("I want to add a rule description"===d){Oe(!1),De.current=!0,ot(!0),!vt&&d&&pt(o||"manual_entry");var h=new Date;return qe(function(e){return t(t([],e.map(function(e,t){var i;return n(n({},e),{content:null===(i=Zt(e.content))||void 0===i?void 0:i.replace("WaitMessage: ","")})}),!0),[{role:"user",content:d,time:h,isFirstQuestionSent:!1,id:r||y()}],!1)}),qt("smooth"),void setTimeout(function(){qe(function(e){return t(t([],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:y(),citations:[],time:new Date}],!1)}),qt("smooth"),setTimeout(function(){ot(!1),Oe(!0)},500)},500)}Oe(!1),De.current=!0,ot(!0),!vt&&d&&pt(o||"manual_entry");var m=new Date,v=Lt.current;qe(function(e){var i=e.map(function(e){var t;return n(n({},e),{content:null===(t=Zt(e.content))||void 0===t?void 0:t.replace("WaitMessage: ","")})});return r&&i.some(function(e){return e.id===r})?i.map(function(e){return e.id===r?n(n({},e),{content:d}):e}):t(t([],i,!0),[{role:"user",content:d,time:m,isFirstQuestionSent:!1,id:r||y()}],!1)}),qt("smooth");var p=new Map,C=[],g={WEBSOCKET_URL:K,organizationName:H,chatAssistantName:Te,selectedAIModel:"gpt-4",replyMessage:"",userName:"Guest User",userEmailId:"guestUser@example.com",userId:"Guest User",query:d,requestId:"requestId-".concat(y()),customPrompt:"",enableForBackend:!1,guestSessionId:Ee.current,chatPreviewId:Me.current,customMetaData:$,aiModel:"",additionalHeaders:(null==_e?void 0:_e.accessToken)?{Authorization:"Bearer ".concat(_e.accessToken)}:void 0,onStreamEvent:function(e){Ft.current&&Lt.current===v&&Kt(e,p,C,m,d,i,r)},onStreamEnd:function(e){if(Ft.current&&Lt.current===v){Oe(!0),ot(!1),gt(!1);var i=Date.now(),o=Nt.current.get(Dt.current);if(o){var a=Math.round((i-o)/1e3).toFixed(1);qe(function(e){var i=t([],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,t){return t===o?n(n({},e),{finalTimeTaken:a}):e})})}}},onError:function(e){Ft.current&&Lt.current===v&&(console.error("Stream error:",e),Oe(!0),ot(!1),gt(!1))}};if(d)Ze(!0),null===(c=Fe.current)||void 0===c||c.blur(),ze(""),qt(),tt(r?"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."),Nt.current.set(g.requestId,Date.now()),Dt.current=g.requestId,w(g);s&&s(!1)}},Gt=c(null);v(function(){Gt.current=Ut});var Vt=m(function(){for(var e,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return null===(e=Gt.current)||void 0===e?void 0:e.call.apply(e,t([Gt],n,!1))},[]),Ot=u(function(){return{p:function(e){e.node;var t=e.children;return a(e,["node","children"]),r("div",n({style:{margin:0,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"10px",fontFamily:"inherit"}},{children:t}))},button:function(e){e.node;var t=e.className,i=e.children,o=a(e,["node","className","children"]),l=F(i),c=o["data-value"],d="Tester Genie"===l;return r(E,n({},o,{className:t,handleStream:Vt,isStreamEnd:Ve,disabled:!!vt,isLastMessage:!0,style:{margin:0},isTesterGenie:d,"data-selected":vt===l||vt===c?"true":vt?"false":void 0},{children:s("span",n({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[i,d&&s("svg",n({width:"16",height:"20",viewBox:"0 0 16 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[r("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"}),r("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"}),r("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"}),r("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"}),r("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"}),r("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"}),r("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"}),r("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"}),r("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"}),r("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"})]}))]}))}))}}},[Vt,Ve,vt]),Jt=u(function(){return je.some(function(e){return e.isSkeleton})},[je]),Qt=function(e){return i(void 0,void 0,void 0,function(){return o(this,function(n){switch(n.label){case 0:return ke?[4,ke(e)]:[3,2];case 1:n.sent(),qe(function(e){return t(t([],e,!0),[{role:"assistant",content:"Thanks for your feedback — this will help improve future suggestions.",id:y(),citations:[],time:new Date,isEnd:!0}],!1)}),setTimeout(function(){return qt("smooth")},100),n.label=2;case 2:return[2]}})})};return console.log(je,"rendering messages"),s("div",n({className:"".concat(N.customFont," ").concat(I.chatContainer),style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:ye&&!Jt?"0 0 20px 5px rgba(37, 99, 235, 0.5)":"none"}},{children:[s("div",n({ref:Ne,className:I.scrollWrapper},{children:[r("div",n({ref:yt,className:I.stickyHeader},{children:r(k,{resetChatHistory:function(){var e="".concat(Ie,"/api/chat/resetHistory?name=").concat(Te,"&organizationName=").concat(H);try{var t={method:"GET",params:{guestSessionId:Ee.current},headers:(null==_e?void 0:_e.accessToken)?{Authorization:"Bearer ".concat(_e.accessToken)}:{},withCredentials:!0};b.get(e,t).then(function(){U(!0),Ye(""),pt(null),xt.current.clear(),Me.current="".concat(y()),qe([]),Qe(!0),null==ne||ne(),O&&O()}).catch(function(e){console.error(e)}).finally(function(){Ee.current="".concat(Te,"-").concat(H,"-").concat(y())})}catch(e){Ze(!1),console.error(e)}},isStreamEnd:Ve,chatTitle:Y,onResize:se,chatSize:re,movingTowards:le})})),s("div",n({className:I.messagesList},{children:[s("div",n({className:I.initialMessageRow},{children:[r("div",n({className:I.iconWrapper},{children:r(W,{})})),r("div",n({className:I.welcomeTextWrapper},{children:r("div",n({className:I.welcomeMarkdownWrapper},{children:r("span",{children:r(f,n({rehypePlugins:[S],components:Ot},{children:oe}))})}))}))]})),je.length>0&&je.map(function(e,t){return s("div",n({className:I.messageRow},{children:["assistant"===e.role?r("div",n({className:I.assistantIconContainer},{children:r(W,{})})):r("div",{className:I.userSpacer}),r("div",n({className:I.messageContent},{children:"assistant"===e.role?s(l,{children:[e.orchestratorAndAgentsMessages&&e.orchestratorAndAgentsMessages.length>0&&r(R,{orchestratorAndAgentsMessages:null==e?void 0:e.orchestratorAndAgentsMessages,isStreamEnd:Ve,finalTimeTaken:null==e?void 0:e.finalTimeTaken},null==e?void 0:e.id),r(_,{index:t,content:null==e?void 0:e.content,role:null==e?void 0:e.role,messages:je,handleStream:Ut,isLastMessage:t===je.length-1,onSave:ae,citations:null==e?void 0:e.citations,setChatSize:se,chatSize:re,isStreamEnd:Ve,messageIsEnd:null==e?void 0:e.isEnd,onViewComparison:we,onTypeResponseClick:function(){var e;Et(!0),null===(e=Fe.current)||void 0===e||e.focus()},onComparisonLinkClick:Re,baseURL:Ie,onFeedbackSubmit:Qt}),r("div",n({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",n({className:I.userMessageWrapper},{children:[s("div",n({className:I.userMessageBubble,style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:e.isSkeleton||Jt||e.id!==Rt?"none":"0 0 15px 3px rgba(37, 99, 235, 0.6)"}},{children:[e.isSkeleton?s("div",n({style:{display:"flex",flexDirection:"column",gap:"12px",minWidth:"280px",padding:"8px 0"}},{children:[r(T,{variant:"text",width:"100%",height:16}),r(T,{variant:"text",width:"80%",height:16})]})):r(_,{index:t,content:null==e?void 0:e.content,role:null==e?void 0:e.role,messages:je,handleStream:Ut,isLastMessage:t===je.length-1,onSave:ae,citations:null==e?void 0:e.citations,isStreamEnd:Ve,messageIsEnd:null==e?void 0:e.isEnd,onViewComparison:we,onComparisonLinkClick:Re,baseURL:Ie,onFeedbackSubmit:Qt}),r("div",n({style:{marginTop:"0.5rem"}},{children:r(z,{})}))]})),r("div",n({className:I.userTimestamp},{children:new Date(e.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}))}))]}),e.id)}),He&&s("div",n({className:I.loadingRow},{children:[r("div",n({className:I.iconWrapper,style:{marginTop:"0.2rem"}},{children:r(W,{})})),r("div",n({className:I.loadingTextWrapper},{children:r("span",{children:et})}))]})),r("div",{ref:Le,style:{float:"left",clear:"both"}})]}))]})),s("div",n({className:I.inputAreaWrapper},{children:[it&&s(C,n({sx:{display:"flex",alignItems:"center",gap:"8px",paddingBottom:"8px",paddingLeft:"4px",fontFamily:'"Plus Jakarta Sans", sans-serif',fontSize:"0.875rem",color:"#6b7280",width:"100%"}},{children:[r("span",{children:"Instant Learning AI is thinking"}),r(C,{sx:{width:"5px",height:"5px",bgcolor:"#6b7280",borderRadius:"50%",animation:"".concat(At," 1.4s infinite ease-in-out both"),animationDelay:"-0.32s"}}),r(C,{sx:{width:"5px",height:"5px",bgcolor:"#6b7280",borderRadius:"50%",animation:"".concat(At," 1.4s infinite ease-in-out both"),animationDelay:"-0.16s"}}),r(C,{sx:{width:"5px",height:"5px",bgcolor:"#6b7280",borderRadius:"50%",animation:"".concat(At," 1.4s infinite ease-in-out both")}})]})),r(g,n({title:X?"Please wait for the validation to be completed.":""},{children:s("div",n({className:"".concat(I.inputBoxContainer," ").concat(zt?I.disabled:""),style:Tt?{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&&!ct&&r("div",n({onMouseDown:function(e){e.preventDefault(),qt("smooth")},className:I.scrollToBottomBtn},{children:r(D,{})})),s("div",n({style:{width:"100%",display:"flex"}},{children:[r("textarea",{ref:Fe,placeholder:ue,value:We||"",onChange:function(e){ze(e.target.value)},onFocus:function(){return st(!0)},onBlur:function(){return st(!1)},onKeyDown:function(e){return Ut(e)},disabled:zt,className:"no-scrollbar ".concat(I.chatTextarea),style:{minHeight:rt?"120px":"50px",height:rt?"120px":"50px",maxHeight:"120px"}}),r("span",n({className:I.sendButtonWrapper},{children:r("button",n({onClick:function(e){Ut(new KeyboardEvent("keydown",{key:"Enter"}))},disabled:Bt,className:"".concat(I.sendButton," ").concat(Bt?I.disabled:I.active)},{children:r(A,{})}))}))]}))]}))}))]})),s("div",n({className:I.footerTools},{children:[r(g,n({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:r("span",n({className:I.footerToolItem},{children:r(M,{amplitude:1,variant:"speaker",isActive:!1,onClick:function(){return null},disabled:!1})}))})),r(g,n({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:r("span",n({className:I.footerToolItem},{children:r(M,{amplitude:1,variant:"microphone",isActive:!1,onClick:function(){return null},disabled:!1})}))}))]}))]}))};export{q as default};
2
2
  //# sourceMappingURL=NormalChat.js.map
@@ -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;AAsClG,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,GAAG,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IACnF,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;IAC7B,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5D,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,wFAAwF;IACxF,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,0EAA0E;IAC1E,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,eAAO,MAAM,kBAAkB,aAAc,MAAM,cAAc,MAAM,iBAsBtE,CAAC;AAEF,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAs3D/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;AAsClG,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,GAAG,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IACnF,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;IAC7B,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5D,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,wFAAwF;IACxF,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,0EAA0E;IAC1E,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,eAAO,MAAM,kBAAkB,aAAc,MAAM,cAAc,MAAM,iBAsBtE,CAAC;AAEF,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAu3D/C,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"NormalChat.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/IL-OTJ/_components/ChatComponents/NormalChat.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6E,MAAM,OAAO,CAAC;AAsClG,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;CACpD;AACD,eAAO,MAAM,kBAAkB,aAAc,MAAM,cAAc,MAAM,iBAsBtE,CAAC;AAEF,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAmhD5C,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"NormalChat.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/IL-OTJ/_components/ChatComponents/NormalChat.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6E,MAAM,OAAO,CAAC;AAsClG,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;CACpD;AACD,eAAO,MAAM,kBAAkB,aAAc,MAAM,cAAc,MAAM,iBAsBtE,CAAC;AAEF,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAohD5C,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"LearningManagementTest.d.ts","sourceRoot":"","sources":["../../../../../src/features/LearningManagement/LearningManagementTest.tsx"],"names":[],"mappings":";AAMA,iBAAS,sBAAsB,gCAoW9B;AAGD,eAAe,sBAAsB,CAAA"}
1
+ {"version":3,"file":"LearningManagementTest.d.ts","sourceRoot":"","sources":["../../../../../src/features/LearningManagement/LearningManagementTest.tsx"],"names":[],"mappings":";AAMA,iBAAS,sBAAsB,gCAqW9B;AAGD,eAAe,sBAAsB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-llm-studio/instant-learning",
3
- "version": "1.3.0-alpha.300",
3
+ "version": "1.3.0-alpha.301",
4
4
  "author": "Devesh Patel",
5
5
  "description": "",
6
6
  "license": "MIT",
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("tslib"),e=require("react/jsx-runtime"),t=require("react"),n=require("../../organisms/TextSection/TextSection.js"),o=require("../../organisms/ScopeSection/ScopeSection.js"),s=require("../../organisms/ConditionSection/ConditionSection.js"),d=require("../../organisms/ConfigSection/ConfigSection.js"),a=require("../../InputDataReasoningCard.js"),l=require("../../_svg/ButtonCognitiveIcon.js");exports.BaseTemplate=function(r){var c,p,g,h,v,u,I,E,m,f,b,S,y,x,C,A,_,j,T,N,w,W,D,L,O,M,q,P,R,V,H,B,K,z=r.state,k=r.handlers,F=r.uiState,G=r.customNodes,J=void 0===G?{}:G,Q=t.useState({}),U=Q[0],X=Q[1],Y=t.useState(new Set),Z=Y[0],$=Y[1],ii=function(e){X(function(t){var n;return i.__assign(i.__assign({},t),((n={})[e]=!t[e],n))})},ei=function(i){var e,t=null===(e=z.fieldCitations)||void 0===e?void 0:e[i];return Array.isArray(t)&&t.length>0?t:z.citations||[]},ti={marginTop:"-17px",position:"relative",zIndex:1},ni=function(i){return!!F.isAiStreaming||(!!F.isReadOnly||!(!F.activeEditId||F.activeEditId.startsWith(i)))};return e.jsxs("div",i.__assign({className:"base-template-container",style:{display:"flex",flexDirection:"column",gap:"16px",width:"100%"}},{children:[J.top&&e.jsx("div",i.__assign({className:"custom-slot-top"},{children:J.top})),e.jsxs("div",i.__assign({className:"template-section"},{children:[e.jsx(n.TextSection,{id:"base-title",title:F.titleLabel||"Title",fieldName:F.titleLabel||"Title",rows:1,placeholder:"Enter a descriptive title",required:!0,value:z.title||"",onChange:k.onTitleChange,readOnly:ni("base-title"),isOpen:U.title,onToggle:function(){return ii("title")},isHighlighted:(null===(c=F.highlights)||void 0===c?void 0:c.get("title"))||!1,showCognitiveIcon:!!(null===(p=z.citation)||void 0===p?void 0:p.title),tooltipDescription:"Why this ".concat(F.titleLabel||"Title","?"),errorMessage:null===(g=F.validationErrors)||void 0===g?void 0:g.title,enableInlineEdit:!0,setSendMessageInChat:F.setSendMessageInChat,activeEditId:null!==(h=F.activeEditId)&&void 0!==h?h:null,setActiveEditId:F.setActiveEditId,pendingEditId:null!==(v=F.pendingEditId)&&void 0!==v?v:null,setPendingEditId:F.setPendingEditId}),(null===(u=z.citation)||void 0===u?void 0:u.title)&&e.jsx("div",i.__assign({style:ti},{children:e.jsx(a.InputDataReasoningCard,{isVisible:U.title,citation:z.citation.title,citations:ei("title"),fieldName:F.titleLabel||"Title",fieldValue:z.title||""})}))]})),J.afterTitle&&e.jsx("div",i.__assign({className:"custom-slot"},{children:J.afterTitle})),F.showScope&&e.jsxs("div",i.__assign({className:"template-section"},{children:[e.jsx(o.ScopeSection,{id:"base-scope",title:F.scopeLabel||"",required:!1,scopeData:z.scopeData||{},onScopeChange:k.onScopeChange,openSections:Z,setOpenSections:$,stationOptions:F.stationOptions||[],tierOptions:F.tierOptions||[],tierLabel:F.tierLabel||"Where should this apply?",stationLabel:F.stationLabel||"Which scope should this belong to?",highlights:(null===(I=F.highlights)||void 0===I?void 0:I.get("scope"))||{},isOpen:U.scope,onToggle:function(){return ii("scope")},showCognitiveIcon:!!(null===(E=z.citation)||void 0===E?void 0:E.scope),cognitiveIcon:e.jsx(l.ButtonCognitiveIcon,{}),tooltipDescription:"Why this Scope?",errorMessage:(null===(m=F.validationErrors)||void 0===m?void 0:m.station)||(null===(f=F.validationErrors)||void 0===f?void 0:f.tiers),stationErrorMessage:null===(b=F.validationErrors)||void 0===b?void 0:b.station,tierErrorMessage:null===(S=F.validationErrors)||void 0===S?void 0:S.tiers,readOnly:ni("base-scope")}),(null===(y=z.citation)||void 0===y?void 0:y.scope)&&e.jsx("div",i.__assign({style:ti},{children:e.jsx(a.InputDataReasoningCard,{isVisible:U.scope,citation:z.citation.scope,citations:ei("scope"),fieldName:"Scope",fieldValue:(null===(C=null===(x=z.scopeData)||void 0===x?void 0:x.tiers)||void 0===C?void 0:C.join(", "))||""})}))]})),J.afterScope&&e.jsx("div",i.__assign({className:"custom-slot"},{children:J.afterScope})),e.jsxs("div",i.__assign({className:"template-section"},{children:[e.jsx(n.TextSection,{id:"base-description",title:F.descriptionLabel||"Description",fieldName:F.descriptionLabel||"Description",rows:3,placeholder:"Explain the behaviour or learning",required:!0,value:z.description||"",onChange:k.onDescriptionChange,readOnly:ni("base-description"),isOpen:U.description,onToggle:function(){return ii("description")},isHighlighted:(null===(A=F.highlights)||void 0===A?void 0:A.get("description"))||!1,showCognitiveIcon:!!(null===(_=z.citation)||void 0===_?void 0:_.description),tooltipDescription:"Why this ".concat(F.descriptionLabel||"Description","?"),errorMessage:null===(j=F.validationErrors)||void 0===j?void 0:j.description,enableInlineEdit:!0,setSendMessageInChat:F.setSendMessageInChat,activeEditId:null!==(T=F.activeEditId)&&void 0!==T?T:null,setActiveEditId:F.setActiveEditId,pendingEditId:null!==(N=F.pendingEditId)&&void 0!==N?N:null,setPendingEditId:F.setPendingEditId}),(null===(w=z.citation)||void 0===w?void 0:w.description)&&e.jsx("div",i.__assign({style:ti},{children:e.jsx(a.InputDataReasoningCard,{isVisible:U.description,citation:z.citation.description,citations:ei("description"),fieldName:F.descriptionLabel||"Description",fieldValue:z.description||""})}))]})),J.afterDescription&&e.jsx("div",i.__assign({className:"custom-slot"},{children:J.afterDescription})),e.jsx("div",i.__assign({className:"template-section"},{children:e.jsx(s.ConditionSection,{id:"condition-wta-base",idPrefix:"condition-wta",title:F.whenToApplyLabel||"When to apply",required:!0,dividerRequired:!0,readOnly:ni("condition-wta"),conditions:z.whenToApplyConditions||[],onAdd:k.onAddWhenToApply,onRemove:function(i,e,t){return k.onRemoveWhenToApply(t)},onEdit:function(i,e,t,n){return k.onEditWhenToApply(t,n)},isHighlighted:(null===(W=F.highlights)||void 0===W?void 0:W.get("wta"))||!1,highlightedIds:F.highlightedIds,tooltipDescription:"Why this Condition?",citations:ei("whenToApply"),bordered:!0,addLabel:"Add ".concat(F.whenToApplyLabel||"When to apply"),isAiStreaming:F.isAiStreaming,errorMessage:(null===(D=F.validationErrors)||void 0===D?void 0:D.whenToApply)||F.conflictReason,index:0,tierKey:"base",activeEditId:null!==(L=F.activeEditId)&&void 0!==L?L:null,setActiveEditId:F.setActiveEditId,pendingEditId:null!==(O=F.pendingEditId)&&void 0!==O?O:null,setPendingEditId:F.setPendingEditId,setSendMessageInChat:F.setSendMessageInChat})})),J.afterWhenToApply&&e.jsx("div",i.__assign({className:"custom-slot"},{children:J.afterWhenToApply})),e.jsx("div",i.__assign({className:"template-section"},{children:e.jsx(s.ConditionSection,{id:"condition-wnta-base",idPrefix:"condition-wnta",title:F.whenNotToApplyLabel||"When NOT to apply",required:!1,dividerRequired:!0,readOnly:ni("condition-wnta"),conditions:z.whenNotToApplyConditions||[],onAdd:k.onAddWhenNotToApply,onRemove:function(i,e,t){return k.onRemoveWhenToApply(t)},onEdit:function(i,e,t,n){return k.onEditWhenNotToApply(t,n)},isHighlighted:(null===(M=F.highlights)||void 0===M?void 0:M.get("wnta"))||!1,highlightedIds:F.highlightedIds,tooltipDescription:"Why this Condition?",citations:ei("whenNotToApply"),bordered:!0,addLabel:"Add ".concat(F.whenNotToApplyLabel||"When NOT to apply"),isAiStreaming:F.isAiStreaming,errorMessage:null===(q=F.validationErrors)||void 0===q?void 0:q.whenNotToApply,index:0,tierKey:"base",activeEditId:null!==(P=F.activeEditId)&&void 0!==P?P:null,setActiveEditId:F.setActiveEditId,pendingEditId:null!==(R=F.pendingEditId)&&void 0!==R?R:null,setPendingEditId:F.setPendingEditId,setSendMessageInChat:F.setSendMessageInChat})})),J.afterWhenNotToApply&&e.jsx("div",i.__assign({className:"custom-slot"},{children:J.afterWhenNotToApply})),F.showConfiguration&&e.jsxs("div",i.__assign({className:"template-section"},{children:[e.jsx(d.ConfigSection,{id:"base-config",title:F.configLabel||"Configuration",required:!1,highlights:(null===(V=F.highlights)||void 0===V?void 0:V.get("config"))||{},bordered:!0,readOnly:ni("base-config"),onConfigChange:function(i,e){var t;return null===(t=k.onConfigChange)||void 0===t?void 0:t.call(k,i,e)},separationItems:F.separationItems||[],toggles:F.toggles||[],index:0,openSections:Z,setOpenSections:$,activeEditId:null!==(H=F.activeEditId)&&void 0!==H?H:null,setActiveEditId:F.setActiveEditId,pendingEditId:null!==(B=F.pendingEditId)&&void 0!==B?B:null,setPendingEditId:F.setPendingEditId,isAiStreaming:F.isAiStreaming,setSendMessageInChat:F.setSendMessageInChat}),(null===(K=z.citation)||void 0===K?void 0:K.config)&&e.jsx("div",i.__assign({style:ti},{children:e.jsx(a.InputDataReasoningCard,{isVisible:U.config,citation:z.citation.config,citations:ei("config"),fieldName:F.configLabel||"Configuration",fieldValue:"Proposed Configuration"})}))]})),J.bottom&&e.jsx("div",i.__assign({className:"custom-slot-bottom"},{children:J.bottom}))]}))};
2
- //# sourceMappingURL=BaseTemplate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BaseTemplate.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("lucide-react");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=s(t),o=0,a=function(){return"cond-".concat(Date.now(),"-").concat(++o)},l="#CBD5E1",d="#9B8AFB",c="#7C3AED",g="#FDA29B",u="#344054",p="#1E293B",x="#334155",f="#64748B",h="#94A3B8",_="#98A2B3",y="#F04438",m="#8F2C23",b="#5925DC",j="#475569",v="#FFFFFF",w="#F8FAFC",C="#F1F5F9",F="#F9F5FF",k="#17B26A",S="#F04438",z="#64748B",D="6px",E="8px",A="Inter, sans-serif",B={width:38,height:38,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid #D0D5DD",borderRadius:D,cursor:"pointer",background:v,flexShrink:0,transition:"background 0.15s"},R={width:"100%",boxSizing:"border-box",padding:"8px 11.5px",border:"1px solid #D0D5DD",borderRadius:D,fontSize:14,fontWeight:400,lineHeight:"100%",fontFamily:A,outline:"none",color:u,background:v},T={display:"flex",alignItems:"center",gap:4,marginBottom:8,color:u,fontSize:14,fontWeight:500,lineHeight:"130%",fontFamily:A},I={background:v,border:"1px solid ".concat(l),borderRadius:E,padding:16},W=n.jsx("span",e.__assign({style:{color:m,fontSize:12,lineHeight:1,display:"inline-flex",transform:"translateY(0.5px)"}},{children:"*"})),H={exact_match:{label:"Exact Match",bg:"#F0FDF4",border:"#BBF7D0",text:"#166534",dot:"#22C55E"},conflict:{label:"Conflict",bg:"#FEF2F2",border:"#FECACA",text:"#991B1B",dot:"#EF4444"},partial_overlap:{label:"Partial Match",bg:"#FFF7ED",border:"#FED7AA",text:"#92400E",dot:"#F97316"},new_field:{label:"New",bg:"#F5F3FF",border:"#DDD6FE",text:"#5925DC",dot:"#7C3AED"}},L=function(e){return e?Array.isArray(e)?e.filter(Boolean).join("\n"):e:""},M=function(e,n){if(!n&&!e)return"exact_match";if(!n)return"new_field";if(!e)return"new_field";var t=function(e){return e.trim().toLowerCase()};if(t(e)===t(n))return"exact_match";var i=new Set(t(e).split(/\s+/)),s=new Set(t(n).split(/\s+/));return Array.from(i).filter(function(e){return s.has(e)}).length/Math.max(i.size,s.size)>=.45?"partial_overlap":"conflict"},N=function(t){var i=t.relation,s=H[i];return n.jsxs("div",e.__assign({style:{display:"inline-flex",alignItems:"center",gap:4,padding:"3px 9px",borderRadius:20,background:s.bg,border:"1px solid ".concat(s.border),fontSize:10,fontWeight:600,color:s.text,fontFamily:A,whiteSpace:"nowrap",flexShrink:0}},{children:[n.jsx("span",{style:{width:5,height:5,borderRadius:"50%",background:s.dot,flexShrink:0}}),s.label]}))},O=r.default.forwardRef(function(t,i){var s=t.label,r=t.value;return n.jsxs("div",e.__assign({ref:i,style:{display:"flex",flexDirection:"column"}},{children:[n.jsx("p",e.__assign({style:{margin:"0 0 5px 0",fontSize:12,color:f,fontFamily:A}},{children:s})),n.jsx("div",e.__assign({style:{flex:1,padding:"9px 12px",borderRadius:E,background:"#FFF3F2",border:"1px solid ".concat("#FECACA"),fontSize:13,lineHeight:"150%",color:r?p:h,fontFamily:A,fontStyle:r?"normal":"italic",wordBreak:"break-word",whiteSpace:"pre-wrap",minHeight:37}},{children:r||"—"}))]}))});O.displayName="FieldCell";var q=function(s){var r=s.formData,o=s.existingData,a=s.onClose,d=s.visible,c=r.whenToApply.map(function(e){return e.text}).filter(Boolean).join("\n"),g=r.whenNotToApply.map(function(e){return e.text}).filter(Boolean).join("\n"),u=L(o.whenToApply),f=L(o.whenNotToApply),h=t.useMemo(function(){return[{label:"Title",proposed:r.name,existing:o.name||"",relation:M(r.name,o.name||"")},{label:"Description",proposed:r.description,existing:o.description||"",relation:M(r.description,o.description||"")},{label:"When to apply",proposed:c,existing:u,relation:M(c,u)},{label:"When NOT to Apply",proposed:g,existing:f,relation:g?M(g,f):f?"new_field":"exact_match"}]},[r.name,r.description,c,g,o.name,o.description,u,f]),_=h.reduce(function(e,n){return e[n.relation]=(e[n.relation]||0)+1,e},{}),y=t.useRef(null),m=t.useRef([]),j=t.useRef([]),w=t.useState([]),C=w[0],F=w[1];m.current=[],j.current=[];var k=t.useCallback(function(){if(y.current){var e=y.current.getBoundingClientRect(),n=[];h.forEach(function(t,i){var s=m.current[i],r=j.current[i];if(s&&r){s.style.height="auto",r.style.height="auto";var o=s.getBoundingClientRect(),a=r.getBoundingClientRect(),l=Math.max(o.height,a.height);s.style.height="".concat(l,"px"),r.style.height="".concat(l,"px");var d=s.getBoundingClientRect(),c=r.getBoundingClientRect(),g=d.top+d.height/2-e.top;n.push({x1:d.right-e.left,y1:g,x2:c.left-e.left,y2:g,relation:t.relation})}}),F(n)}},[h]);return t.useEffect(function(){var e=setTimeout(k,150);window.addEventListener("resize",k);var n=null;return y.current&&(n=new ResizeObserver(function(){window.requestAnimationFrame(function(){return k()})})).observe(y.current),function(){clearTimeout(e),window.removeEventListener("resize",k),n&&n.disconnect()}},[k,d]),n.jsxs(n.Fragment,{children:[n.jsx("div",{onClick:a,style:{position:"absolute",inset:0,background:"rgba(15,23,42,0.18)",zIndex:10,opacity:d?1:0,transition:"opacity 0.25s ease",pointerEvents:d?"auto":"none"}}),n.jsxs("div",e.__assign({style:{position:"absolute",inset:0,background:v,zIndex:11,display:"flex",flexDirection:"column",transform:d?"translateX(0)":"translateX(100%)",transition:"transform 0.28s cubic-bezier(0.4,0,0.2,1)",borderRadius:E,overflow:"hidden"}},{children:[n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid ".concat(l),flexShrink:0,background:v}},{children:[n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:10}},{children:[n.jsx("button",e.__assign({type:"button",onClick:a,style:e.__assign(e.__assign({},B),{width:32,height:32,border:"1px solid ".concat(l),borderRadius:D})},{children:n.jsx(i.ArrowLeft,{size:15,color:x})})),n.jsx("span",e.__assign({style:{fontSize:15,fontWeight:600,color:p,fontFamily:A,letterSpacing:"-0.01em"}},{children:"Category Comparison"}))]})),n.jsx("div",e.__assign({style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"}},{children:Object.entries(_).map(function(t){var i=t[0],s=t[1];return n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:4,padding:"3px 10px",borderRadius:20,background:H[i].bg,border:"1px solid ".concat(H[i].border),fontSize:11,fontWeight:600,color:H[i].text,fontFamily:A}},{children:[n.jsx("span",{style:{width:5,height:5,borderRadius:"50%",background:H[i].dot}}),s," ",H[i].label]}),i)})}))]})),n.jsx("div",e.__assign({style:{flex:1,overflowY:"auto",padding:16}},{children:n.jsxs("div",e.__assign({ref:y,style:{display:"grid",gridTemplateColumns:"1fr 140px 1fr",alignItems:"start",gap:"0",position:"relative"}},{children:[n.jsx("svg",e.__assign({style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",zIndex:10}},{children:C.map(function(t,i){var s=(t.x1+t.x2)/2,r=t.y1,o=H[t.relation];return n.jsxs("g",{children:[n.jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:o.border,strokeWidth:"1.5"}),n.jsx("foreignObject",e.__assign({x:s-70,y:r-14,width:"140",height:"28"},{children:n.jsx("div",e.__assign({style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n.jsx(N,{relation:t.relation})}))}))]},i)})})),n.jsxs("div",e.__assign({style:{border:"1.5px dashed #CBD5E1",borderRadius:10,padding:14,display:"flex",flexDirection:"column",gap:14}},{children:[n.jsx("p",e.__assign({style:{margin:"0 0 2px 0",fontSize:13,fontWeight:600,color:p,fontFamily:A}},{children:"Category You're Creating"})),h.map(function(e,t){return n.jsx(O,{ref:function(e){m.current[t]=e},label:e.label,value:e.proposed},t)})]})),n.jsx("div",{}),n.jsxs("div",e.__assign({style:{border:"1.5px dashed #CBD5E1",borderRadius:10,padding:14,display:"flex",flexDirection:"column",gap:14}},{children:[n.jsxs("p",e.__assign({style:{margin:"0 0 2px 0",fontSize:13,fontWeight:600,color:b,fontFamily:A,display:"flex",alignItems:"center",gap:5}},{children:[n.jsx(i.Sparkles,{size:13,color:b}),"Existing Category"]})),h.map(function(e,t){return n.jsx(O,{ref:function(e){j.current[t]=e},label:e.label,value:e.existing},t)})]}))]}))}))]}))]})},K=function(t){var s=t.condition,r=t.index,o=t.isEditing,a=t.editText,c=t.onEditStart,p=t.onEditChange,x=t.onEditSave,f=t.onEditCancel,_=t.onRemove,y=t.readOnly,m=t.onBlurContainer,b={width:40,height:38,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",background:w,borderRight:"1px solid #D0D5DD",color:j,fontSize:14,fontFamily:A};return o?n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:12},onBlur:m},{children:[n.jsxs("div",e.__assign({style:{display:"flex",flex:1,alignItems:"center",background:v,border:"1px solid ".concat(d),borderRadius:E,overflow:"hidden"}},{children:[n.jsx("div",e.__assign({style:b},{children:r+1})),n.jsx("input",{type:"text",value:a,onChange:function(e){return p(e.target.value)},autoFocus:!0,onKeyDown:function(e){"Enter"===e.key&&a.trim()?x():"Escape"===e.key&&f()},style:{flex:1,padding:"8px 11.5px",fontSize:14,fontFamily:A,color:u,border:"none",outline:"none",background:"transparent"}})]})),n.jsx("button",e.__assign({type:"button",disabled:!a.trim(),onClick:x,style:e.__assign(e.__assign({},B),{borderRadius:E,opacity:a.trim()?1:.5,cursor:a.trim()?"pointer":"not-allowed",background:a.trim()?v:w})},{children:n.jsx(i.Check,{size:18,color:k})})),n.jsx("button",e.__assign({type:"button",onClick:f,style:e.__assign(e.__assign({},B),{borderRadius:E})},{children:n.jsx(i.X,{size:18,color:S})}))]})):n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:12}},{children:[n.jsxs("div",e.__assign({style:{display:"flex",flex:1,alignItems:"center",background:v,border:"1px solid #D0D5DD",borderRadius:E,overflow:"hidden",height:38}},{children:[n.jsx("div",e.__assign({style:e.__assign(e.__assign({},b),{height:"100%"})},{children:r+1})),n.jsx("div",e.__assign({style:{flex:1,padding:"0 11.5px",fontSize:14,fontFamily:A,display:"flex",alignItems:"center",height:"100%"}},{children:s.text?n.jsx("span",e.__assign({style:{color:u}},{children:s.text})):n.jsx("span",e.__assign({style:{color:h}},{children:"Enter condition"}))}))]})),!y&&n.jsxs(n.Fragment,{children:[n.jsx("button",e.__assign({type:"button",onClick:c,style:e.__assign(e.__assign({},B),{border:"1px solid ".concat(l),borderRadius:E})},{children:n.jsx(i.Pencil,{size:16,color:z})})),n.jsx("button",e.__assign({type:"button",onClick:_,style:e.__assign(e.__assign({},B),{border:"1px solid ".concat(g),borderRadius:E})},{children:n.jsx(i.Trash2,{size:16,color:S})}))]})]}))},P=function(t){var s=t.title,r=t.required,o=t.isExpanded,a=t.setIsExpanded,d=t.conditions,c=t.prefix,g=t.editingCondKey,p=t.editingCondText,x=t.setEditingCondKey,_=t.setEditingCondText,m=t.onAdd,j=t.onUpdate,v=t.onRemove,w=t.addLabel,C=t.readOnly,F=t.errorMessage,k=t.style,S=d.length>0;return n.jsxs("div",e.__assign({style:e.__assign({border:"1px solid ".concat(l),borderRadius:E,padding:16},k)},{children:[n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:8,cursor:S?"pointer":"default",userSelect:"none"},onClick:function(){S&&a(function(e){return!e})}},{children:[n.jsxs("label",e.__assign({style:e.__assign(e.__assign({},T),{marginBottom:0,cursor:S?"pointer":"default"})},{children:[r&&W,n.jsx("span",{children:s})]})),n.jsx("button",e.__assign({type:"button",style:{background:"none",border:"none",cursor:"pointer",padding:0,display:"flex",alignItems:"center",transform:o?"rotate(0deg)":"rotate(180deg)",transition:"transform 0.2s"}},{children:n.jsx(i.ChevronUp,{size:20,color:S?u:h})}))]})),o&&n.jsxs(n.Fragment,{children:[0===d.length&&n.jsx("p",e.__assign({style:{color:f,fontSize:14,fontStyle:"italic",fontWeight:300,fontFamily:A,margin:"0 0 12px 0"}},{children:"No conditions applied"})),n.jsx("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:12,marginBottom:12}},{children:d.map(function(e,t){var i="".concat(c,"_").concat(e.id);return n.jsx(K,{condition:e,index:t,isEditing:g===i,editText:p,onEditStart:function(){x(i),_(e.text)},onEditChange:_,onEditSave:function(){p.trim()&&(j(e.id,p),x(null))},onEditCancel:function(){e.text?x(null):v(e.id)},onRemove:function(){return v(e.id)},readOnly:C,onBlurContainer:function(n){return function(e,n,t){if(!e.currentTarget.contains(e.relatedTarget)){var i="".concat(c,"_").concat(n);p.trim()||t?p.trim()&&j(n,p):v(n),g===i&&x(null)}}(n,e.id,e.text)}},e.id)})})),!C&&n.jsxs("button",e.__assign({type:"button",onClick:m,style:{display:"flex",alignItems:"center",gap:7,color:b,fontSize:14,fontWeight:500,fontFamily:A,background:"none",border:"none",cursor:"pointer",padding:0}},{children:[n.jsx(i.Plus,{size:16}),w]})),F&&n.jsx("p",e.__assign({style:{marginTop:8,color:y,fontSize:12,fontFamily:A,margin:"8px 0 0 0"}},{children:F}))]})]}))},U=function(s){var r=s.state,o=s.handlers,d=s.uiState,m=r.formData,w=r.nameLabel,H=void 0===w?"Category Name":w,L=r.namePlaceholder,M=void 0===L?"Enter category name":L,N=o.setFormData,O=d.readOnly,K=void 0!==O&&O,U=d.isAiStreaming,X=void 0!==U&&U;d.setActiveEditId,d.setSendMessageInChat;var Y=d.validationErrors,V=void 0===Y?{}:Y,Z=d.addExampleBtnRef,G=d.comparisonData,J=void 0===G?null:G,Q=d.onComparisonClose,$=t.useState(null),ee=$[0],ne=$[1],te=t.useState(""),ie=te[0],se=te[1],re=t.useState(null),oe=re[0],ae=re[1],le=t.useState(""),de=le[0],ce=le[1],ge=t.useState(!0),ue=ge[0],pe=ge[1],xe=t.useState(!0),fe=xe[0],he=xe[1],_e=t.useState(null),ye=_e[0],me=_e[1],be=t.useState(""),je=be[0],ve=be[1],we=t.useState(""),Ce=we[0],Fe=we[1],ke=t.useState([]),Se=ke[0],ze=ke[1],De=t.useState(!1),Ee=De[0],Ae=De[1],Be=t.useRef(null),Re=t.useState(!1),Te=Re[0],Ie=Re[1],We=t.useRef(X);t.useEffect(function(){J?requestAnimationFrame(function(){return Ae(!0)}):Ae(!1)},[J]),t.useEffect(function(){We.current&&!X&&Te&&Ie(!1),We.current=X},[X,Te]);var He=K,Le=t.useCallback(function(n,t){return N(function(i){var s;return e.__assign(e.__assign({},i),((s={})[n]=t,s))})},[N]),Me=function(n){var t=a();N(function(i){var s;return e.__assign(e.__assign({},i),((s={})[n]=e.__spreadArray(e.__spreadArray([],i[n],!0),[{id:t,text:""}],!1),s))}),ae("".concat("whenToApply"===n?"wta":"wnta","_").concat(t)),ce(""),"whenToApply"!==n||ue||pe(!0),"whenNotToApply"!==n||fe||he(!0)},Ne=function(n,t,i){return N(function(s){var r;return e.__assign(e.__assign({},s),((r={})[n]=s[n].map(function(n){return n.id===t?e.__assign(e.__assign({},n),{text:i}):n}),r))})},Oe=function(n,t){return N(function(i){var s;return e.__assign(e.__assign({},i),((s={})[n]=i[n].filter(function(e){return e.id!==t}),s))})},qe=function(n){return ze(function(t){return t.includes(n)?t.filter(function(e){return e!==n}):e.__spreadArray(e.__spreadArray([],t,!0),[n],!1)})},Ke=t.useCallback(function(){var n=a();N(function(t){return e.__assign(e.__assign({},t),{occurrences:e.__spreadArray(e.__spreadArray([],t.occurrences||[],!0),[{id:n,title:"",description:""}],!1)})}),me(n),ve(""),Fe(""),ze(function(t){return e.__spreadArray(e.__spreadArray([],t,!0),[n],!1)})},[N]),Pe=t.useCallback(function(){Ae(!1),setTimeout(function(){null==Q||Q()},280)},[Q]),Ue=function(t){return n.jsxs("button",e.__assign({ref:t?void 0:Z,type:"button",disabled:t,onClick:Ke,style:{display:"flex",alignItems:"center",gap:7,padding:"7px 10.5px",background:"none",border:"none",cursor:t?"not-allowed":"pointer",opacity:t?.5:1,transition:"opacity 0.15s"}},{children:[n.jsx(i.Plus,{size:14,color:b}),n.jsx("span",e.__assign({style:{color:b,fontSize:14,fontWeight:500,fontFamily:A}},{children:"Add example"}))]}))};return n.jsxs("div",e.__assign({style:{flex:1,overflowY:"auto",position:"relative"}},{children:[J&&n.jsx(q,{formData:m,existingData:J,onClose:Pe,visible:Ee}),Te&&X&&n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",color:"#141414",fontSize:13,fontWeight:500,fontStyle:"italic",marginBottom:12,paddingLeft:4,fontFamily:A}},{children:[n.jsx(i.Loader2Icon,{size:16,style:{marginRight:8,animation:"spin 1s linear infinite"}}),"Updating category details..."]})),n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},I),{marginBottom:12})},{children:[n.jsxs("div",e.__assign({style:{marginBottom:12}},{children:[n.jsxs("label",e.__assign({style:T},{children:[W,n.jsx("span",{children:H})]})),He&&"name"!==ee?n.jsx("div",e.__assign({style:{display:"flex",alignItems:"center",gap:12}},{children:n.jsx("div",e.__assign({style:{flex:1,padding:"10px 14px",border:"1px solid #D0D5DD",borderRadius:D,fontSize:14,background:v,minHeight:42,display:"flex",alignItems:"center"}},{children:m.name?n.jsx("span",e.__assign({style:{color:u}},{children:m.name})):n.jsx("span",e.__assign({style:{color:_}},{children:M}))}))})):He&&"name"===ee?n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:12}},{children:[n.jsx("input",{type:"text",value:ie,onChange:function(e){return se(e.target.value)},autoFocus:!0,onKeyDown:function(e){"Enter"===e.key?(Le("name",ie),ne(null)):"Escape"===e.key&&ne(null)},placeholder:M,style:e.__assign(e.__assign({},R),{flex:1,width:"auto",border:"1px solid ".concat(c)})}),n.jsx("button",e.__assign({type:"button",onClick:function(){Le("name",ie),ne(null)},style:B},{children:n.jsx(i.Check,{size:18,color:k})})),n.jsx("button",e.__assign({type:"button",onClick:function(){return ne(null)},style:B},{children:n.jsx(i.X,{size:18,color:S})}))]})):n.jsx("input",{type:"text",value:m.name,onChange:function(e){return Le("name",e.target.value)},placeholder:M,disabled:X,style:e.__assign(e.__assign({},R),{opacity:X?.6:1,cursor:X?"not-allowed":"text"})}),(null==V?void 0:V.name)&&n.jsx("p",e.__assign({style:{marginTop:4,color:y,fontSize:12,fontFamily:A,margin:"4px 0 0 0"}},{children:V.name}))]})),n.jsxs("div",e.__assign({style:{marginBottom:12}},{children:[n.jsxs("label",e.__assign({style:T},{children:[W,n.jsx("span",{children:"Category Description"})]})),He&&"description"!==ee?n.jsx("div",e.__assign({style:{display:"flex",alignItems:"flex-start",gap:12}},{children:n.jsx("div",e.__assign({style:{flex:1,padding:"12px 14px",border:"1px solid #D0D5DD",borderRadius:D,fontSize:14,background:v,minHeight:80}},{children:m.description?n.jsx("span",e.__assign({style:{color:u,whiteSpace:"pre-wrap"}},{children:m.description})):n.jsx("span",e.__assign({style:{color:_}},{children:"Describe when this category should be applied"}))}))})):He&&"description"===ee?n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"flex-start",gap:12}},{children:[n.jsx("textarea",{value:ie,onChange:function(e){return se(e.target.value)},autoFocus:!0,onKeyDown:function(e){"Escape"===e.key&&ne(null)},placeholder:"Enter Description",rows:4,style:e.__assign(e.__assign({},R),{flex:1,width:"auto",border:"1px solid ".concat(c),resize:"none",lineHeight:"140%"})}),n.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:8}},{children:[n.jsx("button",e.__assign({type:"button",onClick:function(){Le("description",ie),ne(null)},style:B},{children:n.jsx(i.Check,{size:18,color:k})})),n.jsx("button",e.__assign({type:"button",onClick:function(){return ne(null)},style:B},{children:n.jsx(i.X,{size:18,color:S})}))]}))]})):n.jsx("textarea",{value:m.description,onChange:function(e){return Le("description",e.target.value)},placeholder:"Describe when this category should be applied.",disabled:X,style:e.__assign(e.__assign({},R),{height:60,paddingTop:7,paddingBottom:10.5,border:"1px solid ".concat(l),lineHeight:"140%",resize:"none",boxShadow:"0 1px 2px 0 rgba(18,18,23,0.05)",opacity:X?.6:1,cursor:X?"not-allowed":"text"})}),(null==V?void 0:V.description)&&n.jsx("p",e.__assign({style:{marginTop:4,color:y,fontSize:12,fontFamily:A,margin:"4px 0 0 0"}},{children:V.description}))]})),n.jsx(P,{title:"When to Apply",required:!0,isExpanded:ue,setIsExpanded:pe,conditions:m.whenToApply,prefix:"wta",editingCondKey:oe,editingCondText:de,setEditingCondKey:ae,setEditingCondText:ce,onAdd:function(){return Me("whenToApply")},onUpdate:function(e,n){return Ne("whenToApply",e,n)},onRemove:function(e){return Oe("whenToApply",e)},addLabel:"Add When to Apply",readOnly:X||K,errorMessage:null==V?void 0:V.whenToApply,style:{marginBottom:12}}),n.jsx(P,{title:"When NOT to Apply",required:!1,isExpanded:fe,setIsExpanded:he,conditions:m.whenNotToApply,prefix:"wnta",editingCondKey:oe,editingCondText:de,setEditingCondKey:ae,setEditingCondText:ce,onAdd:function(){return Me("whenNotToApply")},onUpdate:function(e,n){return Ne("whenNotToApply",e,n)},onRemove:function(e){return Oe("whenNotToApply",e)},addLabel:"Add When NOT to Apply",readOnly:X||K,errorMessage:null==V?void 0:V.whenNotToApply})]})),n.jsxs("div",e.__assign({style:e.__assign(e.__assign({},I),{marginTop:12})},{children:[n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12}},{children:[n.jsxs("div",{children:[n.jsxs("h4",e.__assign({style:{color:p,fontSize:14,fontWeight:500,lineHeight:"120%",letterSpacing:"0.02em",fontFamily:A,margin:"0 0 4px 0"}},{children:["Example (",(m.occurrences||[]).length,")"]})),n.jsx("p",e.__assign({style:{color:f,fontSize:12,fontWeight:300,lineHeight:"120%",letterSpacing:"0.02em",fontFamily:A,margin:0}},{children:"Add real examples to help the system understand this category"}))]}),(m.occurrences||[]).length>0&&!K&&Ue(null!==ye||X)]})),0===(m.occurrences||[]).length?n.jsxs("div",e.__assign({style:{border:"1px solid ".concat(l),borderRadius:E,background:v,padding:"24px 12px 12px",minHeight:181,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}},{children:[n.jsx("div",e.__assign({style:{marginBottom:16}},{children:n.jsxs("svg",e.__assign({xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 56 56",fill:"none"},{children:[n.jsx("rect",{x:"4",y:"4",width:"48",height:"48",rx:"24",fill:"#F1F5F9"}),n.jsx("rect",{x:"4",y:"4",width:"48",height:"48",rx:"24",stroke:"#F8FAFC",strokeWidth:"8"}),n.jsx("rect",{width:"24",height:"24",transform:"translate(16 16)",fill:"#F1F5F9"}),n.jsx("path",{d:"M25 19.5V18M21.0607 21.0607L20 20M21.0607 29L20 30.0607M29 21.0607L30.0607 20M19.5 25H18M31.8645 32.1896L29.3727 36.817C29.0881 37.3457 28.9457 37.61 28.7745 37.6769C28.6259 37.7349 28.4585 37.7185 28.324 37.6328C28.1689 37.534 28.0806 37.2471 27.9038 36.6733L24.4452 25.4453C24.3008 24.9765 24.2286 24.7421 24.2867 24.5838C24.3373 24.446 24.446 24.3373 24.5838 24.2867C24.7421 24.2286 24.9765 24.3008 25.4452 24.4452L36.6732 27.9038C37.247 28.0806 37.5339 28.169 37.6327 28.324C37.7185 28.4586 37.7348 28.6259 37.6768 28.7745C37.61 28.9458 37.3456 29.0881 36.817 29.3728L32.1896 31.8645C32.111 31.9068 32.0717 31.9279 32.0374 31.9551C32.0068 31.9792 31.9792 32.0068 31.9551 32.0374C31.9279 32.0717 31.9068 32.111 31.8645 32.1896Z",stroke:"#475569",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))})),n.jsx("p",e.__assign({style:{color:x,fontSize:12,fontWeight:500,lineHeight:"120%",fontFamily:A,margin:"0 0 8px 0"}},{children:"No example added yet"})),n.jsx("p",e.__assign({style:{color:f,fontSize:14,fontWeight:300,lineHeight:"140%",fontFamily:A,margin:"0 0 8px 0",maxWidth:530}},{children:"Add an example to show how this category is used, or generate one using chat."})),!K&&Ue(null!==ye||X)]})):n.jsx("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:12}},{children:(m.occurrences||[]).map(function(t,s){var r=Se.includes(t.id);return ye===t.id?n.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:12,border:"1px solid ".concat(l),borderRadius:E,background:v,padding:16,boxShadow:"0 1px 3px rgba(0,0,0,0.07)"}},{children:[n.jsxs("div",{children:[n.jsx("label",e.__assign({style:e.__assign(e.__assign({},T),{marginBottom:8})},{children:n.jsx("span",e.__assign({style:{color:x}},{children:"Title/Subject"}))})),n.jsx("input",{type:"text",value:je,onChange:function(e){return ve(e.target.value)},placeholder:"e.g., Follow-up on client feedback from last meeting",style:e.__assign(e.__assign({},R),{border:"1px solid ".concat(l),lineHeight:"140%"})})]}),n.jsxs("div",{children:[n.jsxs("label",e.__assign({style:{display:"flex",alignItems:"center",gap:4,marginBottom:8}},{children:[n.jsx("span",e.__assign({style:{color:x,fontSize:14,fontWeight:500,fontFamily:A}},{children:"Message body"})),W]})),n.jsx("textarea",{ref:function(e){e&&ye===t.id&&!Be.current&&(Be.current=e),e&&(e.style.height="auto",e.style.height="".concat(e.scrollHeight,"px"))},value:Ce,onChange:function(e){Fe(e.target.value),e.target.style.height="auto",e.target.style.height="".concat(e.target.scrollHeight,"px")},placeholder:"e.g., Hi, here's the latest update on the project. Let us know if you have any questions.",rows:1,style:e.__assign(e.__assign({},R),{border:"1px solid ".concat(l),overflow:"hidden",minHeight:60,lineHeight:"140%",resize:"none"})})]}),n.jsxs("div",e.__assign({style:{display:"flex",justifyContent:"flex-end",gap:12,marginTop:4}},{children:[n.jsx("button",e.__assign({type:"button",onClick:function(){t.title||t.description||N(function(n){return e.__assign(e.__assign({},n),{occurrences:(n.occurrences||[]).filter(function(e){return e.id!==t.id})})}),me(null),Be.current=null},style:{padding:"6px 12px",color:j,fontSize:14,fontWeight:500,lineHeight:"140%",fontFamily:A,background:"none",border:"none",cursor:"pointer",borderRadius:D}},{children:"Cancel"})),n.jsx("button",e.__assign({type:"button",disabled:!Ce.trim(),onClick:function(){var n;Ce.trim()&&(n=t.id,N(function(t){return e.__assign(e.__assign({},t),{occurrences:t.occurrences.map(function(t){return t.id===n?e.__assign(e.__assign({},t),{title:je,description:Ce}):t})})}),me(null),Be.current=null,ze(function(e){return e.filter(function(e){return e!==t.id})}))},style:{padding:"6px 12px",borderRadius:D,fontSize:14,fontWeight:500,lineHeight:"140%",fontFamily:A,cursor:Ce.trim()?"pointer":"not-allowed",background:Ce.trim()?F:v,border:"1px solid ".concat(Ce.trim()?F:"#E2E8F0"),color:Ce.trim()?b:h,transition:"background 0.15s"}},{children:"Save"}))]}))]}),t.id):n.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",border:"1px solid #E2E8F0",borderRadius:E,background:v,overflow:"hidden",boxShadow:"0 1px 3px rgba(0,0,0,0.07)"}},{children:[n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:12,padding:12}},{children:[n.jsx("div",e.__assign({style:{width:20,height:20,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",background:C,borderRadius:D,color:j,fontSize:10,fontWeight:500,fontFamily:A}},{children:s+1})),n.jsx("div",e.__assign({style:{flex:1,fontSize:15,fontWeight:500,lineHeight:"140%",fontFamily:A,color:x,wordBreak:"break-word"}},{children:t.title||n.jsx("span",e.__assign({style:{color:h,fontWeight:400,fontSize:14}},{children:"Untitled example"}))})),n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:8,flexShrink:0}},{children:[!K&&n.jsxs(n.Fragment,{children:[n.jsx("button",e.__assign({type:"button",disabled:null!==ye||X,onClick:function(){me(t.id),ve(t.title),Fe(t.description),r||qe(t.id)},style:e.__assign(e.__assign({},B),{width:36,height:36,border:"1px solid #E2E8F0",borderRadius:D,opacity:null!==ye||X?.5:1,cursor:null!==ye||X?"not-allowed":"pointer"})},{children:n.jsx(i.Pencil,{size:16,color:z})})),n.jsx("button",e.__assign({type:"button",disabled:null!==ye||X,onClick:function(){return N(function(n){return e.__assign(e.__assign({},n),{occurrences:(n.occurrences||[]).filter(function(e){return e.id!==t.id})})})},style:e.__assign(e.__assign({},B),{width:36,height:36,border:"1px solid ".concat(g),borderRadius:D,opacity:null!==ye||X?.5:1,cursor:null!==ye||X?"not-allowed":"pointer"})},{children:n.jsx(i.Trash2,{size:16,color:S})}))]}),n.jsx("button",e.__assign({type:"button",onClick:function(){return qe(t.id)},style:e.__assign(e.__assign({},B),{width:36,height:36,border:"none",background:"transparent"})},{children:r?n.jsx(i.ChevronUp,{size:20,color:z}):n.jsx(i.ChevronDown,{size:20,color:z})}))]}))]})),r&&n.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",padding:"4px 12px 16px"}},{children:[n.jsxs("div",e.__assign({style:{marginBottom:12}},{children:[n.jsx("p",e.__assign({style:{color:f,fontSize:13,lineHeight:"140%",fontFamily:A,margin:"0 0 4px 0"}},{children:"Title/Subject:"})),n.jsx("p",e.__assign({style:{color:p,fontSize:14,fontWeight:300,lineHeight:"150%",fontFamily:A,whiteSpace:"pre-wrap",wordBreak:"break-word",margin:0}},{children:t.title||n.jsx("span",e.__assign({style:{color:h,fontStyle:"italic"}},{children:"—"}))}))]})),n.jsxs("div",{children:[n.jsx("p",e.__assign({style:{color:f,fontSize:13,lineHeight:"140%",fontFamily:A,margin:"0 0 4px 0"}},{children:"Message body:"})),n.jsx("p",e.__assign({style:{color:p,fontSize:14,fontWeight:300,lineHeight:"150%",fontFamily:A,whiteSpace:"pre-wrap",wordBreak:"break-word",margin:0}},{children:t.description}))]})]}))]}),t.id)})}))]}))]}))};exports.CreateCategory=U,exports.default=U;
2
- //# sourceMappingURL=CreateCategory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CreateCategory.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("tslib"),e=require("react/jsx-runtime"),n=require("react"),t=require("../../organisms/ConditionSection/ConditionSection.js"),o=require("../../organisms/TextSection/TextSection.js");exports.WorkflowComposer=function(l){var r,d,s,u=l.state,a=l.handlers,p=l.uiState,g=(null==p?void 0:p.highlights)||{},h=n.useState({}),c=h[0],v=h[1],y=function(e){v(function(n){var t;return i.__assign(i.__assign({},n),((t={})[e]=!n[e],t))})},T=function(i){var e,n=null===(e=u.fieldCitations)||void 0===e?void 0:e[i];return Array.isArray(n)&&n.length>0?n:u.citations};return e.jsx("div",i.__assign({className:"simple-guideline-template"},{children:e.jsxs("div",i.__assign({style:{display:"flex",flexDirection:"column",gap:"20px"}},{children:[e.jsx(o.TextSection,i.__assign({id:"guideline-title",title:"Guideline Title",rows:1,placeholder:"Enter a short, descriptive title for the guideline",required:!0,value:u.guidelineTitle,onChange:a.setGuidelineTitle,readOnly:null==p?void 0:p.isAiStreaming,isOpen:c.guidelineTitle,onToggle:function(){return y("guidelineTitle")},isHighlighted:g.guidelineTitle||!1,tooltipDescription:"Why this Title?",errorMessage:null===(r=null==p?void 0:p.validationErrors)||void 0===r?void 0:r.guidelineTitle},p)),e.jsx(o.TextSection,i.__assign({id:"guideline-description",title:"Guideline Description",rows:4,placeholder:"Describe what this guideline enforces or ensures",required:!0,value:u.guidelineDescription,onChange:a.setGuidelineDescription,readOnly:null==p?void 0:p.isAiStreaming,isOpen:c.guidelineDescription,onToggle:function(){return y("guidelineDescription")},isHighlighted:g.guidelineDescription||!1,tooltipDescription:"Why this Description?",errorMessage:null===(d=null==p?void 0:p.validationErrors)||void 0===d?void 0:d.guidelineDescription},p)),e.jsx(t.ConditionSection,i.__assign({id:"when-to-apply",title:"When to apply",required:!0,dividerRequired:!0,readOnly:null==p?void 0:p.isAiStreaming,conditions:u.whenToApplyConditions||[],onAdd:function(){return a.addWhenToApply()},onRemove:function(i,e,n){return a.removeWhenToApply(n)},onEdit:function(i,e,n,t){return a.editWhenToApply(n,t)},index:0,tierKey:"default",isHighlighted:g.wta||!1,highlightedIds:null==p?void 0:p.highlightedIds,tooltipDescription:"Why this Condition?",citations:T("whenToApply"),bordered:!0,addLabel:"Add When to apply",isAiStreaming:null==p?void 0:p.isAiStreaming,errorMessage:null===(s=null==p?void 0:p.validationErrors)||void 0===s?void 0:s.whenToApply},p)),e.jsx(t.ConditionSection,i.__assign({id:"when-not-to-apply",title:"When NOT to apply",required:!1,dividerRequired:!0,readOnly:null==p?void 0:p.isAiStreaming,conditions:u.whenNotToApplyConditions||[],onAdd:function(){return a.addWhenNotToApply()},onRemove:function(i,e,n){return a.removeWhenNotToApply(n)},onEdit:function(i,e,n,t){return a.editWhenNotToApply(n,t)},index:0,tierKey:"default",isHighlighted:g.wnta||!1,highlightedIds:null==p?void 0:p.highlightedIds,tooltipDescription:"Why this Condition?",citations:T("whenNotToApply"),bordered:!0,addLabel:"Add When NOT to apply",isAiStreaming:null==p?void 0:p.isAiStreaming},p))]}))}))};
2
- //# sourceMappingURL=WorkflowComposer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"WorkflowComposer.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- import{__assign as i}from"tslib";import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as n}from"react";import{TextSection as o}from"../../organisms/TextSection/TextSection.js";import{ScopeSection as d}from"../../organisms/ScopeSection/ScopeSection.js";import{ConditionSection as l}from"../../organisms/ConditionSection/ConditionSection.js";import{ConfigSection as s}from"../../organisms/ConfigSection/ConfigSection.js";import{InputDataReasoningCard as a}from"../../InputDataReasoningCard.js";import{ButtonCognitiveIcon as r}from"../../_svg/ButtonCognitiveIcon.js";var c=function(c){var p,h,g,v,u,m,I,f,E,b,y,A,S,C,T,N,w,W,L,O,D,M,x,P,R,j,q,V,H,K,z,B,_,k=c.state,F=c.handlers,G=c.uiState,J=c.customNodes,Q=void 0===J?{}:J,U=n({}),X=U[0],Y=U[1],Z=n(new Set),$=Z[0],ii=Z[1],ei=function(e){Y(function(t){var n;return i(i({},t),((n={})[e]=!t[e],n))})},ti=function(i){var e,t=null===(e=k.fieldCitations)||void 0===e?void 0:e[i];return Array.isArray(t)&&t.length>0?t:k.citations||[]},ni={marginTop:"-17px",position:"relative",zIndex:1},oi=function(i){return!!G.isAiStreaming||(!!G.isReadOnly||!(!G.activeEditId||G.activeEditId.startsWith(i)))};return e("div",i({className:"base-template-container",style:{display:"flex",flexDirection:"column",gap:"16px",width:"100%"}},{children:[Q.top&&t("div",i({className:"custom-slot-top"},{children:Q.top})),e("div",i({className:"template-section"},{children:[t(o,{id:"base-title",title:G.titleLabel||"Title",fieldName:G.titleLabel||"Title",rows:1,placeholder:"Enter a descriptive title",required:!0,value:k.title||"",onChange:F.onTitleChange,readOnly:oi("base-title"),isOpen:X.title,onToggle:function(){return ei("title")},isHighlighted:(null===(p=G.highlights)||void 0===p?void 0:p.get("title"))||!1,showCognitiveIcon:!!(null===(h=k.citation)||void 0===h?void 0:h.title),tooltipDescription:"Why this ".concat(G.titleLabel||"Title","?"),errorMessage:null===(g=G.validationErrors)||void 0===g?void 0:g.title,enableInlineEdit:!0,setSendMessageInChat:G.setSendMessageInChat,activeEditId:null!==(v=G.activeEditId)&&void 0!==v?v:null,setActiveEditId:G.setActiveEditId,pendingEditId:null!==(u=G.pendingEditId)&&void 0!==u?u:null,setPendingEditId:G.setPendingEditId}),(null===(m=k.citation)||void 0===m?void 0:m.title)&&t("div",i({style:ni},{children:t(a,{isVisible:X.title,citation:k.citation.title,citations:ti("title"),fieldName:G.titleLabel||"Title",fieldValue:k.title||""})}))]})),Q.afterTitle&&t("div",i({className:"custom-slot"},{children:Q.afterTitle})),G.showScope&&e("div",i({className:"template-section"},{children:[t(d,{id:"base-scope",title:G.scopeLabel||"",required:!1,scopeData:k.scopeData||{},onScopeChange:F.onScopeChange,openSections:$,setOpenSections:ii,stationOptions:G.stationOptions||[],tierOptions:G.tierOptions||[],tierLabel:G.tierLabel||"Where should this apply?",stationLabel:G.stationLabel||"Which scope should this belong to?",highlights:(null===(I=G.highlights)||void 0===I?void 0:I.get("scope"))||{},isOpen:X.scope,onToggle:function(){return ei("scope")},showCognitiveIcon:!!(null===(f=k.citation)||void 0===f?void 0:f.scope),cognitiveIcon:t(r,{}),tooltipDescription:"Why this Scope?",errorMessage:(null===(E=G.validationErrors)||void 0===E?void 0:E.station)||(null===(b=G.validationErrors)||void 0===b?void 0:b.tiers),stationErrorMessage:null===(y=G.validationErrors)||void 0===y?void 0:y.station,tierErrorMessage:null===(A=G.validationErrors)||void 0===A?void 0:A.tiers,readOnly:oi("base-scope")}),(null===(S=k.citation)||void 0===S?void 0:S.scope)&&t("div",i({style:ni},{children:t(a,{isVisible:X.scope,citation:k.citation.scope,citations:ti("scope"),fieldName:"Scope",fieldValue:(null===(T=null===(C=k.scopeData)||void 0===C?void 0:C.tiers)||void 0===T?void 0:T.join(", "))||""})}))]})),Q.afterScope&&t("div",i({className:"custom-slot"},{children:Q.afterScope})),e("div",i({className:"template-section"},{children:[t(o,{id:"base-description",title:G.descriptionLabel||"Description",fieldName:G.descriptionLabel||"Description",rows:3,placeholder:"Explain the behaviour or learning",required:!0,value:k.description||"",onChange:F.onDescriptionChange,readOnly:oi("base-description"),isOpen:X.description,onToggle:function(){return ei("description")},isHighlighted:(null===(N=G.highlights)||void 0===N?void 0:N.get("description"))||!1,showCognitiveIcon:!!(null===(w=k.citation)||void 0===w?void 0:w.description),tooltipDescription:"Why this ".concat(G.descriptionLabel||"Description","?"),errorMessage:null===(W=G.validationErrors)||void 0===W?void 0:W.description,enableInlineEdit:!0,setSendMessageInChat:G.setSendMessageInChat,activeEditId:null!==(L=G.activeEditId)&&void 0!==L?L:null,setActiveEditId:G.setActiveEditId,pendingEditId:null!==(O=G.pendingEditId)&&void 0!==O?O:null,setPendingEditId:G.setPendingEditId}),(null===(D=k.citation)||void 0===D?void 0:D.description)&&t("div",i({style:ni},{children:t(a,{isVisible:X.description,citation:k.citation.description,citations:ti("description"),fieldName:G.descriptionLabel||"Description",fieldValue:k.description||""})}))]})),Q.afterDescription&&t("div",i({className:"custom-slot"},{children:Q.afterDescription})),t("div",i({className:"template-section"},{children:t(l,{id:"condition-wta-base",idPrefix:"condition-wta",title:G.whenToApplyLabel||"When to apply",required:!0,dividerRequired:!0,readOnly:oi("condition-wta"),conditions:k.whenToApplyConditions||[],onAdd:F.onAddWhenToApply,onRemove:function(i,e,t){return F.onRemoveWhenToApply(t)},onEdit:function(i,e,t,n){return F.onEditWhenToApply(t,n)},isHighlighted:(null===(M=G.highlights)||void 0===M?void 0:M.get("wta"))||!1,highlightedIds:G.highlightedIds,tooltipDescription:"Why this Condition?",citations:ti("whenToApply"),bordered:!0,addLabel:"Add ".concat(G.whenToApplyLabel||"When to apply"),isAiStreaming:G.isAiStreaming,errorMessage:(null===(x=G.validationErrors)||void 0===x?void 0:x.whenToApply)||G.conflictReason,index:0,tierKey:"base",activeEditId:null!==(P=G.activeEditId)&&void 0!==P?P:null,setActiveEditId:G.setActiveEditId,pendingEditId:null!==(R=G.pendingEditId)&&void 0!==R?R:null,setPendingEditId:G.setPendingEditId,setSendMessageInChat:G.setSendMessageInChat})})),Q.afterWhenToApply&&t("div",i({className:"custom-slot"},{children:Q.afterWhenToApply})),t("div",i({className:"template-section"},{children:t(l,{id:"condition-wnta-base",idPrefix:"condition-wnta",title:G.whenNotToApplyLabel||"When NOT to apply",required:!1,dividerRequired:!0,readOnly:oi("condition-wnta"),conditions:k.whenNotToApplyConditions||[],onAdd:F.onAddWhenNotToApply,onRemove:function(i,e,t){return F.onRemoveWhenToApply(t)},onEdit:function(i,e,t,n){return F.onEditWhenNotToApply(t,n)},isHighlighted:(null===(j=G.highlights)||void 0===j?void 0:j.get("wnta"))||!1,highlightedIds:G.highlightedIds,tooltipDescription:"Why this Condition?",citations:ti("whenNotToApply"),bordered:!0,addLabel:"Add ".concat(G.whenNotToApplyLabel||"When NOT to apply"),isAiStreaming:G.isAiStreaming,errorMessage:null===(q=G.validationErrors)||void 0===q?void 0:q.whenNotToApply,index:0,tierKey:"base",activeEditId:null!==(V=G.activeEditId)&&void 0!==V?V:null,setActiveEditId:G.setActiveEditId,pendingEditId:null!==(H=G.pendingEditId)&&void 0!==H?H:null,setPendingEditId:G.setPendingEditId,setSendMessageInChat:G.setSendMessageInChat})})),Q.afterWhenNotToApply&&t("div",i({className:"custom-slot"},{children:Q.afterWhenNotToApply})),G.showConfiguration&&e("div",i({className:"template-section"},{children:[t(s,{id:"base-config",title:G.configLabel||"Configuration",required:!1,highlights:(null===(K=G.highlights)||void 0===K?void 0:K.get("config"))||{},bordered:!0,readOnly:oi("base-config"),onConfigChange:function(i,e){var t;return null===(t=F.onConfigChange)||void 0===t?void 0:t.call(F,i,e)},separationItems:G.separationItems||[],toggles:G.toggles||[],index:0,openSections:$,setOpenSections:ii,activeEditId:null!==(z=G.activeEditId)&&void 0!==z?z:null,setActiveEditId:G.setActiveEditId,pendingEditId:null!==(B=G.pendingEditId)&&void 0!==B?B:null,setPendingEditId:G.setPendingEditId,isAiStreaming:G.isAiStreaming,setSendMessageInChat:G.setSendMessageInChat}),(null===(_=k.citation)||void 0===_?void 0:_.config)&&t("div",i({style:ni},{children:t(a,{isVisible:X.config,citation:k.citation.config,citations:ti("config"),fieldName:G.configLabel||"Configuration",fieldValue:"Proposed Configuration"})}))]})),Q.bottom&&t("div",i({className:"custom-slot-bottom"},{children:Q.bottom}))]}))};export{c as BaseTemplate};
2
- //# sourceMappingURL=BaseTemplate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BaseTemplate.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- import{__assign as e,__spreadArray as t}from"tslib";import{jsx as n,jsxs as i,Fragment as o}from"react/jsx-runtime";import r,{useState as l,useRef as a,useEffect as d,useCallback as c,useMemo as s}from"react";import{Loader2Icon as p,Check as u,X as f,Pencil as h,Trash2 as g,ChevronUp as y,ChevronDown as x,ArrowLeft as m,Sparkles as b,Plus as v}from"lucide-react";var w=0,C=function(){return"cond-".concat(Date.now(),"-").concat(++w)},F="#CBD5E1",k="#9B8AFB",S="#7C3AED",z="#FDA29B",D="#344054",E="#1E293B",A="#334155",B="#64748B",R="#94A3B8",T="#98A2B3",I="#F04438",W="#8F2C23",H="#5925DC",j="#475569",L="#FFFFFF",M="#F8FAFC",N="#F1F5F9",_="#F9F5FF",O="#17B26A",K="#F04438",q="#64748B",U="6px",Y="8px",P="Inter, sans-serif",X={width:38,height:38,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid #D0D5DD",borderRadius:U,cursor:"pointer",background:L,flexShrink:0,transition:"background 0.15s"},V={width:"100%",boxSizing:"border-box",padding:"8px 11.5px",border:"1px solid #D0D5DD",borderRadius:U,fontSize:14,fontWeight:400,lineHeight:"100%",fontFamily:P,outline:"none",color:D,background:L},Z={display:"flex",alignItems:"center",gap:4,marginBottom:8,color:D,fontSize:14,fontWeight:500,lineHeight:"130%",fontFamily:P},G={background:L,border:"1px solid ".concat(F),borderRadius:Y,padding:16},J=n("span",e({style:{color:W,fontSize:12,lineHeight:1,display:"inline-flex",transform:"translateY(0.5px)"}},{children:"*"})),Q={exact_match:{label:"Exact Match",bg:"#F0FDF4",border:"#BBF7D0",text:"#166534",dot:"#22C55E"},conflict:{label:"Conflict",bg:"#FEF2F2",border:"#FECACA",text:"#991B1B",dot:"#EF4444"},partial_overlap:{label:"Partial Match",bg:"#FFF7ED",border:"#FED7AA",text:"#92400E",dot:"#F97316"},new_field:{label:"New",bg:"#F5F3FF",border:"#DDD6FE",text:"#5925DC",dot:"#7C3AED"}},$=function(e){return e?Array.isArray(e)?e.filter(Boolean).join("\n"):e:""},ee=function(e,t){if(!t&&!e)return"exact_match";if(!t)return"new_field";if(!e)return"new_field";var n=function(e){return e.trim().toLowerCase()};if(n(e)===n(t))return"exact_match";var i=new Set(n(e).split(/\s+/)),o=new Set(n(t).split(/\s+/));return Array.from(i).filter(function(e){return o.has(e)}).length/Math.max(i.size,o.size)>=.45?"partial_overlap":"conflict"},te=function(t){var o=t.relation,r=Q[o];return i("div",e({style:{display:"inline-flex",alignItems:"center",gap:4,padding:"3px 9px",borderRadius:20,background:r.bg,border:"1px solid ".concat(r.border),fontSize:10,fontWeight:600,color:r.text,fontFamily:P,whiteSpace:"nowrap",flexShrink:0}},{children:[n("span",{style:{width:5,height:5,borderRadius:"50%",background:r.dot,flexShrink:0}}),r.label]}))},ne=r.forwardRef(function(t,o){var r=t.label,l=t.value;return i("div",e({ref:o,style:{display:"flex",flexDirection:"column"}},{children:[n("p",e({style:{margin:"0 0 5px 0",fontSize:12,color:B,fontFamily:P}},{children:r})),n("div",e({style:{flex:1,padding:"9px 12px",borderRadius:Y,background:"#FFF3F2",border:"1px solid ".concat("#FECACA"),fontSize:13,lineHeight:"150%",color:l?E:R,fontFamily:P,fontStyle:l?"normal":"italic",wordBreak:"break-word",whiteSpace:"pre-wrap",minHeight:37}},{children:l||"—"}))]}))});ne.displayName="FieldCell";var ie=function(t){var r=t.formData,p=t.existingData,u=t.onClose,f=t.visible,h=r.whenToApply.map(function(e){return e.text}).filter(Boolean).join("\n"),g=r.whenNotToApply.map(function(e){return e.text}).filter(Boolean).join("\n"),y=$(p.whenToApply),x=$(p.whenNotToApply),v=s(function(){return[{label:"Title",proposed:r.name,existing:p.name||"",relation:ee(r.name,p.name||"")},{label:"Description",proposed:r.description,existing:p.description||"",relation:ee(r.description,p.description||"")},{label:"When to apply",proposed:h,existing:y,relation:ee(h,y)},{label:"When NOT to Apply",proposed:g,existing:x,relation:g?ee(g,x):x?"new_field":"exact_match"}]},[r.name,r.description,h,g,p.name,p.description,y,x]),w=v.reduce(function(e,t){return e[t.relation]=(e[t.relation]||0)+1,e},{}),C=a(null),k=a([]),S=a([]),z=l([]),D=z[0],B=z[1];k.current=[],S.current=[];var R=c(function(){if(C.current){var e=C.current.getBoundingClientRect(),t=[];v.forEach(function(n,i){var o=k.current[i],r=S.current[i];if(o&&r){o.style.height="auto",r.style.height="auto";var l=o.getBoundingClientRect(),a=r.getBoundingClientRect(),d=Math.max(l.height,a.height);o.style.height="".concat(d,"px"),r.style.height="".concat(d,"px");var c=o.getBoundingClientRect(),s=r.getBoundingClientRect(),p=c.top+c.height/2-e.top;t.push({x1:c.right-e.left,y1:p,x2:s.left-e.left,y2:p,relation:n.relation})}}),B(t)}},[v]);return d(function(){var e=setTimeout(R,150);window.addEventListener("resize",R);var t=null;return C.current&&(t=new ResizeObserver(function(){window.requestAnimationFrame(function(){return R()})})).observe(C.current),function(){clearTimeout(e),window.removeEventListener("resize",R),t&&t.disconnect()}},[R,f]),i(o,{children:[n("div",{onClick:u,style:{position:"absolute",inset:0,background:"rgba(15,23,42,0.18)",zIndex:10,opacity:f?1:0,transition:"opacity 0.25s ease",pointerEvents:f?"auto":"none"}}),i("div",e({style:{position:"absolute",inset:0,background:L,zIndex:11,display:"flex",flexDirection:"column",transform:f?"translateX(0)":"translateX(100%)",transition:"transform 0.28s cubic-bezier(0.4,0,0.2,1)",borderRadius:Y,overflow:"hidden"}},{children:[i("div",e({style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid ".concat(F),flexShrink:0,background:L}},{children:[i("div",e({style:{display:"flex",alignItems:"center",gap:10}},{children:[n("button",e({type:"button",onClick:u,style:e(e({},X),{width:32,height:32,border:"1px solid ".concat(F),borderRadius:U})},{children:n(m,{size:15,color:A})})),n("span",e({style:{fontSize:15,fontWeight:600,color:E,fontFamily:P,letterSpacing:"-0.01em"}},{children:"Category Comparison"}))]})),n("div",e({style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"}},{children:Object.entries(w).map(function(t){var o=t[0],r=t[1];return i("div",e({style:{display:"flex",alignItems:"center",gap:4,padding:"3px 10px",borderRadius:20,background:Q[o].bg,border:"1px solid ".concat(Q[o].border),fontSize:11,fontWeight:600,color:Q[o].text,fontFamily:P}},{children:[n("span",{style:{width:5,height:5,borderRadius:"50%",background:Q[o].dot}}),r," ",Q[o].label]}),o)})}))]})),n("div",e({style:{flex:1,overflowY:"auto",padding:16}},{children:i("div",e({ref:C,style:{display:"grid",gridTemplateColumns:"1fr 140px 1fr",alignItems:"start",gap:"0",position:"relative"}},{children:[n("svg",e({style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",zIndex:10}},{children:D.map(function(t,o){var r=(t.x1+t.x2)/2,l=t.y1,a=Q[t.relation];return i("g",{children:[n("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:a.border,strokeWidth:"1.5"}),n("foreignObject",e({x:r-70,y:l-14,width:"140",height:"28"},{children:n("div",e({style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n(te,{relation:t.relation})}))}))]},o)})})),i("div",e({style:{border:"1.5px dashed #CBD5E1",borderRadius:10,padding:14,display:"flex",flexDirection:"column",gap:14}},{children:[n("p",e({style:{margin:"0 0 2px 0",fontSize:13,fontWeight:600,color:E,fontFamily:P}},{children:"Category You're Creating"})),v.map(function(e,t){return n(ne,{ref:function(e){k.current[t]=e},label:e.label,value:e.proposed},t)})]})),n("div",{}),i("div",e({style:{border:"1.5px dashed #CBD5E1",borderRadius:10,padding:14,display:"flex",flexDirection:"column",gap:14}},{children:[i("p",e({style:{margin:"0 0 2px 0",fontSize:13,fontWeight:600,color:H,fontFamily:P,display:"flex",alignItems:"center",gap:5}},{children:[n(b,{size:13,color:H}),"Existing Category"]})),v.map(function(e,t){return n(ne,{ref:function(e){S.current[t]=e},label:e.label,value:e.existing},t)})]}))]}))}))]}))]})},oe=function(t){var r=t.condition,l=t.index,a=t.isEditing,d=t.editText,c=t.onEditStart,s=t.onEditChange,p=t.onEditSave,y=t.onEditCancel,x=t.onRemove,m=t.readOnly,b=t.onBlurContainer,v={width:40,height:38,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",background:M,borderRight:"1px solid #D0D5DD",color:j,fontSize:14,fontFamily:P};return i("div",a?e({style:{display:"flex",alignItems:"center",gap:12},onBlur:b},{children:[i("div",e({style:{display:"flex",flex:1,alignItems:"center",background:L,border:"1px solid ".concat(k),borderRadius:Y,overflow:"hidden"}},{children:[n("div",e({style:v},{children:l+1})),n("input",{type:"text",value:d,onChange:function(e){return s(e.target.value)},autoFocus:!0,onKeyDown:function(e){"Enter"===e.key&&d.trim()?p():"Escape"===e.key&&y()},style:{flex:1,padding:"8px 11.5px",fontSize:14,fontFamily:P,color:D,border:"none",outline:"none",background:"transparent"}})]})),n("button",e({type:"button",disabled:!d.trim(),onClick:p,style:e(e({},X),{borderRadius:Y,opacity:d.trim()?1:.5,cursor:d.trim()?"pointer":"not-allowed",background:d.trim()?L:M})},{children:n(u,{size:18,color:O})})),n("button",e({type:"button",onClick:y,style:e(e({},X),{borderRadius:Y})},{children:n(f,{size:18,color:K})}))]}):e({style:{display:"flex",alignItems:"center",gap:12}},{children:[i("div",e({style:{display:"flex",flex:1,alignItems:"center",background:L,border:"1px solid #D0D5DD",borderRadius:Y,overflow:"hidden",height:38}},{children:[n("div",e({style:e(e({},v),{height:"100%"})},{children:l+1})),n("div",e({style:{flex:1,padding:"0 11.5px",fontSize:14,fontFamily:P,display:"flex",alignItems:"center",height:"100%"}},{children:r.text?n("span",e({style:{color:D}},{children:r.text})):n("span",e({style:{color:R}},{children:"Enter condition"}))}))]})),!m&&i(o,{children:[n("button",e({type:"button",onClick:c,style:e(e({},X),{border:"1px solid ".concat(F),borderRadius:Y})},{children:n(h,{size:16,color:q})})),n("button",e({type:"button",onClick:x,style:e(e({},X),{border:"1px solid ".concat(z),borderRadius:Y})},{children:n(g,{size:16,color:K})}))]})]}))},re=function(t){var r=t.title,l=t.required,a=t.isExpanded,d=t.setIsExpanded,c=t.conditions,s=t.prefix,p=t.editingCondKey,u=t.editingCondText,f=t.setEditingCondKey,h=t.setEditingCondText,g=t.onAdd,x=t.onUpdate,m=t.onRemove,b=t.addLabel,w=t.readOnly,C=t.errorMessage,k=t.style,S=c.length>0;return i("div",e({style:e({border:"1px solid ".concat(F),borderRadius:Y,padding:16},k)},{children:[i("div",e({style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:8,cursor:S?"pointer":"default",userSelect:"none"},onClick:function(){S&&d(function(e){return!e})}},{children:[i("label",e({style:e(e({},Z),{marginBottom:0,cursor:S?"pointer":"default"})},{children:[l&&J,n("span",{children:r})]})),n("button",e({type:"button",style:{background:"none",border:"none",cursor:"pointer",padding:0,display:"flex",alignItems:"center",transform:a?"rotate(0deg)":"rotate(180deg)",transition:"transform 0.2s"}},{children:n(y,{size:20,color:S?D:R})}))]})),a&&i(o,{children:[0===c.length&&n("p",e({style:{color:B,fontSize:14,fontStyle:"italic",fontWeight:300,fontFamily:P,margin:"0 0 12px 0"}},{children:"No conditions applied"})),n("div",e({style:{display:"flex",flexDirection:"column",gap:12,marginBottom:12}},{children:c.map(function(e,t){var i="".concat(s,"_").concat(e.id);return n(oe,{condition:e,index:t,isEditing:p===i,editText:u,onEditStart:function(){f(i),h(e.text)},onEditChange:h,onEditSave:function(){u.trim()&&(x(e.id,u),f(null))},onEditCancel:function(){e.text?f(null):m(e.id)},onRemove:function(){return m(e.id)},readOnly:w,onBlurContainer:function(t){return function(e,t,n){if(!e.currentTarget.contains(e.relatedTarget)){var i="".concat(s,"_").concat(t);u.trim()||n?u.trim()&&x(t,u):m(t),p===i&&f(null)}}(t,e.id,e.text)}},e.id)})})),!w&&i("button",e({type:"button",onClick:g,style:{display:"flex",alignItems:"center",gap:7,color:H,fontSize:14,fontWeight:500,fontFamily:P,background:"none",border:"none",cursor:"pointer",padding:0}},{children:[n(v,{size:16}),b]})),C&&n("p",e({style:{marginTop:8,color:I,fontSize:12,fontFamily:P,margin:"8px 0 0 0"}},{children:C}))]})]}))},le=function(r){var s=r.state,m=r.handlers,b=r.uiState,w=s.formData,k=s.nameLabel,W=void 0===k?"Category Name":k,M=s.namePlaceholder,Q=void 0===M?"Enter category name":M,$=m.setFormData,ee=b.readOnly,te=void 0!==ee&&ee,ne=b.isAiStreaming,oe=void 0!==ne&&ne;b.setActiveEditId,b.setSendMessageInChat;var le=b.validationErrors,ae=void 0===le?{}:le,de=b.addExampleBtnRef,ce=b.comparisonData,se=void 0===ce?null:ce,pe=b.onComparisonClose,ue=l(null),fe=ue[0],he=ue[1],ge=l(""),ye=ge[0],xe=ge[1],me=l(null),be=me[0],ve=me[1],we=l(""),Ce=we[0],Fe=we[1],ke=l(!0),Se=ke[0],ze=ke[1],De=l(!0),Ee=De[0],Ae=De[1],Be=l(null),Re=Be[0],Te=Be[1],Ie=l(""),We=Ie[0],He=Ie[1],je=l(""),Le=je[0],Me=je[1],Ne=l([]),_e=Ne[0],Oe=Ne[1],Ke=l(!1),qe=Ke[0],Ue=Ke[1],Ye=a(null),Pe=l(!1),Xe=Pe[0],Ve=Pe[1],Ze=a(oe);d(function(){se?requestAnimationFrame(function(){return Ue(!0)}):Ue(!1)},[se]),d(function(){Ze.current&&!oe&&Xe&&Ve(!1),Ze.current=oe},[oe,Xe]);var Ge=te,Je=c(function(t,n){return $(function(i){var o;return e(e({},i),((o={})[t]=n,o))})},[$]),Qe=function(n){var i=C();$(function(o){var r;return e(e({},o),((r={})[n]=t(t([],o[n],!0),[{id:i,text:""}],!1),r))}),ve("".concat("whenToApply"===n?"wta":"wnta","_").concat(i)),Fe(""),"whenToApply"!==n||Se||ze(!0),"whenNotToApply"!==n||Ee||Ae(!0)},$e=function(t,n,i){return $(function(o){var r;return e(e({},o),((r={})[t]=o[t].map(function(t){return t.id===n?e(e({},t),{text:i}):t}),r))})},et=function(t,n){return $(function(i){var o;return e(e({},i),((o={})[t]=i[t].filter(function(e){return e.id!==n}),o))})},tt=function(e){return Oe(function(n){return n.includes(e)?n.filter(function(t){return t!==e}):t(t([],n,!0),[e],!1)})},nt=c(function(){var n=C();$(function(i){return e(e({},i),{occurrences:t(t([],i.occurrences||[],!0),[{id:n,title:"",description:""}],!1)})}),Te(n),He(""),Me(""),Oe(function(e){return t(t([],e,!0),[n],!1)})},[$]),it=c(function(){Ue(!1),setTimeout(function(){null==pe||pe()},280)},[pe]),ot=function(t){return i("button",e({ref:t?void 0:de,type:"button",disabled:t,onClick:nt,style:{display:"flex",alignItems:"center",gap:7,padding:"7px 10.5px",background:"none",border:"none",cursor:t?"not-allowed":"pointer",opacity:t?.5:1,transition:"opacity 0.15s"}},{children:[n(v,{size:14,color:H}),n("span",e({style:{color:H,fontSize:14,fontWeight:500,fontFamily:P}},{children:"Add example"}))]}))};return i("div",e({style:{flex:1,overflowY:"auto",position:"relative"}},{children:[se&&n(ie,{formData:w,existingData:se,onClose:it,visible:qe}),Xe&&oe&&i("div",e({style:{display:"flex",alignItems:"center",color:"#141414",fontSize:13,fontWeight:500,fontStyle:"italic",marginBottom:12,paddingLeft:4,fontFamily:P}},{children:[n(p,{size:16,style:{marginRight:8,animation:"spin 1s linear infinite"}}),"Updating category details..."]})),i("div",e({style:e(e({},G),{marginBottom:12})},{children:[i("div",e({style:{marginBottom:12}},{children:[i("label",e({style:Z},{children:[J,n("span",{children:W})]})),Ge&&"name"!==fe?n("div",e({style:{display:"flex",alignItems:"center",gap:12}},{children:n("div",e({style:{flex:1,padding:"10px 14px",border:"1px solid #D0D5DD",borderRadius:U,fontSize:14,background:L,minHeight:42,display:"flex",alignItems:"center"}},{children:w.name?n("span",e({style:{color:D}},{children:w.name})):n("span",e({style:{color:T}},{children:Q}))}))})):Ge&&"name"===fe?i("div",e({style:{display:"flex",alignItems:"center",gap:12}},{children:[n("input",{type:"text",value:ye,onChange:function(e){return xe(e.target.value)},autoFocus:!0,onKeyDown:function(e){"Enter"===e.key?(Je("name",ye),he(null)):"Escape"===e.key&&he(null)},placeholder:Q,style:e(e({},V),{flex:1,width:"auto",border:"1px solid ".concat(S)})}),n("button",e({type:"button",onClick:function(){Je("name",ye),he(null)},style:X},{children:n(u,{size:18,color:O})})),n("button",e({type:"button",onClick:function(){return he(null)},style:X},{children:n(f,{size:18,color:K})}))]})):n("input",{type:"text",value:w.name,onChange:function(e){return Je("name",e.target.value)},placeholder:Q,disabled:oe,style:e(e({},V),{opacity:oe?.6:1,cursor:oe?"not-allowed":"text"})}),(null==ae?void 0:ae.name)&&n("p",e({style:{marginTop:4,color:I,fontSize:12,fontFamily:P,margin:"4px 0 0 0"}},{children:ae.name}))]})),i("div",e({style:{marginBottom:12}},{children:[i("label",e({style:Z},{children:[J,n("span",{children:"Category Description"})]})),Ge&&"description"!==fe?n("div",e({style:{display:"flex",alignItems:"flex-start",gap:12}},{children:n("div",e({style:{flex:1,padding:"12px 14px",border:"1px solid #D0D5DD",borderRadius:U,fontSize:14,background:L,minHeight:80}},{children:w.description?n("span",e({style:{color:D,whiteSpace:"pre-wrap"}},{children:w.description})):n("span",e({style:{color:T}},{children:"Describe when this category should be applied"}))}))})):Ge&&"description"===fe?i("div",e({style:{display:"flex",alignItems:"flex-start",gap:12}},{children:[n("textarea",{value:ye,onChange:function(e){return xe(e.target.value)},autoFocus:!0,onKeyDown:function(e){"Escape"===e.key&&he(null)},placeholder:"Enter Description",rows:4,style:e(e({},V),{flex:1,width:"auto",border:"1px solid ".concat(S),resize:"none",lineHeight:"140%"})}),i("div",e({style:{display:"flex",flexDirection:"column",gap:8}},{children:[n("button",e({type:"button",onClick:function(){Je("description",ye),he(null)},style:X},{children:n(u,{size:18,color:O})})),n("button",e({type:"button",onClick:function(){return he(null)},style:X},{children:n(f,{size:18,color:K})}))]}))]})):n("textarea",{value:w.description,onChange:function(e){return Je("description",e.target.value)},placeholder:"Describe when this category should be applied.",disabled:oe,style:e(e({},V),{height:60,paddingTop:7,paddingBottom:10.5,border:"1px solid ".concat(F),lineHeight:"140%",resize:"none",boxShadow:"0 1px 2px 0 rgba(18,18,23,0.05)",opacity:oe?.6:1,cursor:oe?"not-allowed":"text"})}),(null==ae?void 0:ae.description)&&n("p",e({style:{marginTop:4,color:I,fontSize:12,fontFamily:P,margin:"4px 0 0 0"}},{children:ae.description}))]})),n(re,{title:"When to Apply",required:!0,isExpanded:Se,setIsExpanded:ze,conditions:w.whenToApply,prefix:"wta",editingCondKey:be,editingCondText:Ce,setEditingCondKey:ve,setEditingCondText:Fe,onAdd:function(){return Qe("whenToApply")},onUpdate:function(e,t){return $e("whenToApply",e,t)},onRemove:function(e){return et("whenToApply",e)},addLabel:"Add When to Apply",readOnly:oe||te,errorMessage:null==ae?void 0:ae.whenToApply,style:{marginBottom:12}}),n(re,{title:"When NOT to Apply",required:!1,isExpanded:Ee,setIsExpanded:Ae,conditions:w.whenNotToApply,prefix:"wnta",editingCondKey:be,editingCondText:Ce,setEditingCondKey:ve,setEditingCondText:Fe,onAdd:function(){return Qe("whenNotToApply")},onUpdate:function(e,t){return $e("whenNotToApply",e,t)},onRemove:function(e){return et("whenNotToApply",e)},addLabel:"Add When NOT to Apply",readOnly:oe||te,errorMessage:null==ae?void 0:ae.whenNotToApply})]})),i("div",e({style:e(e({},G),{marginTop:12})},{children:[i("div",e({style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12}},{children:[i("div",{children:[i("h4",e({style:{color:E,fontSize:14,fontWeight:500,lineHeight:"120%",letterSpacing:"0.02em",fontFamily:P,margin:"0 0 4px 0"}},{children:["Example (",(w.occurrences||[]).length,")"]})),n("p",e({style:{color:B,fontSize:12,fontWeight:300,lineHeight:"120%",letterSpacing:"0.02em",fontFamily:P,margin:0}},{children:"Add real examples to help the system understand this category"}))]}),(w.occurrences||[]).length>0&&!te&&ot(null!==Re||oe)]})),0===(w.occurrences||[]).length?i("div",e({style:{border:"1px solid ".concat(F),borderRadius:Y,background:L,padding:"24px 12px 12px",minHeight:181,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}},{children:[n("div",e({style:{marginBottom:16}},{children:i("svg",e({xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 56 56",fill:"none"},{children:[n("rect",{x:"4",y:"4",width:"48",height:"48",rx:"24",fill:"#F1F5F9"}),n("rect",{x:"4",y:"4",width:"48",height:"48",rx:"24",stroke:"#F8FAFC",strokeWidth:"8"}),n("rect",{width:"24",height:"24",transform:"translate(16 16)",fill:"#F1F5F9"}),n("path",{d:"M25 19.5V18M21.0607 21.0607L20 20M21.0607 29L20 30.0607M29 21.0607L30.0607 20M19.5 25H18M31.8645 32.1896L29.3727 36.817C29.0881 37.3457 28.9457 37.61 28.7745 37.6769C28.6259 37.7349 28.4585 37.7185 28.324 37.6328C28.1689 37.534 28.0806 37.2471 27.9038 36.6733L24.4452 25.4453C24.3008 24.9765 24.2286 24.7421 24.2867 24.5838C24.3373 24.446 24.446 24.3373 24.5838 24.2867C24.7421 24.2286 24.9765 24.3008 25.4452 24.4452L36.6732 27.9038C37.247 28.0806 37.5339 28.169 37.6327 28.324C37.7185 28.4586 37.7348 28.6259 37.6768 28.7745C37.61 28.9458 37.3456 29.0881 36.817 29.3728L32.1896 31.8645C32.111 31.9068 32.0717 31.9279 32.0374 31.9551C32.0068 31.9792 31.9792 32.0068 31.9551 32.0374C31.9279 32.0717 31.9068 32.111 31.8645 32.1896Z",stroke:"#475569",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))})),n("p",e({style:{color:A,fontSize:12,fontWeight:500,lineHeight:"120%",fontFamily:P,margin:"0 0 8px 0"}},{children:"No example added yet"})),n("p",e({style:{color:B,fontSize:14,fontWeight:300,lineHeight:"140%",fontFamily:P,margin:"0 0 8px 0",maxWidth:530}},{children:"Add an example to show how this category is used, or generate one using chat."})),!te&&ot(null!==Re||oe)]})):n("div",e({style:{display:"flex",flexDirection:"column",gap:12}},{children:(w.occurrences||[]).map(function(t,r){var l=_e.includes(t.id);return Re===t.id?i("div",e({style:{display:"flex",flexDirection:"column",gap:12,border:"1px solid ".concat(F),borderRadius:Y,background:L,padding:16,boxShadow:"0 1px 3px rgba(0,0,0,0.07)"}},{children:[i("div",{children:[n("label",e({style:e(e({},Z),{marginBottom:8})},{children:n("span",e({style:{color:A}},{children:"Title/Subject"}))})),n("input",{type:"text",value:We,onChange:function(e){return He(e.target.value)},placeholder:"e.g., Follow-up on client feedback from last meeting",style:e(e({},V),{border:"1px solid ".concat(F),lineHeight:"140%"})})]}),i("div",{children:[i("label",e({style:{display:"flex",alignItems:"center",gap:4,marginBottom:8}},{children:[n("span",e({style:{color:A,fontSize:14,fontWeight:500,fontFamily:P}},{children:"Message body"})),J]})),n("textarea",{ref:function(e){e&&Re===t.id&&!Ye.current&&(Ye.current=e),e&&(e.style.height="auto",e.style.height="".concat(e.scrollHeight,"px"))},value:Le,onChange:function(e){Me(e.target.value),e.target.style.height="auto",e.target.style.height="".concat(e.target.scrollHeight,"px")},placeholder:"e.g., Hi, here's the latest update on the project. Let us know if you have any questions.",rows:1,style:e(e({},V),{border:"1px solid ".concat(F),overflow:"hidden",minHeight:60,lineHeight:"140%",resize:"none"})})]}),i("div",e({style:{display:"flex",justifyContent:"flex-end",gap:12,marginTop:4}},{children:[n("button",e({type:"button",onClick:function(){t.title||t.description||$(function(n){return e(e({},n),{occurrences:(n.occurrences||[]).filter(function(e){return e.id!==t.id})})}),Te(null),Ye.current=null},style:{padding:"6px 12px",color:j,fontSize:14,fontWeight:500,lineHeight:"140%",fontFamily:P,background:"none",border:"none",cursor:"pointer",borderRadius:U}},{children:"Cancel"})),n("button",e({type:"button",disabled:!Le.trim(),onClick:function(){var n;Le.trim()&&(n=t.id,$(function(t){return e(e({},t),{occurrences:t.occurrences.map(function(t){return t.id===n?e(e({},t),{title:We,description:Le}):t})})}),Te(null),Ye.current=null,Oe(function(e){return e.filter(function(e){return e!==t.id})}))},style:{padding:"6px 12px",borderRadius:U,fontSize:14,fontWeight:500,lineHeight:"140%",fontFamily:P,cursor:Le.trim()?"pointer":"not-allowed",background:Le.trim()?_:L,border:"1px solid ".concat(Le.trim()?_:"#E2E8F0"),color:Le.trim()?H:R,transition:"background 0.15s"}},{children:"Save"}))]}))]}),t.id):i("div",e({style:{display:"flex",flexDirection:"column",border:"1px solid #E2E8F0",borderRadius:Y,background:L,overflow:"hidden",boxShadow:"0 1px 3px rgba(0,0,0,0.07)"}},{children:[i("div",e({style:{display:"flex",alignItems:"center",gap:12,padding:12}},{children:[n("div",e({style:{width:20,height:20,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",background:N,borderRadius:U,color:j,fontSize:10,fontWeight:500,fontFamily:P}},{children:r+1})),n("div",e({style:{flex:1,fontSize:15,fontWeight:500,lineHeight:"140%",fontFamily:P,color:A,wordBreak:"break-word"}},{children:t.title||n("span",e({style:{color:R,fontWeight:400,fontSize:14}},{children:"Untitled example"}))})),i("div",e({style:{display:"flex",alignItems:"center",gap:8,flexShrink:0}},{children:[!te&&i(o,{children:[n("button",e({type:"button",disabled:null!==Re||oe,onClick:function(){Te(t.id),He(t.title),Me(t.description),l||tt(t.id)},style:e(e({},X),{width:36,height:36,border:"1px solid #E2E8F0",borderRadius:U,opacity:null!==Re||oe?.5:1,cursor:null!==Re||oe?"not-allowed":"pointer"})},{children:n(h,{size:16,color:q})})),n("button",e({type:"button",disabled:null!==Re||oe,onClick:function(){return $(function(n){return e(e({},n),{occurrences:(n.occurrences||[]).filter(function(e){return e.id!==t.id})})})},style:e(e({},X),{width:36,height:36,border:"1px solid ".concat(z),borderRadius:U,opacity:null!==Re||oe?.5:1,cursor:null!==Re||oe?"not-allowed":"pointer"})},{children:n(g,{size:16,color:K})}))]}),n("button",e({type:"button",onClick:function(){return tt(t.id)},style:e(e({},X),{width:36,height:36,border:"none",background:"transparent"})},{children:n(l?y:x,{size:20,color:q})}))]}))]})),l&&i("div",e({style:{display:"flex",flexDirection:"column",padding:"4px 12px 16px"}},{children:[i("div",e({style:{marginBottom:12}},{children:[n("p",e({style:{color:B,fontSize:13,lineHeight:"140%",fontFamily:P,margin:"0 0 4px 0"}},{children:"Title/Subject:"})),n("p",e({style:{color:E,fontSize:14,fontWeight:300,lineHeight:"150%",fontFamily:P,whiteSpace:"pre-wrap",wordBreak:"break-word",margin:0}},{children:t.title||n("span",e({style:{color:R,fontStyle:"italic"}},{children:"—"}))}))]})),i("div",{children:[n("p",e({style:{color:B,fontSize:13,lineHeight:"140%",fontFamily:P,margin:"0 0 4px 0"}},{children:"Message body:"})),n("p",e({style:{color:E,fontSize:14,fontWeight:300,lineHeight:"150%",fontFamily:P,whiteSpace:"pre-wrap",wordBreak:"break-word",margin:0}},{children:t.description}))]})]}))]}),t.id)})}))]}))]}))};export{le as CreateCategory,le as default};
2
- //# sourceMappingURL=CreateCategory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CreateCategory.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- import{__assign as i}from"tslib";import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useState as t}from"react";import{ConditionSection as o}from"../../organisms/ConditionSection/ConditionSection.js";import{TextSection as l}from"../../organisms/TextSection/TextSection.js";var r=function(r){var d,s,u,a=r.state,p=r.handlers,h=r.uiState,g=(null==h?void 0:h.highlights)||{},c=t({}),v=c[0],y=c[1],m=function(e){y(function(n){var t;return i(i({},n),((t={})[e]=!n[e],t))})},A=function(i){var e,n=null===(e=a.fieldCitations)||void 0===e?void 0:e[i];return Array.isArray(n)&&n.length>0?n:a.citations};return e("div",i({className:"simple-guideline-template"},{children:n("div",i({style:{display:"flex",flexDirection:"column",gap:"20px"}},{children:[e(l,i({id:"guideline-title",title:"Guideline Title",rows:1,placeholder:"Enter a short, descriptive title for the guideline",required:!0,value:a.guidelineTitle,onChange:p.setGuidelineTitle,readOnly:null==h?void 0:h.isAiStreaming,isOpen:v.guidelineTitle,onToggle:function(){return m("guidelineTitle")},isHighlighted:g.guidelineTitle||!1,tooltipDescription:"Why this Title?",errorMessage:null===(d=null==h?void 0:h.validationErrors)||void 0===d?void 0:d.guidelineTitle},h)),e(l,i({id:"guideline-description",title:"Guideline Description",rows:4,placeholder:"Describe what this guideline enforces or ensures",required:!0,value:a.guidelineDescription,onChange:p.setGuidelineDescription,readOnly:null==h?void 0:h.isAiStreaming,isOpen:v.guidelineDescription,onToggle:function(){return m("guidelineDescription")},isHighlighted:g.guidelineDescription||!1,tooltipDescription:"Why this Description?",errorMessage:null===(s=null==h?void 0:h.validationErrors)||void 0===s?void 0:s.guidelineDescription},h)),e(o,i({id:"when-to-apply",title:"When to apply",required:!0,dividerRequired:!0,readOnly:null==h?void 0:h.isAiStreaming,conditions:a.whenToApplyConditions||[],onAdd:function(){return p.addWhenToApply()},onRemove:function(i,e,n){return p.removeWhenToApply(n)},onEdit:function(i,e,n,t){return p.editWhenToApply(n,t)},index:0,tierKey:"default",isHighlighted:g.wta||!1,highlightedIds:null==h?void 0:h.highlightedIds,tooltipDescription:"Why this Condition?",citations:A("whenToApply"),bordered:!0,addLabel:"Add When to apply",isAiStreaming:null==h?void 0:h.isAiStreaming,errorMessage:null===(u=null==h?void 0:h.validationErrors)||void 0===u?void 0:u.whenToApply},h)),e(o,i({id:"when-not-to-apply",title:"When NOT to apply",required:!1,dividerRequired:!0,readOnly:null==h?void 0:h.isAiStreaming,conditions:a.whenNotToApplyConditions||[],onAdd:function(){return p.addWhenNotToApply()},onRemove:function(i,e,n){return p.removeWhenNotToApply(n)},onEdit:function(i,e,n,t){return p.editWhenNotToApply(n,t)},index:0,tierKey:"default",isHighlighted:g.wnta||!1,highlightedIds:null==h?void 0:h.highlightedIds,tooltipDescription:"Why this Condition?",citations:A("whenNotToApply"),bordered:!0,addLabel:"Add When NOT to apply",isAiStreaming:null==h?void 0:h.isAiStreaming},h))]}))}))};export{r as WorkflowComposer};
2
- //# sourceMappingURL=WorkflowComposer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"WorkflowComposer.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,22 +0,0 @@
1
- import React from "react";
2
- /**
3
- * @description
4
- * This error boundary component refreshes the webpage if chunk loading error received due to code splitting after deploying a new version of react app.
5
- * For reference, see this article: https://mitchgavan.com/code-splitting-react-safely/
6
- */
7
- type State = {
8
- hasError: boolean;
9
- };
10
- export declare function getWithExpiry(key: string): any;
11
- export default class ErrorBoundary extends React.Component<{
12
- children?: React.ReactNode;
13
- }, State> {
14
- constructor(props: any);
15
- static getDerivedStateFromError(error: any): {
16
- hasError: boolean;
17
- } | undefined;
18
- componentDidCatch(error: any, errorInfo: any): void;
19
- render(): React.ReactNode;
20
- }
21
- export {};
22
- //# sourceMappingURL=ErrorBoundary.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ErrorBoundary.d.ts","sourceRoot":"","sources":["../../../../src/routes/ErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;GAIG;AAEH,KAAK,KAAK,GAAG;IACX,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAUF,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,OAaxC;AAiBD,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,KAAK,CAAC,SAAS,CAAC;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,EAAE,KAAK,CAAC;gBACnF,KAAK,EAAE,GAAG;IAKtB,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,GAAG;;;IAS1C,iBAAiB,CAAC,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG;IAK5C,MAAM;CAoBP"}
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- export default function AppRouter(): React.JSX.Element;
3
- //# sourceMappingURL=Routes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Routes.d.ts","sourceRoot":"","sources":["../../../../src/routes/Routes.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAC;AASxC,MAAM,CAAC,OAAO,UAAU,SAAS,sBAmBhC"}