@e-llm-studio/instant-learning 0.0.290 → 0.0.292
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.
- package/dist/cjs/features/DocumentLearning/_components/ChatComponent.js +1 -1
- package/dist/cjs/features/IL-OTJ/ILOTJ.js +1 -1
- package/dist/cjs/features/IL-OTJ/_components/ChatComponents/ChatComponent.js +1 -1
- package/dist/cjs/features/IL-OTJ/_components/ChatComponents/NormalChat.js +1 -1
- package/dist/cjs/features/IL-OTJ/_components/ILPopup.js +1 -1
- package/dist/cjs/features/IL-OTJ/_components/templates/CreateCategory/CreateCategory.js +2 -0
- package/dist/cjs/features/IL-OTJ/_components/templates/CreateCategory/CreateCategory.js.map +1 -0
- package/dist/cjs/features/IL-OTJ/_components/templates/TemplatesMap/templatesMap.js +1 -1
- package/dist/cjs/features/InstantLearning/_components/ChatComponent.js +1 -1
- package/dist/cjs/features/InstantLearning/_components/ContextualChatComponent.js +1 -1
- package/dist/features/DocumentLearning/_components/ChatComponent.js +1 -1
- package/dist/features/IL-OTJ/ILOTJ.js +1 -1
- package/dist/features/IL-OTJ/_components/ChatComponents/ChatComponent.js +1 -1
- package/dist/features/IL-OTJ/_components/ChatComponents/NormalChat.js +1 -1
- package/dist/features/IL-OTJ/_components/ILPopup.js +1 -1
- package/dist/features/IL-OTJ/_components/templates/CreateCategory/CreateCategory.js +2 -0
- package/dist/features/IL-OTJ/_components/templates/CreateCategory/CreateCategory.js.map +1 -0
- package/dist/features/IL-OTJ/_components/templates/TemplatesMap/templatesMap.js +1 -1
- package/dist/features/InstantLearning/_components/ChatComponent.js +1 -1
- package/dist/features/InstantLearning/_components/ContextualChatComponent.js +1 -1
- package/dist/types/src/features/IL-OTJ/ILOTJ.d.ts +1 -0
- package/dist/types/src/features/IL-OTJ/ILOTJ.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/ILOTJTest.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/ILOTJTriageAITest.d.ts +12 -0
- package/dist/types/src/features/IL-OTJ/ILOTJTriageAITest.d.ts.map +1 -0
- package/dist/types/src/features/IL-OTJ/_components/ChatComponents/NormalChat.d.ts +2 -2
- package/dist/types/src/features/IL-OTJ/_components/ChatComponents/NormalChat.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/ILPopup.d.ts +2 -1
- package/dist/types/src/features/IL-OTJ/_components/ILPopup.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/templates/CreateCategory/CreateCategory.d.ts +71 -0
- package/dist/types/src/features/IL-OTJ/_components/templates/CreateCategory/CreateCategory.d.ts.map +1 -0
- package/dist/types/src/features/IL-OTJ/_components/templates/TemplatesMap/templatesMap.d.ts +2 -1
- package/dist/types/src/features/IL-OTJ/_components/templates/TemplatesMap/templatesMap.d.ts.map +1 -1
- package/package.json +1 -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"),a=require("@mui/material"),s=require("@mui/material/Tooltip"),i=require("react-markdown"),o=require("rehype-raw"),r=require("axios"),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"),C=require("../../InstantLearning.module.css.js"),p=require("../_svg/ScrollToBottom.js"),_=require("../../helpers/utils.js"),x=require("../_svg/SendButton.js"),S=require("../_svg/SparkleIcon.js"),y=require("../_svg/UserIcon.js");function b(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var R,j=b(s),w=b(i),k=b(o),E=b(r);exports.default=function(s){var i=s.chatAssistantName,o=s.organizationName,r=s.baseUrl;s.baseWebsocketUrl;var b=s.setIsNewChatClicked;s.ThinkingBulbIconComponent;var M=s.isFormSaveClicked,T=s.setIsFormSavedClicked,I=s.onResetLearningData,A=s.sendMessageInChat,N=s.setSendMessageInChat,D=s.isFormValidating,q=s.chatTitle,L=s.customMetaData,F=s.headerMessageHandlers;s.aiResponse;var W=s.setAIResponse,B=s.onResetChat,P=s.initialChatMessage,z=void 0===P?"":P,H=s.onSave,U=s.chatSize,Z=s.setChatSize,K=s.movingTowards,O=s.setCitations,G=s.textareaPlaceholder,V=void 0===G?"Tell me more about this learning...":G,J=s.setCurrentRequestId,Q=s.showSavedMessage,X=void 0!==Q&&Q,Y=s.savedMessage,$=s.isError,ee=void 0!==$&&$,te=s.errorMessage,ne=void 0===te?"There was an error saving your changes.":te;s.isSaving;var ae=s.isHighlighted,se=void 0!==ae&&ae,ie=s.onStreamingStateChange,oe=s.onViewComparison;s.isCopyEnabled;var re=s.onComparisonLinkClick,le=s.onSubmitFeedback,ue=i,de=n.useRef("".concat(ue,"-").concat(o,"-").concat(l.v4())),ce=n.useRef("".concat(l.v4())),he=r,ve=n.useRef(null),me=n.useRef(!0),fe=n.useRef(null),ge=n.useRef(null),Ce=n.useState(""),pe=Ce[0],_e=Ce[1],xe=n.useState([]),Se=xe[0],ye=xe[1],be=n.useState(!1),Re=be[0],je=be[1],we=n.useState(!1);we[0];var ke=we[1],Ee=n.useState(!0),Me=Ee[0],Te=Ee[1],Ie=n.useState(!0);Ie[0];var Ae=Ie[1],Ne=n.useState("");Ne[0];var De=Ne[1],qe=n.useState(""),Le=qe[0],Fe=qe[1],We=n.useState(!1),Be=We[0],Pe=We[1],ze=n.useState(!1),He=ze[0],Ue=ze[1],Ze=n.useState(!0),Ke=Ze[0],Oe=Ze[1],Ge=n.useState("100%");Ge[0];var Ve=Ge[1],Je=n.useState(null),Qe=Je[0],Xe=Je[1],Ye=n.useState(!1);Ye[0];var $e=Ye[1],et=n.useState(!1),tt=et[0],nt=et[1],at=n.useRef(null),st=n.useRef(new Set),it=n.useState(null),ot=it[0],rt=it[1],lt=n.useState(!1),ut=lt[0],dt=lt[1],ct=n.useState(!1);ct[0],ct[1];var ht=n.useState(null);ht[0],ht[1],n.useRef(null),n.useRef(null);var vt=n.useRef(new Map),mt=n.useRef(""),ft=a.keyframes(R||(R=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 "]))),gt=n.useMemo(function(){return""===(null==pe?void 0:pe.trim())||Be},[pe,Be]),Ct=n.useMemo(function(){return D},[D]),pt=n.useMemo(function(){return gt||Be||D},[gt,Be,D]);n.useEffect(function(){null==ie||ie(Be)},[Be,ie]),n.useEffect(function(){var e=ve.current,t=function(){if(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;Oe(n-t-a<=20)}};return e&&(e.addEventListener("scroll",t),t()),function(){e&&e.removeEventListener("scroll",t)}},[Se]);var _t=_.useHeaderObserver({handlers:F,setResult:W}).processHeaderMessage;n.useEffect(function(){X&&nt(!0)},[X]),n.useEffect(function(){if(ut){var e=setTimeout(function(){dt(!1)},3e3);return function(){return clearTimeout(e)}}},[ut]),n.useEffect(function(){M&&(jt(new KeyboardEvent("keydown",{key:"Enter"}),!1,"Save this Learning"),T(!1))},[M]),n.useEffect(function(){if(A)try{if(A.startsWith("__SKELETON__:")){var t=A.split(":"),n=t[1],a=t.slice(2).join(":"),s={role:"user",content:"",id:n,time:new Date,isSkeleton:!0,skeletonContent:a};return ye(function(t){return e.__spreadArray(e.__spreadArray([],t,!0),[s],!1)}),jt(new KeyboardEvent("keydown",{key:"Enter"}),!1,a,!1,n),rt(n),N&&N(""),void setTimeout(function(){rt(null)},2e3)}if(A.startsWith("__SKELETON_END__::")){var i=A.split("::")[1]||"";return ye(function(t){return t.map(function(t){return t.isSkeleton?e.__assign(e.__assign({},t),{isSkeleton:!1,content:t.skeletonContent||i}):t})}),void(N&&N(""))}var o=l.v4();jt(new KeyboardEvent("keydown",{key:"Enter"}),!1,A,!1,o),rt(o),N&&N(""),setTimeout(function(){return rt(null)},2e3)}catch(e){console.error("Error handling sendMessageInChat signal",e)}},[A]),n.useEffect(function(){St(),yt();var e=function(){var e,t=(null===(e=null==at?void 0:at.current)||void 0===e?void 0:e.clientHeight)||0,n="calc(100% - ".concat(t,"px - 10px)");Ve(n)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var xt=n.useCallback(function(e){var t="string"==typeof e?e:"smooth";fe.current&&fe.current.scrollIntoView({behavior:t,block:"end"}),me.current&&setTimeout(function(){fe.current&&me.current&&fe.current.scrollIntoView({behavior:t,block:"end"})},100)},[]);n.useEffect(function(){if(!Be){var t="";if(tt?t=Y||"Thank you teacher for teaching me, your rule has been saved successfully.":ee&&(t=ne||"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};ye(function(t){return e.__spreadArray(e.__spreadArray([],t,!0),[n],!1)}),nt(!1),setTimeout(function(){return xt("smooth")},100)}}},[tt,ee,Be,Y,ne,xt]),n.useEffect(function(){me.current&&xt("smooth")},[xt]);var St=function(){var e={method:"get",maxBodyLength:1/0,url:"".concat(he,"/api/chatbot/getChatSettings?name=").concat(ue,"&organizationName=").concat(o),headers:{}};E.default.request(e).then(function(e){var t,n,a;(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.chatSettings)&&""!==(null===(a=null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.chatSettings)||void 0===a?void 0:a.chatInitialMessage)&&Ae(!0)}).catch(function(e){console.error(e)})},yt=function(){return e.__awaiter(void 0,void 0,void 0,function(){var t,n;return e.__generator(this,function(e){t="".concat(he,"/api/chat/history?name=").concat(ue,"&organizationName=").concat(o);try{n={method:"GET",params:{guestSessionId:de.current},withCredentials:!0},E.default.get(t,n).then(function(e){var t=e.data;t.length>0?(ye(t),xt()):Ae(!0)}).catch(function(e){console.error(e)})}catch(e){je(!1),console.error(e)}return[2]})})};function bt(e){return null==e?void 0:e.replace(/<a [^>]*>.*?<\/a>/g,function(e){return null==e?void 0:e.replace(/\*/g,"*")})}var Rt=function(t,n,a,s,i,o,r){var u,d,c,h,v,m,f,g,C,p,_,x,S,y,b,R,j,w,k,E,M,T,I,A,N,D,q,L,F,W,B,P,z,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};_t(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,G=(null===(f=null==Z?void 0:Z.message)||void 0===f?void 0:f.citations)||[];K&&G.length>0&&O&&O(G);var V={role:"assistant",content:"",id:l.v4()};if(null===(_=null===(p=null===(C=null===(g=null==t?void 0:t.chatStream)||void 0===g?void 0:g.continueChatResult)||void 0===C?void 0:C.message)||void 0===p?void 0:p.content)||void 0===_?void 0:_.includes("WaitMessage: "))ke(!0),V.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"),""!==V.content&&(je(!1),ye(e.__spreadArray(e.__spreadArray([],Se,!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:""},V],!1)));else{ke(!1),V.content=null===(E=bt(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 Q=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 Q&&Q&&J&&J(Q);var X=function(t,n,a){var s,i,o,r,u,d,c,h,v,m,f,g,C,p,_,x,S,y,b,R,j,w,k,E,M,T,I,A,N,D,q,L,F,W,B={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)&&(B.content=bt(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)&&(B.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===(p=null===(C=t.chatStream)||void 0===C?void 0:C.continueChatResult)||void 0===p?void 0:p.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)&&(B.content=bt(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 P=H.explainability_id,z=H.responded_by;a.has(P)||a.set(P,{responded_by:z,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===(A=null===(I=t.chatStream)||void 0===I?void 0:I.continueChatResult)||void 0===A?void 0:A.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&&(P=H.explainability_id,z=H.responded_by,a.has(P)||a.set(P,{responded_by:z,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!==(W=t.chatStream.continueChatResult.explainability_id)&&void 0!==W?W:"",isParallelToolResponse:!1})}return e.__assign({orchestratorAndAgentsMessages:n},B)}(t,a,n);X.time=new Date,X.citations=G,X.isEnd=null===(A=null===(I=null==t?void 0:t.chatStream)||void 0===I?void 0:I.continueChatResult)||void 0===A?void 0:A.isEnd,X.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,X.sessionId=de.current,null===(q=X.orchestratorAndAgentsMessages)||void 0===q||q.forEach(function(e){e&&e.header_message&&_t(e)}),(""!==(null==X?void 0:X.content)||(null==X?void 0:X.orchestratorAndAgentsMessages)&&(null==X?void 0:X.orchestratorAndAgentsMessages.length)>0)&&(je(!1),ye(e.__spreadArray(e.__spreadArray([],Se,!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!==(P=null===(B=null===(W=null==t?void 0:t.chatStream)||void 0===W?void 0:W.continueChatResult)||void 0===B?void 0:B.requestId)&&void 0!==P?P:""},X],!1))),Te(null===(H=null===(z=null==t?void 0:t.chatStream)||void 0===z?void 0:z.continueChatResult)||void 0===H?void 0:H.isEnd)}},jt=function(t,n,a,s,i,d){var c,h,v=(void 0!==a?a:pe||"").trim(),m="Enter"===(null==t?void 0:t.key)&&!(null==t?void 0:t.shiftKey);if(m&&(null===(c=null==t?void 0:t.preventDefault)||void 0===c||c.call(t)),!(!v||Be&&!a||(null==t?void 0:t.key)&&!m)){if("I want to add a rule description"===v){Te(!1),me.current=!0,Pe(!0),!Qe&&v&&Xe(a||"manual_entry");var f=new Date;return ye(function(t){return e.__spreadArray(e.__spreadArray([],t.map(function(t,n){var a;return e.__assign(e.__assign({},t),{content:null===(a=bt(t.content))||void 0===a?void 0:a.replace("WaitMessage: ","")})}),!0),[{role:"user",content:v,time:f,isFirstQuestionSent:!1,id:i||l.v4()}],!1)}),xt("smooth"),void setTimeout(function(){ye(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)}),xt("smooth"),setTimeout(function(){Pe(!1),Te(!0)},500)},500)}Te(!1),me.current=!0,Pe(!0),!Qe&&v&&Xe(a||"manual_entry");var g=new Date;ye(function(t){var n=t.map(function(t){var n;return e.__assign(e.__assign({},t),{content:null===(n=bt(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:v}):t}):e.__spreadArray(e.__spreadArray([],n,!0),[{role:"user",content:v,time:g,isFirstQuestionSent:!1,id:i||l.v4()}],!1)}),xt("smooth");var C=new Map,p=[],_={API_URL:r,organizationName:o,chatAssistantName:ue,selectedAIModel:"gpt-4",replyMessage:"",userName:"Guest User",userEmailId:"guestUser@example.com",userId:"Guest User",query:v,requestId:"requestId-".concat(l.v4()),customPrompt:"",enableForBackend:!1,guestSessionId:de.current,chatPreviewId:ce.current,customMetaData:L,aiModel:"",onStreamEvent:function(e){return Rt(e,C,p,g,v,n,i)},onStreamEnd:function(t){Te(!0),Pe(!1),$e(!1);var n=Date.now(),a=vt.current.get(mt.current);if(a){var s=Math.round((n-a)/1e3).toFixed(1);ye(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){console.error("Stream error:",e),Te(!0),Pe(!1),$e(!1)}};if(v)je(!0),null===(h=ge.current)||void 0===h||h.blur(),_e(""),xt(),Fe(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."),vt.current.set(_.requestId,Date.now()),mt.current=_.requestId,u.startChatStreamSSE(_);d&&d(!1)}},wt=n.useRef(null);n.useLayoutEffect(function(){wt.current=jt});var kt=n.useCallback(function(){for(var t,n=[],a=0;a<arguments.length;a++)n[a]=arguments[a];return null===(t=wt.current)||void 0===t?void 0:t.call.apply(t,e.__spreadArray([wt],n,!1))},[]),Et=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=Qe===o||Qe===r,u=!!Qe,d="Tester Genie"===o;return t.jsx(m.ActionableButton,e.__assign({},i,{className:a,handleStream:kt,isStreamEnd:Me,disabled:u,isLastMessage:!0,style:{margin:0},isTesterGenie:d,"data-selected":l?"true":Qe?"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"})]}))]}))}))}}},[kt,Me,Qe]),Mt=n.useMemo(function(){return Se.some(function(e){return e.isSkeleton})},[Se]),Tt=function(t){return e.__awaiter(void 0,void 0,void 0,function(){return e.__generator(this,function(n){switch(n.label){case 0:return le?[4,le(t)]:[3,2];case 1:n.sent(),ye(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 xt("smooth")},100),n.label=2;case 2:return[2]}})})};return console.log(Se,"rendering messages"),t.jsxs("div",e.__assign({className:"".concat(C.default.customFont," ").concat(g.default.chatContainer),style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:se&&!Mt?"0 0 20px 5px rgba(37, 99, 235, 0.5)":"none"}},{children:[t.jsxs("div",e.__assign({ref:ve,className:g.default.scrollWrapper},{children:[t.jsx("div",e.__assign({ref:at,className:g.default.stickyHeader},{children:t.jsx(c.default,{resetChatHistory:function(){var e="".concat(he,"/api/chat/resetHistory?name=").concat(ue,"&organizationName=").concat(o);try{var t={method:"GET",params:{guestSessionId:de.current},withCredentials:!0};E.default.get(e,t).then(function(){b(!0),De(""),Xe(null),st.current.clear(),ce.current="".concat(l.v4()),ye([]),Ae(!0),null==B||B(),I&&I()}).catch(function(e){console.error(e)}).finally(function(){de.current="".concat(ue,"-").concat(o,"-").concat(l.v4())})}catch(e){je(!1),console.error(e)}},isStreamEnd:Me,chatTitle:q,onResize:Z,chatSize:U,movingTowards:K})})),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(w.default,e.__assign({rehypePlugins:[k.default],components:Et},{children:z}))})}))}))]})),Se.length>0&&Se.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:Me,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:Se,handleStream:jt,isLastMessage:a===Se.length-1,onSave:H,citations:null==n?void 0:n.citations,setChatSize:Z,chatSize:U,isStreamEnd:Me,messageIsEnd:null==n?void 0:n.isEnd,onViewComparison:oe,onTypeResponseClick:function(){var e;dt(!0),null===(e=ge.current)||void 0===e||e.focus()},onComparisonLinkClick:re,baseURL:he,onFeedbackSubmit:Tt}),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||Mt||n.id!==ot?"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:Se,handleStream:jt,isLastMessage:a===Se.length-1,onSave:H,citations:null==n?void 0:n.citations,isStreamEnd:Me,messageIsEnd:null==n?void 0:n.isEnd,onViewComparison:oe,onComparisonLinkClick:re,baseURL:he,onFeedbackSubmit:Tt}),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)}),Re&&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:Le})}))]})),t.jsx("div",{ref:fe,style:{float:"left",clear:"both"}})]}))]})),t.jsxs("div",e.__assign({className:g.default.inputAreaWrapper},{children:[Be&&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(ft," 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(ft," 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(ft," 1.4s infinite ease-in-out both")}})]})),t.jsx(j.default,e.__assign({title:D?"Please wait for the validation to be completed.":""},{children:t.jsxs("div",e.__assign({className:"".concat(g.default.inputBoxContainer," ").concat(Ct?g.default.disabled:""),style:ut?{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:[Se.length>0&&!Ke&&t.jsx("div",e.__assign({onMouseDown:function(e){e.preventDefault(),xt("smooth")},className:g.default.scrollToBottomBtn},{children:t.jsx(p.ScrollToBottom,{})})),t.jsxs("div",e.__assign({style:{width:"100%",display:"flex"}},{children:[t.jsx("textarea",{ref:ge,placeholder:V,value:pe||"",onChange:function(e){_e(e.target.value)},onFocus:function(){return Ue(!0)},onBlur:function(){return Ue(!1)},onKeyDown:function(e){return jt(e)},disabled:Ct,className:"no-scrollbar ".concat(g.default.chatTextarea),style:{minHeight:He?"120px":"50px",height:He?"120px":"50px",maxHeight:"120px"}}),t.jsx("span",e.__assign({className:g.default.sendButtonWrapper},{children:t.jsx("button",e.__assign({onClick:function(e){jt(new KeyboardEvent("keydown",{key:"Enter"}))},disabled:pt,className:"".concat(g.default.sendButton," ").concat(pt?g.default.disabled:g.default.active)},{children:t.jsx(x.SendButton,{})}))}))]}))]}))}))]})),t.jsxs("div",e.__assign({className:g.default.footerTools},{children:[t.jsx(j.default,e.__assign({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:t.jsx("span",e.__assign({className:g.default.footerToolItem},{children:t.jsx(f.default,{amplitude:1,variant:"speaker",isActive:!1,onClick:function(){return null},disabled:!1})}))})),t.jsx(j.default,e.__assign({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:t.jsx("span",e.__assign({className:g.default.footerToolItem},{children:t.jsx(f.default,{amplitude:1,variant:"microphone",isActive:!1,onClick:function(){return null},disabled:!1})}))}))]}))]}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),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("axios"),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"),C=require("../../InstantLearning.module.css.js"),p=require("../_svg/ScrollToBottom.js"),_=require("../../helpers/utils.js"),x=require("../_svg/SendButton.js"),S=require("../_svg/SparkleIcon.js"),y=require("../_svg/UserIcon.js");function b(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var R,j=b(s),w=b(i),k=b(o),E=b(r);exports.default=function(s){var i=s.chatAssistantName,o=s.organizationName,r=s.baseUrl,b=s.baseWebsocketUrl,M=s.setIsNewChatClicked;s.ThinkingBulbIconComponent;var T=s.isFormSaveClicked,I=s.setIsFormSavedClicked,A=s.onResetLearningData,N=s.sendMessageInChat,D=s.setSendMessageInChat,q=s.isFormValidating,L=s.chatTitle,F=s.customMetaData,W=s.headerMessageHandlers;s.aiResponse;var B=s.setAIResponse,z=s.onResetChat,P=s.initialChatMessage,H=void 0===P?"":P,U=s.onSave,Z=s.chatSize,K=s.setChatSize,O=s.movingTowards,G=s.setCitations,V=s.textareaPlaceholder,J=void 0===V?"Tell me more about this learning...":V,Q=s.setCurrentRequestId,X=s.showSavedMessage,Y=void 0!==X&&X,$=s.savedMessage,ee=s.isError,te=void 0!==ee&&ee,ne=s.errorMessage,ae=void 0===ne?"There was an error saving your changes.":ne;s.isSaving;var se=s.isHighlighted,ie=void 0!==se&&se,oe=s.onStreamingStateChange,re=s.onViewComparison;s.isCopyEnabled;var le=s.onComparisonLinkClick,ue=s.onSubmitFeedback,de=i,ce=n.useRef("".concat(de,"-").concat(o,"-").concat(l.v4())),he=n.useRef("".concat(l.v4())),ve=r,me=n.useRef(null),fe=n.useRef(!0),ge=n.useRef(null),Ce=n.useRef(null),pe=n.useState(""),_e=pe[0],xe=pe[1],Se=n.useState([]),ye=Se[0],be=Se[1],Re=n.useState(!1),je=Re[0],we=Re[1],ke=n.useState(!1);ke[0];var Ee=ke[1],Me=n.useState(!0),Te=Me[0],Ie=Me[1],Ae=n.useState(!0);Ae[0];var Ne=Ae[1],De=n.useState("");De[0];var qe=De[1],Le=n.useState(""),Fe=Le[0],We=Le[1],Be=n.useState(!1),ze=Be[0],Pe=Be[1],He=n.useState(!1),Ue=He[0],Ze=He[1],Ke=n.useState(!0),Oe=Ke[0],Ge=Ke[1],Ve=n.useState("100%");Ve[0];var Je=Ve[1],Qe=n.useState(null),Xe=Qe[0],Ye=Qe[1],$e=n.useState(!1);$e[0];var et=$e[1],tt=n.useState(!1),nt=tt[0],at=tt[1],st=n.useRef(null),it=n.useRef(new Set),ot=n.useState(null),rt=ot[0],lt=ot[1],ut=n.useState(!1),dt=ut[0],ct=ut[1],ht=n.useState(!1);ht[0],ht[1];var vt=n.useState(null);vt[0],vt[1],n.useRef(null),n.useRef(null);var mt=n.useRef(new Map),ft=n.useRef(""),gt=a.keyframes(R||(R=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 "]))),Ct=n.useMemo(function(){return""===(null==_e?void 0:_e.trim())||ze},[_e,ze]),pt=n.useMemo(function(){return q},[q]),_t=n.useMemo(function(){return Ct||ze||q},[Ct,ze,q]);n.useEffect(function(){null==oe||oe(ze)},[ze,oe]),n.useEffect(function(){var e=me.current,t=function(){if(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;Ge(n-t-a<=20)}};return e&&(e.addEventListener("scroll",t),t()),function(){e&&e.removeEventListener("scroll",t)}},[ye]);var xt=_.useHeaderObserver({handlers:W,setResult:B}).processHeaderMessage;n.useEffect(function(){Y&&at(!0)},[Y]),n.useEffect(function(){if(dt){var e=setTimeout(function(){ct(!1)},3e3);return function(){return clearTimeout(e)}}},[dt]),n.useEffect(function(){T&&(wt(new KeyboardEvent("keydown",{key:"Enter"}),!1,"Save this Learning"),I(!1))},[T]),n.useEffect(function(){if(N)try{if(N.startsWith("__SKELETON__:")){var t=N.split(":"),n=t[1],a=t.slice(2).join(":"),s={role:"user",content:"",id:n,time:new Date,isSkeleton:!0,skeletonContent:a};return be(function(t){return e.__spreadArray(e.__spreadArray([],t,!0),[s],!1)}),wt(new KeyboardEvent("keydown",{key:"Enter"}),!1,a,!1,n),lt(n),D&&D(""),void setTimeout(function(){lt(null)},2e3)}if(N.startsWith("__SKELETON_END__::")){var i=N.split("::")[1]||"";return be(function(t){return t.map(function(t){return t.isSkeleton?e.__assign(e.__assign({},t),{isSkeleton:!1,content:t.skeletonContent||i}):t})}),void(D&&D(""))}var o=l.v4();wt(new KeyboardEvent("keydown",{key:"Enter"}),!1,N,!1,o),lt(o),D&&D(""),setTimeout(function(){return lt(null)},2e3)}catch(e){console.error("Error handling sendMessageInChat signal",e)}},[N]),n.useEffect(function(){yt(),bt();var e=function(){var e,t=(null===(e=null==st?void 0:st.current)||void 0===e?void 0:e.clientHeight)||0,n="calc(100% - ".concat(t,"px - 10px)");Je(n)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var St=n.useCallback(function(e){var t="string"==typeof e?e:"smooth";ge.current&&ge.current.scrollIntoView({behavior:t,block:"end"}),fe.current&&setTimeout(function(){ge.current&&fe.current&&ge.current.scrollIntoView({behavior:t,block:"end"})},100)},[]);n.useEffect(function(){if(!ze){var t="";if(nt?t=$||"Thank you teacher for teaching me, your rule has been saved successfully.":te&&(t=ae||"I'm sorry, I couldn't save your changes. Please try again."),t){var n={role:"assistant",content:t,id:l.v4(),citations:[],time:new Date};be(function(t){return e.__spreadArray(e.__spreadArray([],t,!0),[n],!1)}),at(!1),setTimeout(function(){return St("smooth")},100)}}},[nt,te,ze,$,ae,St]),n.useEffect(function(){fe.current&&St("smooth")},[St]);var yt=function(){var e={method:"get",maxBodyLength:1/0,url:"".concat(ve,"/api/chatbot/getChatSettings?name=").concat(de,"&organizationName=").concat(o),headers:{}};E.default.request(e).then(function(e){var t,n,a;(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.chatSettings)&&""!==(null===(a=null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.chatSettings)||void 0===a?void 0:a.chatInitialMessage)&&Ne(!0)}).catch(function(e){console.error(e)})},bt=function(){return e.__awaiter(void 0,void 0,void 0,function(){var t,n;return e.__generator(this,function(e){t="".concat(ve,"/api/chat/history?name=").concat(de,"&organizationName=").concat(o);try{n={method:"GET",params:{guestSessionId:ce.current},withCredentials:!0},E.default.get(t,n).then(function(e){var t=e.data;t.length>0?(be(t),St()):Ne(!0)}).catch(function(e){console.error(e)})}catch(e){we(!1),console.error(e)}return[2]})})};function Rt(e){return null==e?void 0:e.replace(/<a [^>]*>.*?<\/a>/g,function(e){return null==e?void 0:e.replace(/\*/g,"*")})}var jt=function(t,n,a,s,i,o,r){var u,d,c,h,v,m,f,g,C,p,_,x,S,y,b,R,j,w,k,E,M,T,I,A,N,D,q,L,F,W,B,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};xt(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&&G&&G(O);var V={role:"assistant",content:"",id:l.v4()};if(null===(_=null===(p=null===(C=null===(g=null==t?void 0:t.chatStream)||void 0===g?void 0:g.continueChatResult)||void 0===C?void 0:C.message)||void 0===p?void 0:p.content)||void 0===_?void 0:_.includes("WaitMessage: "))Ee(!0),V.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"),""!==V.content&&(we(!1),be(e.__spreadArray(e.__spreadArray([],ye,!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:""},V],!1)));else{Ee(!1),V.content=null===(E=Rt(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&&Q&&Q(J);var X=function(t,n,a){var s,i,o,r,u,d,c,h,v,m,f,g,C,p,_,x,S,y,b,R,j,w,k,E,M,T,I,A,N,D,q,L,F,W,B={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)&&(B.content=Rt(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)&&(B.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===(p=null===(C=t.chatStream)||void 0===C?void 0:C.continueChatResult)||void 0===p?void 0:p.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)&&(B.content=Rt(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===(A=null===(I=t.chatStream)||void 0===I?void 0:I.continueChatResult)||void 0===A?void 0:A.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!==(W=t.chatStream.continueChatResult.explainability_id)&&void 0!==W?W:"",isParallelToolResponse:!1})}return e.__assign({orchestratorAndAgentsMessages:n},B)}(t,a,n);X.time=new Date,X.citations=O,X.isEnd=null===(A=null===(I=null==t?void 0:t.chatStream)||void 0===I?void 0:I.continueChatResult)||void 0===A?void 0:A.isEnd,X.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,X.sessionId=ce.current,null===(q=X.orchestratorAndAgentsMessages)||void 0===q||q.forEach(function(e){e&&e.header_message&&xt(e)}),(""!==(null==X?void 0:X.content)||(null==X?void 0:X.orchestratorAndAgentsMessages)&&(null==X?void 0:X.orchestratorAndAgentsMessages.length)>0)&&(we(!1),be(e.__spreadArray(e.__spreadArray([],ye,!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===(B=null===(W=null==t?void 0:t.chatStream)||void 0===W?void 0:W.continueChatResult)||void 0===B?void 0:B.requestId)&&void 0!==z?z:""},X],!1))),Ie(null===(H=null===(P=null==t?void 0:t.chatStream)||void 0===P?void 0:P.continueChatResult)||void 0===H?void 0:H.isEnd)}},wt=function(t,n,a,s,i,r){var d,c,h=(void 0!==a?a:_e||"").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||ze&&!a||(null==t?void 0:t.key)&&!v)){if("I want to add a rule description"===h){Ie(!1),fe.current=!0,Pe(!0),!Xe&&h&&Ye(a||"manual_entry");var m=new Date;return be(function(t){return e.__spreadArray(e.__spreadArray([],t.map(function(t,n){var a;return e.__assign(e.__assign({},t),{content:null===(a=Rt(t.content))||void 0===a?void 0:a.replace("WaitMessage: ","")})}),!0),[{role:"user",content:h,time:m,isFirstQuestionSent:!1,id:i||l.v4()}],!1)}),St("smooth"),void setTimeout(function(){be(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)}),St("smooth"),setTimeout(function(){Pe(!1),Ie(!0)},500)},500)}Ie(!1),fe.current=!0,Pe(!0),!Xe&&h&&Ye(a||"manual_entry");var f=new Date;be(function(t){var n=t.map(function(t){var n;return e.__assign(e.__assign({},t),{content:null===(n=Rt(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)}),St("smooth");var g=new Map,C=[],p={WEBSOCKET_URL:b,organizationName:o,chatAssistantName:de,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:ce.current,chatPreviewId:he.current,customMetaData:F,aiModel:"",onStreamEvent:function(e){return jt(e,g,C,f,h,n,i)},onStreamEnd:function(t){Ie(!0),Pe(!1),et(!1);var n=Date.now(),a=mt.current.get(ft.current);if(a){var s=Math.round((n-a)/1e3).toFixed(1);be(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){console.error("Stream error:",e),Ie(!0),Pe(!1),et(!1)}};if(h)we(!0),null===(c=Ce.current)||void 0===c||c.blur(),xe(""),St(),We(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."),mt.current.set(p.requestId,Date.now()),ft.current=p.requestId,u.startChatStream(p);r&&r(!1)}},kt=n.useRef(null);n.useLayoutEffect(function(){kt.current=wt});var Et=n.useCallback(function(){for(var t,n=[],a=0;a<arguments.length;a++)n[a]=arguments[a];return null===(t=kt.current)||void 0===t?void 0:t.call.apply(t,e.__spreadArray([kt],n,!1))},[]),Mt=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=Xe===o||Xe===r,u=!!Xe,d="Tester Genie"===o;return t.jsx(m.ActionableButton,e.__assign({},i,{className:a,handleStream:Et,isStreamEnd:Te,disabled:u,isLastMessage:!0,style:{margin:0},isTesterGenie:d,"data-selected":l?"true":Xe?"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"})]}))]}))}))}}},[Et,Te,Xe]),Tt=n.useMemo(function(){return ye.some(function(e){return e.isSkeleton})},[ye]),It=function(t){return e.__awaiter(void 0,void 0,void 0,function(){return e.__generator(this,function(n){switch(n.label){case 0:return ue?[4,ue(t)]:[3,2];case 1:n.sent(),be(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 St("smooth")},100),n.label=2;case 2:return[2]}})})};return console.log(ye,"rendering messages"),t.jsxs("div",e.__assign({className:"".concat(C.default.customFont," ").concat(g.default.chatContainer),style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:ie&&!Tt?"0 0 20px 5px rgba(37, 99, 235, 0.5)":"none"}},{children:[t.jsxs("div",e.__assign({ref:me,className:g.default.scrollWrapper},{children:[t.jsx("div",e.__assign({ref:st,className:g.default.stickyHeader},{children:t.jsx(c.default,{resetChatHistory:function(){var e="".concat(ve,"/api/chat/resetHistory?name=").concat(de,"&organizationName=").concat(o);try{var t={method:"GET",params:{guestSessionId:ce.current},withCredentials:!0};E.default.get(e,t).then(function(){M(!0),qe(""),Ye(null),it.current.clear(),he.current="".concat(l.v4()),be([]),Ne(!0),null==z||z(),A&&A()}).catch(function(e){console.error(e)}).finally(function(){ce.current="".concat(de,"-").concat(o,"-").concat(l.v4())})}catch(e){we(!1),console.error(e)}},isStreamEnd:Te,chatTitle:L,onResize:K,chatSize:Z,movingTowards:O})})),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(w.default,e.__assign({rehypePlugins:[k.default],components:Mt},{children:H}))})}))}))]})),ye.length>0&&ye.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:Te,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:ye,handleStream:wt,isLastMessage:a===ye.length-1,onSave:U,citations:null==n?void 0:n.citations,setChatSize:K,chatSize:Z,isStreamEnd:Te,messageIsEnd:null==n?void 0:n.isEnd,onViewComparison:re,onTypeResponseClick:function(){var e;ct(!0),null===(e=Ce.current)||void 0===e||e.focus()},onComparisonLinkClick:le,baseURL:ve,onFeedbackSubmit:It}),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||Tt||n.id!==rt?"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:ye,handleStream:wt,isLastMessage:a===ye.length-1,onSave:U,citations:null==n?void 0:n.citations,isStreamEnd:Te,messageIsEnd:null==n?void 0:n.isEnd,onViewComparison:re,onComparisonLinkClick:le,baseURL:ve,onFeedbackSubmit:It}),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)}),je&&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:Fe})}))]})),t.jsx("div",{ref:ge,style:{float:"left",clear:"both"}})]}))]})),t.jsxs("div",e.__assign({className:g.default.inputAreaWrapper},{children:[ze&&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(gt," 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(gt," 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(gt," 1.4s infinite ease-in-out both")}})]})),t.jsx(j.default,e.__assign({title:q?"Please wait for the validation to be completed.":""},{children:t.jsxs("div",e.__assign({className:"".concat(g.default.inputBoxContainer," ").concat(pt?g.default.disabled:""),style:dt?{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:[ye.length>0&&!Oe&&t.jsx("div",e.__assign({onMouseDown:function(e){e.preventDefault(),St("smooth")},className:g.default.scrollToBottomBtn},{children:t.jsx(p.ScrollToBottom,{})})),t.jsxs("div",e.__assign({style:{width:"100%",display:"flex"}},{children:[t.jsx("textarea",{ref:Ce,placeholder:J,value:_e||"",onChange:function(e){xe(e.target.value)},onFocus:function(){return Ze(!0)},onBlur:function(){return Ze(!1)},onKeyDown:function(e){return wt(e)},disabled:pt,className:"no-scrollbar ".concat(g.default.chatTextarea),style:{minHeight:Ue?"120px":"50px",height:Ue?"120px":"50px",maxHeight:"120px"}}),t.jsx("span",e.__assign({className:g.default.sendButtonWrapper},{children:t.jsx("button",e.__assign({onClick:function(e){wt(new KeyboardEvent("keydown",{key:"Enter"}))},disabled:_t,className:"".concat(g.default.sendButton," ").concat(_t?g.default.disabled:g.default.active)},{children:t.jsx(x.SendButton,{})}))}))]}))]}))}))]})),t.jsxs("div",e.__assign({className:g.default.footerTools},{children:[t.jsx(j.default,e.__assign({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:t.jsx("span",e.__assign({className:g.default.footerToolItem},{children:t.jsx(f.default,{amplitude:1,variant:"speaker",isActive:!1,onClick:function(){return null},disabled:!1})}))})),t.jsx(j.default,e.__assign({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:t.jsx("span",e.__assign({className:g.default.footerToolItem},{children:t.jsx(f.default,{amplitude:1,variant:"microphone",isActive:!1,onClick:function(){return null},disabled:!1})}))}))]}))]}))};
|
|
2
2
|
//# sourceMappingURL=NormalChat.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),s=require("react/jsx-runtime"),a=require("lucide-react"),i=require("@mui/material"),n=require("../InstantLearning.module.css.js"),t=require("./ILPopup.styles.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),s=require("react/jsx-runtime"),a=require("lucide-react"),i=require("@mui/material"),n=require("../InstantLearning.module.css.js"),t=require("./ILPopup.styles.js"),o=require("./templates/TemplatesMap/templatesMap.js");exports.default=function(l){var r=l.customSections,d=l.showCustomSections,c=void 0===d||d,u=l.onSave,g=l.formHeader,m=l.onClose,p=l.validateCustom,v=l.template,x=l.templateProps,f=l.isLoading,h=l.saveButtonConfig,_=void 0===h?{label:"Save Learning",loadingLabel:"Saving Learning..."}:h,b=l.isAiStreaming,j=void 0!==b&&b,y=l.showSaveWithoutValidation,S=l.saveWithoutValBtnConfig,C=void 0===S?{label:"Save w/o validation",loadingLabel:"Saving w/o validation..."}:S,L=l.onSaveWithoutValidation,q=l.saveButtonColor,w=v?o.TemplateMap[v]:null,N=!p||p();return s.jsxs(s.Fragment,{children:[s.jsx("style",{children:t.componentStyles}),s.jsxs("div",e.__assign({className:"il-popup-container ".concat(n.default.customFont)},{children:[s.jsxs("div",e.__assign({className:"form-header"},{children:[s.jsx(i.Typography,e.__assign({sx:{fontSize:"1.125rem",fontWeight:500,lineHeight:"1.82rem",fontFamily:'"Plus Jakarta Sans", sans-serif'}},{children:g})),s.jsx("div",e.__assign({onClick:m,style:{cursor:"pointer"}},{children:s.jsx(a.X,{})}))]})),s.jsx("div",e.__assign({style:{flexGrow:1,display:"flex",flexDirection:"column",width:"100%",padding:"20px 24px",overflowY:"auto",borderBottom:"1px solid #E7E7E9"}},{children:s.jsxs("div",e.__assign({className:"sections-space"},{children:[w&&s.jsx(w,e.__assign({},x)),c&&r]}))})),s.jsxs("div",e.__assign({className:"save-button-container"},{children:[y&&s.jsxs("button",e.__assign({className:"save-button-secondary",onClick:function(){L&&N&&L()},disabled:f||!N||j},{children:[s.jsx(a.TriangleAlert,{size:16,style:{marginRight:"4px"}}),f?C.loadingLabel:C.label]})),s.jsx("button",e.__assign({className:"save-button",onClick:function(){!p||p()?(u(),console.log("Form Data to Save:")):console.error("Please fill all required fields before saving the learning.")},disabled:f||!N||j,style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",maxWidth:"fit-content",backgroundColor:q,borderColor:q}},{children:f?_.loadingLabel:_.label}))]}))]}))]})};
|
|
2
2
|
//# sourceMappingURL=ILPopup.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreateCategory.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r,t=require("../Testing/Testing.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r,t=require("../CreateCategory/CreateCategory.js"),a=require("../Testing/Testing.js"),o=require("../TrafficManager/CreateRule.js"),s=require("../TrafficManager/TrafficManagerTemplate.js"),p=require("../WorkflowComposer/WorkflowComposer.js");exports.TemplateList=void 0,(r=exports.TemplateList||(exports.TemplateList={})).TrafficManager="TRAFFIC_MANAGER",r.testing="TESTING",r.CreateRule="CREATE_RULE",r.WorkflowComposer="WORKFLOW_COMPOSER",r.CreateCategory="CREATE_CATEGORY";var i=((e={})[exports.TemplateList.TrafficManager]=s.TrafficManagerTemplate,e[exports.TemplateList.testing]=a.Testing,e[exports.TemplateList.CreateRule]=o.CreateRule,e[exports.TemplateList.WorkflowComposer]=p.WorkflowComposer,e[exports.TemplateList.CreateCategory]=t.CreateCategory,e);exports.TemplateMap=i;
|
|
2
2
|
//# sourceMappingURL=templatesMap.js.map
|