@e-llm-studio/instant-learning 0.0.285 → 0.0.287
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/IL-OTJ/_components/AccordianSection.js +1 -1
- package/dist/cjs/features/IL-OTJ/_components/ChatComponents/ChatComponent.js +1 -1
- package/dist/cjs/features/IL-OTJ/_components/templates/TrafficManager/CreateRule.js +1 -1
- package/dist/features/IL-OTJ/_components/AccordianSection.js +1 -1
- package/dist/features/IL-OTJ/_components/ChatComponents/ChatComponent.js +1 -1
- package/dist/features/IL-OTJ/_components/templates/TrafficManager/CreateRule.js +1 -1
- package/dist/types/src/features/IL-OTJ/_components/AccordianSection.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/ChatComponents/ChatComponent.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/templates/TrafficManager/CreateRule.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"),i=require("react/jsx-runtime"),n=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),n=require("react"),s=require("lucide-react"),r=require("./TooltipComponent.js");exports.default=function(t){var o,d,l=t.title,a=t.subtitle,p=t.children,x=t.defaultOpen,c=void 0===x||x,g=t.footerData,f=t.readOnly,u=void 0!==f&&f,h=t.variant,_=void 0===h?"default":h,v=t.expanded,j=t.onToggle,y=t.actionButtons,b=t.isAiStreaming,F=t.editFlow,m=void 0!==F&&F,w=n.useState(c),C=w[0],D=w[1];n.useEffect(function(){D(c)},[c]);var E=void 0!==v,S=E?v:C,z=function(){E?null==j||j():D(!S)},k="variant"===l.type,I="other"===l.type,B="tier-header"===_,R="rule-behavior"===_,T={padding:"12px 14px 0px 14px",display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",borderRadius:B?"0px":"8px",borderBottom:B?"1px solid #E2E8F0":"none"},A={alignItems:"center",gap:"8px",margin:0,fontSize:"12px",fontWeight:600,padding:I?"":"6px 10px",borderRadius:"4px",color:u?"#717b8c":B&&S?"#2563EB":"#19213D",backgroundColor:R&&!l.isNewVariant?"#F7F8FA":k?"#FDF2F8":l.isDefault?"#F7F8FA":"transparent",border:k?"1px solid #FCE7F3":l.isDefault?"1px solid #F0F2F5":"none"},W={fontSize:"12px",fontWeight:400,color:"#666F8D",paddingLeft:I?"0px":"10px"},q={badge:{display:"inline-flex",alignItems:"center",gap:"8px",backgroundColor:"#f0fdf4",color:"#367c46",padding:"6px 10px",borderRadius:"8px",border:"1px solid #e1f6e8",fontSize:"12px",fontWeight:"600",lineHeight:"1.2",width:"fit-content"},defaultTag:{backgroundColor:"#f0f4f8",color:"#475569",fontSize:"11px",fontWeight:"600",padding:"2px 8px",borderRadius:"4px",textTransform:"uppercase",border:"1px solid #cbd5e1"},modifiedTag:{boxSizing:"border-box",display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",padding:"2px 8px",backgroundColor:"#FFFAE3",border:"1px solid #FDEDAA",borderRadius:"4px",color:"#854D0E",fontSize:"11px",fontWeight:"700",letterSpacing:"0.5px"}},L={width:"100%",backgroundColor:"#ffffff",overflow:"hidden",border:B?"none":R&&S?"1px solid #2563EB":"1px solid #E2E8F0",borderRadius:"8px",marginBottom:"0px"};return i.jsxs("div",e.__assign({style:L},{children:[i.jsxs("div",e.__assign({onClick:z,style:T},{children:[i.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:"4px",margin:0,fontSize:"12px",fontWeight:600,borderRadius:"4px"}},{children:[!l.isNewVariant&&i.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[i.jsx("div",e.__assign({style:A},{children:l.label})),l.isDefault&&i.jsx("span",e.__assign({style:q.defaultTag},{children:"Default"})),l.isModified&&i.jsx("span",e.__assign({style:q.modifiedTag},{children:"MODIFIED"}))]})),i.jsx("div",{children:l.isNewVariant&&i.jsxs("div",e.__assign({style:q.badge},{children:[i.jsx("svg",e.__assign({width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor"},{children:i.jsx("path",{d:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"})})),i.jsx("div",{children:"New Variant"})]}))}),a&&i.jsx("div",e.__assign({style:W},{children:a}))]})),i.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"12px",paddingRight:"4px"}},{children:[y&&!b&&(m?i.jsx(r.default,e.__assign({description:"Coming Soon"},{children:i.jsx("div",e.__assign({onClick:function(e){return e.stopPropagation()},style:{cursor:"not-allowed",opacity:.6}},{children:i.jsx("div",e.__assign({style:{pointerEvents:"none"}},{children:y(S,function(){})}))}))})):i.jsx("div",e.__assign({onClick:function(e){return e.stopPropagation()}},{children:y(S,z)}))),i.jsx("div",e.__assign({onClick:z,style:{cursor:"pointer",display:"flex",alignItems:"center"}},{children:S?i.jsx(s.ChevronUp,{size:18,color:B?"#2563EB":"#64748B"}):i.jsx(s.ChevronDown,{size:18,color:"#64748B"})}))]}))]})),!S&&g&&i.jsx("div",e.__assign({style:{fontSize:"12px",color:"#475569",fontWeight:400,padding:"0 16px 12px 16px",display:"flex",alignItems:"center",gap:"8px"}},{children:I?i.jsxs(i.Fragment,{children:[i.jsx("span",e.__assign({style:{fontWeight:500,color:"#475569"}},{children:g.ruleTitle||"No Title"})),(null!==(d=null===(o=g.tiers)||void 0===o?void 0:o.length)&&void 0!==d?d:0)>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{width:"4px",height:"4px",backgroundColor:"#676970",borderRadius:"50%"}}),i.jsx("span",{children:Array.isArray(g.tiers)?g.tiers.join(", "):g.tiers})]})]}):i.jsx("span",e.__assign({style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},{children:g.description}))})),S&&i.jsx("div",e.__assign({style:{padding:"12px"}},{children:p}))]}))};
|
|
2
2
|
//# sourceMappingURL=AccordianSection.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),a=require("@mui/material"),s=require("@mui/material/Tooltip"),i=require("react-markdown"),r=require("rehype-raw"),o=require("axios"),l=require("uuid"),d=require("@e-llm-studio/streaming-response"),u=require("@e-llm-studio/watch-me-work"),c=require("./ChatHeader.js"),v=require("../MessageRendering/MessageRendering.js"),h=require("../atoms/SkeletonLoader/SkeletonLoader.js"),m=require("../MessageRendering/ClickableChatComponents.js"),f=require("../AudioWaveform.js"),g=require("./ChatComponent.module.css.js"),p=require("../../InstantLearning.module.css.js"),_=require("../_svg/ScrollToBottom.js"),C=require("../../helpers/utils.js"),x=require("../_svg/SendButton.js"),y=require("../_svg/SparkleIcon.js"),S=require("../_svg/UserIcon.js");function b(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var j,w=b(s),k=b(i),E=b(r),M=b(o);exports.autoGeneratePrompt=function(e,n){return M.default.post("".concat(e||"https://devllmstudio.creativeworkspace.ai","/api/chat/chatResponse"),{name:"ilggcautopromptgen",organizationName:"techolution",prompt:n||"Generate a query"},{headers:{"Content-Type":"application/json"},withCredentials:!0}).then(function(e){return e.data}).catch(function(e){throw console.error("Error calling auto-generate API:",e),e})},exports.default=function(s){var i=s.chatAssistantName,r=s.organizationName,o=s.baseUrl;s.baseWebsocketUrl;var b=s.setIsNewChatClicked;s.ThinkingBulbIconComponent;var T=s.isFormSaveClicked,R=s.setIsFormSavedClicked,A=s.onResetLearningData,I=s.sendMessageInChat,N=s.setSendMessageInChat,D=s.isFormValidating,q=s.chatTitle,F=s.customMetaData,L=s.headerMessageHandlers;s.aiResponse;var W=s.setAIResponse,P=s.onResetChat,z=s.initialChatMessage,B=void 0===z?"":z,H=s.onSave,G=s.chatSize,U=s.setChatSize,Z=s.movingTowards,K=s.setCitations,O=s.textareaPlaceholder,V=void 0===O?"Tell me more about this learning...":O,Q=s.setCurrentRequestId,J=s.showSavedMessage,$=void 0!==J&&J,X=s.savedMessage,Y=s.isError,ee=void 0!==Y&&Y,ne=s.errorMessage,te=void 0===ne?"There was an error saving your changes.":ne;s.isSaving;var ae=s.isHighlighted,se=void 0!==ae&&ae,ie=s.onStreamingStateChange,re=s.onViewComparison;s.isCopyEnabled;var oe=s.onComparisonLinkClick,le=s.onSubmitFeedback,de=s.userDetails,ue=s.isGlobalEditActive,ce=i,ve=t.useRef("".concat(ce,"-").concat(r,"-").concat(l.v4())),he=t.useRef("".concat(l.v4())),me=o,fe=t.useRef(null),ge=t.useRef(!0),pe=t.useRef(null),_e=t.useRef(null),Ce=t.useState(""),xe=Ce[0],ye=Ce[1],Se=t.useState([]),be=Se[0],je=Se[1],we=t.useState(!1),ke=we[0],Ee=we[1],Me=t.useState(!1);Me[0];var Te=Me[1],Re=t.useState(!0),Ae=Re[0],Ie=Re[1],Ne=t.useState(!0);Ne[0];var De=Ne[1],qe=t.useState("");qe[0];var Fe=qe[1],Le=t.useState(""),We=Le[0],Pe=Le[1],ze=t.useState(!1),Be=ze[0],He=ze[1],Ge=t.useState(!1),Ue=Ge[0],Ze=Ge[1],Ke=t.useState(!0),Oe=Ke[0],Ve=Ke[1],Qe=t.useState("100%");Qe[0];var Je=Qe[1],$e=t.useState(null),Xe=$e[0],Ye=$e[1],en=t.useState(!1);en[0];var nn=en[1],tn=t.useState(!1),an=tn[0],sn=tn[1],rn=t.useRef(null),on=t.useRef(new Set),ln=t.useState(null),dn=ln[0],un=ln[1],cn=t.useState(!1),vn=cn[0],hn=cn[1],mn=t.useState(!1);mn[0],mn[1];var fn=t.useState(null);fn[0],fn[1],t.useRef(null),t.useRef(null);var gn=t.useRef(new Map),pn=t.useRef(""),_n=t.useRef(new Map);a.keyframes(j||(j=e.__makeTemplateObject(["\n 0%, 80%, 100% {\n transform: scale(0);\n }\n 40% {\n transform: scale(1.0);\n }\n "],["\n 0%, 80%, 100% {\n transform: scale(0);\n }\n 40% {\n transform: scale(1.0);\n }\n "])));var Cn=t.useMemo(function(){return""===(null==xe?void 0:xe.trim())||Be},[xe,Be]),xn=t.useMemo(function(){return D},[D]),yn=t.useMemo(function(){return Cn||Be||D||!!ue},[Cn,Be,D,ue]);t.useEffect(function(){null==ie||ie(Be)},[Be,ie]),t.useEffect(function(){var e=fe.current,n=function(){if(e){var n=e.scrollTop,t=e.scrollHeight,a=e.clientHeight;Ve(t-n-a<=20)}};return e&&(e.addEventListener("scroll",n),n()),function(){e&&e.removeEventListener("scroll",n)}},[be]);var Sn=C.useHeaderObserver({handlers:L,setResult:W}).processHeaderMessage;t.useEffect(function(){$&&sn(!0)},[$]),t.useEffect(function(){if(vn){var e=setTimeout(function(){hn(!1)},3e3);return function(){return clearTimeout(e)}}},[vn]),t.useEffect(function(){T&&!ue&&(Mn(new KeyboardEvent("keydown",{key:"Enter"}),!1,"Save this Learning"),R(!1))},[T]),t.useEffect(function(){if(I)try{if(I.startsWith("__SKELETON__:")){var n=I.split(":"),t=n[1],a=n.slice(2).join(":"),s={role:"user",content:"",id:t,time:new Date,isSkeleton:!0,skeletonContent:a};return je(function(n){return e.__spreadArray(e.__spreadArray([],n,!0),[s],!1)}),Mn(new KeyboardEvent("keydown",{key:"Enter"}),!1,a,!1,t),un(t),N&&N(""),void setTimeout(function(){un(null)},2e3)}if(I.startsWith("__SKELETON_END__::")){var i=I.split("::")[1]||"";return je(function(n){return n.map(function(n){return n.isSkeleton?e.__assign(e.__assign({},n),{isSkeleton:!1,content:n.skeletonContent||i}):n})}),void(N&&N(""))}var r=l.v4();Mn(new KeyboardEvent("keydown",{key:"Enter"}),!1,I,!1,r),un(r),N&&N(""),setTimeout(function(){return un(null)},2e3)}catch(e){console.error("Error handling sendMessageInChat signal",e)}},[I]),t.useEffect(function(){jn(),wn();var e=function(){var e,n=(null===(e=null==rn?void 0:rn.current)||void 0===e?void 0:e.clientHeight)||0,t="calc(100% - ".concat(n,"px - 10px)");Je(t)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var bn=t.useCallback(function(e){var n="string"==typeof e?e:"smooth";pe.current&&pe.current.scrollIntoView({behavior:n,block:"end"}),ge.current&&setTimeout(function(){pe.current&&ge.current&&pe.current.scrollIntoView({behavior:n,block:"end"})},100)},[]);t.useEffect(function(){if(!Be){var n="";if(an?n=X||"Thank you teacher for teaching me, your rule has been saved successfully.":ee&&(n=te||"I'm sorry, I couldn't save your changes. Please try again."),n){var t={role:"assistant",content:n,id:l.v4(),citations:[],time:new Date};je(function(n){return e.__spreadArray(e.__spreadArray([],n,!0),[t],!1)}),sn(!1),setTimeout(function(){return bn("smooth")},100)}}},[an,ee,Be,X,te,bn]),t.useEffect(function(){ge.current&&bn("smooth")},[bn]);var jn=function(){var e={method:"get",maxBodyLength:1/0,url:"".concat(me,"/api/chatbot/getChatSettings?name=").concat(ce,"&organizationName=").concat(r),headers:{}};M.default.request(e).then(function(e){var n,t,a;(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.chatSettings)&&""!==(null===(a=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.chatSettings)||void 0===a?void 0:a.chatInitialMessage)&&De(!0)}).catch(function(e){console.error(e)})},wn=function(){return e.__awaiter(void 0,void 0,void 0,function(){var n,t;return e.__generator(this,function(e){n="".concat(me,"/api/chat/history?name=").concat(ce,"&organizationName=").concat(r);try{t={method:"GET",params:{guestSessionId:ve.current},withCredentials:!0},M.default.get(n,t).then(function(e){var n=e.data;n.length>0?(je(n),bn()):De(!0)}).catch(function(e){console.error(e)})}catch(e){Ee(!1),console.error(e)}return[2]})})};function kn(e){return null==e?void 0:e.replace(/<a [^>]*>.*?<\/a>/g,function(e){return null==e?void 0:e.replace(/\*/g,"*")})}var En=function(n,t,a,s,i,r,o){var d,u,c,v,h,m,f,g,p,_,C,x,y,S,b,j,w,k,E,M,T,R,A,I,N,D,q,F,L,W;if(null===(u=null===(d=null==n?void 0:n.chatStream)||void 0===d?void 0:d.continueChatResult)||void 0===u?void 0:u.header_message){var P={header_message:n.chatStream.continueChatResult.header_message,responsedata:null===(h=null===(v=null===(c=null==n?void 0:n.chatStream)||void 0===c?void 0:c.continueChatResult)||void 0===v?void 0:v.message)||void 0===h?void 0:h.content};Sn(P)}var z=null===(m=null==n?void 0:n.chatStream)||void 0===m?void 0:m.continueChatResult,B=null==z?void 0:z.isEnd,H=(null===(f=null==z?void 0:z.message)||void 0===f?void 0:f.citations)||[];B&&H.length>0&&K&&K(H);var G={role:"assistant",content:"",id:l.v4()};if(null===(C=null===(_=null===(p=null===(g=null==n?void 0:n.chatStream)||void 0===g?void 0:g.continueChatResult)||void 0===p?void 0:p.message)||void 0===_?void 0:_.content)||void 0===C?void 0:C.includes("WaitMessage: "))Te(!0),G.content=function(e){var n="WaitMessage: ",t=e.indexOf(n);if(-1!==t){var a=e.substring(t+13);return null==a?void 0:a.replaceAll("WaitMessage: ","")}return""}((null===(S=null===(y=null===(x=null==n?void 0:n.chatStream)||void 0===x?void 0:x.continueChatResult)||void 0===y?void 0:y.message)||void 0===S?void 0:S.content)+"\n\n"),""!==G.content&&(Ee(!1),je(e.__spreadArray(e.__spreadArray([],be,!0),[{role:"user",content:i,time:s,isFirstQuestionSent:r||!1,id:o||(null===(j=null===(b=null==n?void 0:n.chatStream)||void 0===b?void 0:b.continueChatResult)||void 0===j?void 0:j.requestId)||"",reply:""},G],!1)));else{Te(!1);var U=null===(k=null===(w=null==n?void 0:n.chatStream)||void 0===w?void 0:w.continueChatResult)||void 0===k?void 0:k.requestId;"string"==typeof U&&U&&Q&&Q(U);var Z=function(n,t,a,s){var i,r,o,d,u,c,v,h={role:"assistant",content:"",id:l.v4(),time:new Date,citations:[]},m=(null===(i=null==n?void 0:n.chatStream)||void 0===i?void 0:i.continueChatResult)||{},f=null==m?void 0:m.requestId,g=null==m?void 0:m.preserve_message,p=null==m?void 0:m.isEnd,_=(null===(r=null==m?void 0:m.message)||void 0===r?void 0:r.content)||"",C=null==m?void 0:m.is_orchestrator,x=null==m?void 0:m.thinking_break,y=(null===(o=null==m?void 0:m.message)||void 0===o?void 0:o.citations)||[];if(f&&g&&_&&!p){var S=s.current.get(f)||[];S[S.length-1]!==_&&(S.push(_),s.current.set(f,S))}var b=(f&&s.current.get(f)||[]).join("\n\n"),j="";if(p)j=b&&""!==b.trim()?b:_;else if(g)j=b;else{var w=_.replace(/<!--(?![\s\S]*-->)[\s\S]*$/,"").trimEnd(),k=!1===C||x||0!==y.length?"":w;j=b?"".concat(b,"\n\n").concat(k):k}if(h.content=kn(j),!0===(null==m?void 0:m.thinking_break)&&!0===(null==m?void 0:m.is_orchestrator)&&!1===(null==m?void 0:m.isEnd)&&t.push({responsedata:_,responseFrom:m.responded_by,header_message:m.header_message,finalResponseStatus:!1}),!1===(null==m?void 0:m.thinking_break)&&!1===(null==m?void 0:m.is_orchestrator)&&!1===(null==m?void 0:m.isEnd)){if(m.explainability_id&&m.responded_by){var E=m.explainability_id,M=m.responded_by;a.has(E)||a.set(E,{responded_by:M,index:t.length})}a.has(m.explainability_id)?t[null==(T=a.get(m.explainability_id))?void 0:T.index]={responsedata:_,responseFrom:m.responded_by,header_message:m.header_message,finalResponseStatus:!0,explainability_id:null!==(d=m.explainability_id)&&void 0!==d?d:"",isParallelToolResponse:!0}:t=e.__spreadArray(e.__spreadArray([],t,!0),[{responsedata:_,responseFrom:m.responded_by,header_message:m.header_message,finalResponseStatus:!0,explainability_id:null!==(u=m.explainability_id)&&void 0!==u?u:"",isParallelToolResponse:!1}],!1)}if(!0===(null==m?void 0:m.thinking_break)&&!1===(null==m?void 0:m.is_orchestrator)&&!1===(null==m?void 0:m.isEnd)){var T;m.explainability_id&&m.responded_by&&(E=m.explainability_id,M=m.responded_by,a.has(E)||a.set(E,{responded_by:M,index:t.length})),a.has(m.explainability_id)?t[null==(T=a.get(m.explainability_id))?void 0:T.index]={responsedata:_,responseFrom:m.responded_by,header_message:m.header_message,finalResponseStatus:!1,explainability_id:null!==(c=m.explainability_id)&&void 0!==c?c:"",isParallelToolResponse:!0}:t.push({responsedata:_,responseFrom:m.responded_by,header_message:m.header_message,finalResponseStatus:!1,explainability_id:null!==(v=m.explainability_id)&&void 0!==v?v:"",isParallelToolResponse:!1})}return e.__assign({orchestratorAndAgentsMessages:t},h)}(n,a,t,_n);Z.time=new Date,Z.citations=H,Z.isEnd=null===(M=null===(E=null==n?void 0:n.chatStream)||void 0===E?void 0:E.continueChatResult)||void 0===M?void 0:M.isEnd,Z.requestId=null===(R=null===(T=null==n?void 0:n.chatStream)||void 0===T?void 0:T.continueChatResult)||void 0===R?void 0:R.requestId,Z.sessionId=ve.current,null===(A=Z.orchestratorAndAgentsMessages)||void 0===A||A.forEach(function(e){e&&e.header_message&&Sn(e)}),(""!==(null==Z?void 0:Z.content)||(null==Z?void 0:Z.orchestratorAndAgentsMessages)&&(null==Z?void 0:Z.orchestratorAndAgentsMessages.length)>0)&&(Ee(!1),je(e.__spreadArray(e.__spreadArray([],be,!0),[{role:"user",content:i||"",time:s,isFirstQuestionSent:r||!1,id:o||(null===(N=null===(I=null==n?void 0:n.chatStream)||void 0===I?void 0:I.continueChatResult)||void 0===N?void 0:N.requestId)||"",requestId:null!==(F=null===(q=null===(D=null==n?void 0:n.chatStream)||void 0===D?void 0:D.continueChatResult)||void 0===q?void 0:q.requestId)&&void 0!==F?F:""},Z],!1))),Ie(null===(W=null===(L=null==n?void 0:n.chatStream)||void 0===L?void 0:L.continueChatResult)||void 0===W?void 0:W.isEnd)}},Mn=function(n,t,a,s,i,u){var c,v,h,m,f,g=(void 0!==a?a:xe||"").trim(),p="Enter"===(null==n?void 0:n.key)&&!(null==n?void 0:n.shiftKey)&&!ue;if(p&&(null===(c=null==n?void 0:n.preventDefault)||void 0===c||c.call(n)),!(!g||Be&&!a||(null==n?void 0:n.key)&&!p)){if("I want to add a rule description"===g){Ie(!1),ge.current=!0,He(!0),!Xe&&g&&Ye(a||"manual_entry");var _=new Date;return je(function(n){return e.__spreadArray(e.__spreadArray([],n.map(function(n,t){var a;return e.__assign(e.__assign({},n),{content:null===(a=kn(n.content))||void 0===a?void 0:a.replace("WaitMessage: ","")})}),!0),[{role:"user",content:g,time:_,isFirstQuestionSent:!1,id:i||l.v4()}],!1)}),bn("smooth"),void setTimeout(function(){je(function(n){return e.__spreadArray(e.__spreadArray([],n,!0),[{role:"assistant",content:"I'd be happy to help you set up a new rule! To get started, could you tell me what kind of behavior or logic you would like this rule to follow?",id:l.v4(),citations:[],time:new Date}],!1)}),bn("smooth"),setTimeout(function(){He(!1),Ie(!0)},500)},500)}Ie(!1),ge.current=!0,He(!0),!Xe&&g&&Ye(a||"manual_entry");var C=new Date;je(function(n){var t=n.map(function(n){var t;return e.__assign(e.__assign({},n),{content:null===(t=kn(n.content))||void 0===t?void 0:t.replace("WaitMessage: ","")})});return i&&t.some(function(e){return e.id===i})?t.map(function(n){return n.id===i?e.__assign(e.__assign({},n),{content:g}):n}):e.__spreadArray(e.__spreadArray([],t,!0),[{role:"user",content:g,time:C,isFirstQuestionSent:!1,id:i||l.v4()}],!1)}),bn("smooth");var x=new Map,y=[],S={API_URL:o,organizationName:r,chatAssistantName:ce,selectedAIModel:"gpt-4",replyMessage:"",userName:null!==(v=null==de?void 0:de.name)&&void 0!==v?v:"Guest User",userEmailId:null!==(h=null==de?void 0:de.email)&&void 0!==h?h:"guestUser@example.com",userId:null!==(m=null==de?void 0:de.id)&&void 0!==m?m:"Guest User",query:g,requestId:"requestId-".concat(l.v4()),customPrompt:"",enableForBackend:!1,guestSessionId:ve.current,chatPreviewId:he.current,customMetaData:F,aiModel:"",onStreamEvent:function(e){return En(e,x,y,C,g,t,i)},onStreamEnd:function(n){Ie(!0),He(!1),nn(!1);var t=Date.now(),a=gn.current.get(pn.current);if(a){var s=Math.round((t-a)/1e3).toFixed(1);je(function(n){var t=e.__spreadArray([],n,!0).reverse().findIndex(function(e){return"assistant"===e.role});if(-1===t)return n;var a=n.length-1-t;return n.map(function(n,t){return t===a?e.__assign(e.__assign({},n),{finalTimeTaken:s}):n})})}},onError:function(e){console.error("Stream error:",e),Ie(!0),He(!1),nn(!1)}};if(g)Ee(!0),null===(f=_e.current)||void 0===f||f.blur(),ye(""),bn(),Pe(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."),gn.current.set(S.requestId,Date.now()),pn.current=S.requestId,d.startChatStreamSSE(S);u&&u(!1)}},Tn=t.useRef(null);t.useLayoutEffect(function(){Tn.current=Mn});var Rn=t.useCallback(function(){for(var n,t=[],a=0;a<arguments.length;a++)t[a]=arguments[a];return null===(n=Tn.current)||void 0===n?void 0:n.call.apply(n,e.__spreadArray([Tn],t,!1))},[]),An=t.useMemo(function(){return{p:function(t){t.node;var a=t.children;return e.__rest(t,["node","children"]),n.jsx("div",e.__assign({style:{margin:0,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"10px",fontFamily:"inherit"}},{children:a}))},button:function(t){t.node;var a=t.className,s=t.children,i=e.__rest(t,["node","className","children"]),r=C.extractTextFromChildren(s),o=i["data-value"],l=Xe===r||Xe===o,d=!!Xe||!!ue,u="Tester Genie"===r;return n.jsx(m.ActionableButton,e.__assign({},i,{className:a,handleStream:Rn,isStreamEnd:Ae,disabled:d,isLastMessage:!0,style:{margin:0},isTesterGenie:u,"data-selected":l?"true":Xe?"false":void 0},{children:n.jsxs("span",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[s,u&&n.jsxs("svg",e.__assign({width:"16",height:"20",viewBox:"0 0 16 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[n.jsx("path",{d:"M7.20368 8.94768e-06C7.48895 -0.00208639 7.69331 0.364327 7.83856 0.57465C8.14381 1.01633 8.38012 1.87909 7.71077 2.14118C8.57167 2.21011 9.70406 2.93098 10.1785 3.64699C10.5932 4.27286 10.4559 5.16037 9.80301 5.56007L9.9502 7.16593C9.97671 7.44871 10.0265 7.87092 10.0299 8.14457C10.4213 8.23046 11.0787 8.55391 11.326 8.87592C11.5979 8.75656 11.9189 8.76963 12.1688 8.93469C12.3563 8.67751 12.5598 8.41456 12.7507 8.15787C12.3283 7.45155 12.5047 6.57745 13.2143 6.13784C13.5375 5.9377 13.9264 5.87277 14.2971 5.95705C14.0961 6.30964 13.8775 6.72182 13.6593 7.05857C13.7906 7.2436 13.9184 7.44225 14.044 7.63194L14.8022 7.63198C15.0349 7.30106 15.2515 6.90827 15.4835 6.59349C15.8623 7.0712 15.8156 7.79671 15.4734 8.28241C15.1318 8.76741 14.4886 8.9899 13.9118 8.88251C13.758 9.12108 13.5577 9.39243 13.3941 9.63201C13.7143 9.9316 13.7725 10.364 13.4067 10.6594C13.5231 10.8889 13.5309 11.1613 13.447 11.402C13.1502 12.2523 12.1724 12.5645 11.3474 12.5025C11.1171 12.4852 10.939 12.4698 10.7197 12.3953C10.8724 13.1271 10.7744 14.2031 10.5132 14.9051C10.1688 15.8304 9.43632 16.5569 8.54503 16.9655C7.90465 17.2706 7.21222 17.3607 6.50472 17.4505C5.74445 17.5471 4.75801 17.4362 4.08533 17.825C3.9327 17.9132 3.86566 18.0173 3.82943 18.1792C3.94996 18.5982 4.47858 18.6063 4.78474 18.8897C5.20191 19.2758 4.90716 19.9663 4.36611 19.9908C4.31476 19.9931 4.26867 19.9867 4.23186 19.9493C4.23089 19.8303 4.47587 19.7199 4.49787 19.5262C4.55075 19.0604 3.70014 19.0078 3.37835 18.8374C3.13013 18.706 2.99537 18.6309 2.82242 18.4021C2.63795 18.1579 2.58428 17.835 2.63138 17.5392C2.74868 16.7847 3.47123 16.393 4.12184 16.1497C4.61314 15.9659 5.46304 15.7158 5.52019 15.0793C5.58589 14.348 4.97543 13.5523 4.57739 12.9807C4.44275 12.7875 4.3039 12.579 4.16309 12.3919C4.18987 12.365 4.21049 12.3463 4.23916 12.3212C4.59619 12.6218 5.21209 12.6421 5.55038 12.2979C5.70457 12.144 5.78974 11.9342 5.78642 11.7164C5.78121 11.4493 5.63382 11.2002 5.4454 11.019C5.44704 10.9932 5.44824 10.9676 5.449 10.9419C5.4566 10.6648 5.37505 10.4902 5.1892 10.2943C5.18398 10.2538 5.17776 10.2134 5.17053 10.1732C5.08123 9.69297 4.71708 9.34182 4.23415 9.27108C4.16418 9.26083 3.96108 9.26105 3.92071 9.23344C3.90485 9.1828 3.9059 9.20792 3.91904 9.15527C4.22103 8.90139 4.14407 8.78214 4.31107 8.4846C4.42301 8.28513 4.73047 8.15239 4.95452 8.10701C4.96167 7.51076 5.03684 6.88562 5.10036 6.29144C5.12451 6.0655 5.12531 5.75046 5.1511 5.55257C4.11108 4.86747 4.39091 3.75946 5.25465 3.06391C5.84978 2.58469 6.34496 2.31002 7.10143 2.14517C7.01589 2.10416 6.93842 2.04811 6.87269 1.97972C6.77021 1.87349 6.70248 1.73857 6.67853 1.59293C6.60568 1.12096 7.04104 0.914625 7.18759 0.526392C7.26428 0.323403 7.03925 0.146075 7.20368 8.94768e-06Z",fill:"#475569"}),n.jsx("path",{d:"M7.459 4.5C7.48797 4.50312 7.71949 4.61154 7.76205 4.63061C8.27062 4.85835 8.87051 5.09164 9.35658 5.3582C9.36602 6.03495 9.37016 6.56625 8.70573 6.91519C8.6633 6.80883 8.63019 6.72409 8.56332 6.63044C8.43786 6.45568 8.24656 6.33963 8.03354 6.30909C7.8434 6.28211 7.65146 6.3197 7.49586 6.43503C7.21897 6.21256 6.76265 6.28197 6.5229 6.52486C6.39308 6.65639 6.34815 6.75074 6.28902 6.92344C5.59702 6.5957 5.58761 6.04267 5.60583 5.35582C5.89882 5.23844 6.21318 5.0724 6.50153 4.941C6.82145 4.79522 7.14482 4.6574 7.459 4.5Z",fill:"#D1EDFD"}),n.jsx("path",{d:"M11.0756 10.6406C11.1037 10.6701 11.1324 10.7706 11.1535 10.8145C11.2818 11.0817 11.4922 11.1945 11.7498 11.2977C11.5607 11.63 11.4567 11.8797 11.1034 12.0466L11.0839 12.0517C10.9262 12.0927 10.7996 12.0968 10.651 12.0135C10.4755 11.915 10.3807 11.6614 10.4792 11.478C10.6388 11.1809 10.8877 10.9272 11.0756 10.6406Z",fill:"#D1EDFD"}),n.jsx("path",{d:"M11.6036 9.1377C11.6993 9.11763 11.8391 9.16378 11.9294 9.19593C11.6952 9.50644 11.4706 9.81614 11.2327 10.1261L11.1572 10.2255C10.7581 9.73539 11.0333 9.24481 11.6036 9.1377Z",fill:"#D1EDFD"}),n.jsx("path",{d:"M7.49681 0.882812C7.53691 0.925159 7.61244 1.08523 7.63598 1.14156C7.74243 1.39673 7.75769 1.76908 7.38596 1.77504C7.28236 1.75599 7.15628 1.68938 7.13517 1.5783C7.0843 1.3107 7.35609 1.09964 7.48737 0.897583L7.49681 0.882812Z",fill:"#D1EDFD"}),n.jsx("path",{d:"M1.68305 6.17249C1.71659 6.1673 1.8134 6.16478 1.84892 6.16432C2.34052 6.15616 2.81496 6.34495 3.16655 6.68866C3.50847 7.01806 3.70349 7.47119 3.70765 7.94596C3.70896 8.42345 3.54045 8.85284 3.20281 9.19025C3.34033 9.28068 3.5321 9.52219 3.6543 9.65748C4.17158 9.39073 4.91447 9.69339 4.79675 10.3444C5.08751 10.5485 5.19656 10.8288 5.0585 11.1674C5.15418 11.2375 5.25595 11.3205 5.32383 11.4186C5.40228 11.5303 5.4309 11.6695 5.40291 11.8031C5.32228 12.1857 4.90085 12.3286 4.57669 12.1236C4.51367 12.0838 4.42258 11.9595 4.35299 11.9431C4.30669 11.9557 4.28453 11.9584 4.23644 11.9644C4.22885 11.9742 4.22118 11.9841 4.21343 11.9938C3.93597 12.3413 3.49234 12.4682 3.06933 12.5157C2.85285 12.518 2.70432 12.5146 2.49066 12.4609C1.80785 12.2892 1.50808 11.6167 1.70723 10.9639C1.829 10.5648 2.11891 10.2506 2.48939 10.0518C2.54655 10.132 2.57559 10.2191 2.64066 10.303C2.73571 10.2223 2.82048 10.1482 2.92363 10.0773C2.81023 9.95313 2.66811 9.7693 2.55817 9.63584C2.38871 9.6878 2.23026 9.72879 2.05298 9.74653C1.54239 9.80228 1.03118 9.64711 0.637735 9.31695C0.269964 9.01018 0.0453493 8.54827 0.00544736 8.07322C-0.0309495 7.60988 0.116099 7.15077 0.414918 6.79478C0.742554 6.41198 1.18728 6.21393 1.68305 6.17249Z",fill:"#475569"}),n.jsx("path",{d:"M1.79616 6.5951C2.54894 6.5619 3.18687 7.14364 3.22301 7.8963C3.25915 8.64894 2.67989 9.28913 1.92739 9.3282C1.17073 9.3675 0.526231 8.78435 0.489885 8.02753C0.45354 7.27071 1.03921 6.62849 1.79616 6.5951Z",fill:"#D1EDFD"}),n.jsx("path",{d:"M4.93607 11.4844C5.12839 11.6261 5.22049 11.9085 4.91876 11.9419C4.8067 11.8805 4.78491 11.8646 4.71094 11.7561C4.81572 11.6752 4.862 11.5925 4.93607 11.4844Z",fill:"#FEFEFD"}),n.jsx("path",{d:"M12.5164 3.58594L12.5715 3.59466C12.6589 3.65863 12.6908 3.94434 12.7882 4.05193C12.8789 4.15216 12.9155 4.17816 13.0326 4.24929C13.1363 4.31224 13.3325 4.34025 13.384 4.43124C13.3643 4.56218 13.0693 4.54857 12.9127 4.69344C12.6903 4.89898 12.7114 5.06971 12.5892 5.28622C12.5669 5.28439 12.5368 5.2868 12.5261 5.27346C12.4336 5.15843 12.4072 4.9308 12.3099 4.81465C12.1627 4.63903 11.9972 4.60054 11.7981 4.51372C11.7544 4.49467 11.7266 4.47099 11.7129 4.42649C11.7867 4.31876 12.0509 4.34309 12.2376 4.14892C12.43 3.94901 12.4155 3.72208 12.5164 3.58594Z",fill:"#475569"}),n.jsx("path",{d:"M2.13644 3.72656C2.24401 3.77084 2.29712 4.1268 2.431 4.25226C2.60327 4.41371 2.7311 4.41949 2.93246 4.52449C2.96024 4.53897 2.97173 4.56042 2.97671 4.58878C2.89584 4.6981 2.61854 4.70721 2.4596 4.85659C2.26275 5.04156 2.27341 5.29132 2.17022 5.42088C2.16192 5.41849 2.11671 5.40232 2.1156 5.40043C2.01291 5.21216 1.9836 5.04909 1.84812 4.87273C1.73599 4.72675 1.36534 4.69959 1.32812 4.56939C1.3835 4.47941 1.67823 4.44211 1.82291 4.30563C2.02737 4.11274 2.0042 3.8372 2.13644 3.72656Z",fill:"#475569"})]}))]}))}))}}},[Rn,Ae,Xe,ue]),In=t.useMemo(function(){return be.some(function(e){return e.isSkeleton})},[be]),Nn=function(n){return e.__awaiter(void 0,void 0,void 0,function(){return e.__generator(this,function(t){switch(t.label){case 0:return le?[4,le(n)]:[3,2];case 1:t.sent(),je(function(n){return e.__spreadArray(e.__spreadArray([],n,!0),[{role:"assistant",content:"Thanks for your feedback — this will help improve future suggestions.",id:l.v4(),citations:[],time:new Date,isEnd:!0}],!1)}),setTimeout(function(){return bn("smooth")},100),t.label=2;case 2:return[2]}})})};return n.jsxs("div",e.__assign({className:"".concat(p.default.customFont," ").concat(g.default.chatContainer),style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:se&&!In?"0 0 20px 5px rgba(37, 99, 235, 0.5)":"none"}},{children:[n.jsxs("div",e.__assign({ref:fe,className:g.default.scrollWrapper},{children:[n.jsx("div",e.__assign({ref:rn,className:g.default.stickyHeader},{children:n.jsx(c.default,{resetChatHistory:function(){var e="".concat(me,"/api/chat/resetHistory?name=").concat(ce,"&organizationName=").concat(r);try{var n={method:"GET",params:{guestSessionId:ve.current},withCredentials:!0};M.default.get(e,n).then(function(){b(!0),Fe(""),Ye(null),on.current.clear(),_n.current.clear(),he.current="".concat(l.v4()),je([]),De(!0),null==P||P(),A&&A()}).catch(function(e){console.error(e)}).finally(function(){ve.current="".concat(ce,"-").concat(r,"-").concat(l.v4())})}catch(e){Ee(!1),console.error(e)}},isStreamEnd:Ae,chatTitle:q,onResize:U,chatSize:G,movingTowards:Z})})),n.jsxs("div",e.__assign({className:g.default.messagesList},{children:[n.jsxs("div",e.__assign({className:g.default.initialMessageRow},{children:[n.jsx("div",e.__assign({className:g.default.iconWrapper},{children:n.jsx(y.default,{})})),n.jsx("div",e.__assign({className:g.default.welcomeTextWrapper},{children:n.jsx("div",e.__assign({className:g.default.welcomeMarkdownWrapper},{children:n.jsx("span",{children:n.jsx(k.default,e.__assign({rehypePlugins:[E.default],components:An},{children:B}))})}))}))]})),be.length>0&&be.map(function(t,a){var s,i;return n.jsxs("div",e.__assign({className:g.default.messageRow},{children:["assistant"===t.role?n.jsx("div",e.__assign({className:g.default.assistantIconContainer},{children:n.jsx(y.default,{})})):n.jsx("div",{className:g.default.userSpacer}),n.jsx("div",e.__assign({className:g.default.messageContent},{children:"assistant"===t.role?n.jsxs(n.Fragment,{children:[t.orchestratorAndAgentsMessages&&t.orchestratorAndAgentsMessages.length>0&&n.jsx(u.WatchMeWork,{orchestratorAndAgentsMessages:null==t?void 0:t.orchestratorAndAgentsMessages,isStreamEnd:Ae,finalTimeTaken:null==t?void 0:t.finalTimeTaken},null!==(s=null==t?void 0:t.finalTimeTaken)&&void 0!==s?s:null==t?void 0:t.id),n.jsx(v.default,{index:a,content:null==t?void 0:t.content,role:null==t?void 0:t.role,messages:be,handleStream:Mn,isLastMessage:a===be.length-1,onSave:H,citations:null==t?void 0:t.citations,setChatSize:U,chatSize:G,isStreamEnd:Ae,messageIsEnd:null==t?void 0:t.isEnd,onViewComparison:re,onTypeResponseClick:function(){var e;hn(!0),null===(e=_e.current)||void 0===e||e.focus()},onComparisonLinkClick:oe,baseURL:me,onFeedbackSubmit:Nn,isGlobalEditActive:ue}),t.hasOwnProperty("isEnd")&&!(null==t?void 0:t.isEnd)&&(null===(i=null==t?void 0:t.content)||void 0===i?void 0:i.length)>0&&n.jsxs(n.Fragment,{children:[n.jsx(h.Skeleton,{variant:"text",width:"50%",height:20}),n.jsx("div",{style:{marginTop:"10px"}}),n.jsx(h.Skeleton,{variant:"text",width:"100%",height:40})]}),n.jsx("div",e.__assign({className:g.default.timestamp},{children:t.time&&!isNaN(new Date(t.time).getTime())?new Date(t.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}):n.jsxs("div",e.__assign({className:g.default.userMessageWrapper},{children:[n.jsxs("div",e.__assign({className:g.default.userMessageBubble,style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:t.isSkeleton||In||t.id!==dn?"none":"0 0 15px 3px rgba(37, 99, 235, 0.6)"}},{children:[t.isSkeleton?n.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:"12px",minWidth:"280px",padding:"8px 0"}},{children:[n.jsx(h.Skeleton,{variant:"text",width:"100%",height:16}),n.jsx(h.Skeleton,{variant:"text",width:"80%",height:16})]})):n.jsx(v.default,{index:a,content:null==t?void 0:t.content,role:null==t?void 0:t.role,messages:be,handleStream:Mn,isLastMessage:a===be.length-1,onSave:H,citations:null==t?void 0:t.citations,isStreamEnd:Ae,isGlobalEditActive:ue,messageIsEnd:null==t?void 0:t.isEnd,onViewComparison:re,onComparisonLinkClick:oe,baseURL:me,onFeedbackSubmit:Nn}),n.jsx("div",e.__assign({style:{marginTop:"0.5rem"}},{children:n.jsx(S.UserIcon,{})}))]})),n.jsx("div",e.__assign({className:g.default.userTimestamp},{children:new Date(t.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}))}))]}),t.id)}),ke&&n.jsxs("div",e.__assign({className:g.default.loadingRow},{children:[n.jsx("div",e.__assign({className:g.default.iconWrapper,style:{marginTop:"0.2rem"}},{children:n.jsx(y.default,{})})),n.jsx("div",e.__assign({className:g.default.loadingTextWrapper},{children:n.jsx("span",{children:We})}))]})),n.jsx("div",{ref:pe,style:{float:"left",clear:"both"}})]}))]})),n.jsx("div",e.__assign({className:g.default.inputAreaWrapper},{children:n.jsx(w.default,e.__assign({title:D?"Please wait for the validation to be completed.":""},{children:n.jsxs("div",e.__assign({className:"".concat(g.default.inputBoxContainer," ").concat(xn?g.default.disabled:""),style:vn?{boxShadow:"0 0 15px 3px rgba(37, 99, 235, 0.5)",borderColor:"#2563eb",transition:"box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out"}:{transition:"box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out"}},{children:[be.length>0&&!Oe&&n.jsx("div",e.__assign({onMouseDown:function(e){e.preventDefault(),bn("smooth")},className:g.default.scrollToBottomBtn},{children:n.jsx(_.ScrollToBottom,{})})),n.jsxs("div",e.__assign({style:{width:"100%",display:"flex"}},{children:[n.jsx("textarea",{ref:_e,placeholder:V,value:xe||"",onChange:function(e){ye(e.target.value)},onFocus:function(){return Ze(!0)},onBlur:function(){return Ze(!1)},onKeyDown:function(e){return Mn(e)},disabled:xn,className:"no-scrollbar ".concat(g.default.chatTextarea),style:{minHeight:Ue?"120px":"50px",height:Ue?"120px":"50px",maxHeight:"120px"}}),n.jsx("span",e.__assign({className:g.default.sendButtonWrapper},{children:n.jsx("button",e.__assign({onClick:function(e){yn||Mn(new KeyboardEvent("keydown",{key:"Enter"}))},disabled:yn,className:"".concat(g.default.sendButton," ").concat(yn?g.default.disabled:g.default.active)},{children:n.jsx(x.SendButton,{})}))}))]}))]}))}))})),n.jsxs("div",e.__assign({className:g.default.footerTools},{children:[n.jsx(w.default,e.__assign({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n.jsx("span",e.__assign({className:g.default.footerToolItem},{children:n.jsx(f.default,{amplitude:1,variant:"speaker",isActive:!1,onClick:function(){return null},disabled:!1})}))})),n.jsx(w.default,e.__assign({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n.jsx("span",e.__assign({className:g.default.footerToolItem},{children:n.jsx(f.default,{amplitude:1,variant:"microphone",isActive:!1,onClick:function(){return null},disabled:!1})}))}))]}))]}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),a=require("@mui/material"),s=require("@mui/material/Tooltip"),i=require("react-markdown"),r=require("rehype-raw"),o=require("axios"),l=require("uuid"),u=require("@e-llm-studio/streaming-response"),d=require("@e-llm-studio/watch-me-work"),c=require("./ChatHeader.js"),v=require("../MessageRendering/MessageRendering.js"),h=require("../atoms/SkeletonLoader/SkeletonLoader.js"),m=require("../MessageRendering/ClickableChatComponents.js"),f=require("../AudioWaveform.js"),g=require("./ChatComponent.module.css.js"),p=require("../../InstantLearning.module.css.js"),_=require("../_svg/ScrollToBottom.js"),C=require("../../helpers/utils.js"),x=require("../_svg/SendButton.js"),y=require("../_svg/SparkleIcon.js"),S=require("../_svg/UserIcon.js");function b(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var j,w=b(s),k=b(i),E=b(r),M=b(o);exports.autoGeneratePrompt=function(e,n){return M.default.post("".concat(e||"https://devllmstudio.creativeworkspace.ai","/api/chat/chatResponse"),{name:"ilggcautopromptgen",organizationName:"techolution",prompt:n||"Generate a query"},{headers:{"Content-Type":"application/json"},withCredentials:!0}).then(function(e){return e.data}).catch(function(e){throw console.error("Error calling auto-generate API:",e),e})},exports.default=function(s){var i=s.chatAssistantName,r=s.organizationName,o=s.baseUrl;s.baseWebsocketUrl;var b=s.setIsNewChatClicked;s.ThinkingBulbIconComponent;var T=s.isFormSaveClicked,R=s.setIsFormSavedClicked,A=s.onResetLearningData,I=s.sendMessageInChat,N=s.setSendMessageInChat,D=s.isFormValidating,q=s.chatTitle,F=s.customMetaData,L=s.headerMessageHandlers;s.aiResponse;var W=s.setAIResponse,P=s.onResetChat,z=s.initialChatMessage,B=void 0===z?"":z,H=s.onSave,G=s.chatSize,U=s.setChatSize,Z=s.movingTowards,K=s.setCitations,O=s.textareaPlaceholder,V=void 0===O?"Tell me more about this learning...":O,Q=s.setCurrentRequestId,J=s.showSavedMessage,$=void 0!==J&&J,X=s.savedMessage,Y=s.isError,ee=void 0!==Y&&Y,ne=s.errorMessage,te=void 0===ne?"There was an error saving your changes.":ne;s.isSaving;var ae=s.isHighlighted,se=void 0!==ae&&ae,ie=s.onStreamingStateChange,re=s.onViewComparison;s.isCopyEnabled;var oe=s.onComparisonLinkClick,le=s.onSubmitFeedback,ue=s.userDetails,de=s.isGlobalEditActive,ce=i,ve=t.useRef("".concat(ce,"-").concat(r,"-").concat(l.v4())),he=t.useRef("".concat(l.v4())),me=o,fe=t.useRef(null),ge=t.useRef(!0),pe=t.useRef(null),_e=t.useRef(null),Ce=t.useState(""),xe=Ce[0],ye=Ce[1],Se=t.useState([]),be=Se[0],je=Se[1],we=t.useState(!1),ke=we[0],Ee=we[1],Me=t.useState(!1);Me[0];var Te=Me[1],Re=t.useState(!0),Ae=Re[0],Ie=Re[1],Ne=t.useState(!0);Ne[0];var De=Ne[1],qe=t.useState("");qe[0];var Fe=qe[1],Le=t.useState(""),We=Le[0],Pe=Le[1],ze=t.useState(!1),Be=ze[0],He=ze[1],Ge=t.useState(!1),Ue=Ge[0],Ze=Ge[1],Ke=t.useState(!0),Oe=Ke[0],Ve=Ke[1],Qe=t.useState("100%");Qe[0];var Je=Qe[1],$e=t.useState(null),Xe=$e[0],Ye=$e[1],en=t.useState(!1);en[0];var nn=en[1],tn=t.useState(!1),an=tn[0],sn=tn[1],rn=t.useRef(null),on=t.useRef(new Set),ln=t.useState(null),un=ln[0],dn=ln[1],cn=t.useState(!1),vn=cn[0],hn=cn[1],mn=t.useState(!1);mn[0],mn[1];var fn=t.useState(null);fn[0],fn[1],t.useRef(null),t.useRef(null);var gn=t.useRef(new Map),pn=t.useRef(""),_n=t.useRef(new Map),Cn=t.useRef(!1);a.keyframes(j||(j=e.__makeTemplateObject(["\n 0%, 80%, 100% {\n transform: scale(0);\n }\n 40% {\n transform: scale(1.0);\n }\n "],["\n 0%, 80%, 100% {\n transform: scale(0);\n }\n 40% {\n transform: scale(1.0);\n }\n "])));var xn=t.useMemo(function(){return""===(null==xe?void 0:xe.trim())||Be},[xe,Be]),yn=t.useMemo(function(){return D},[D]),Sn=t.useMemo(function(){return xn||Be||D||!!de},[xn,Be,D,de]);t.useEffect(function(){null==ie||ie(Be)},[Be,ie]),t.useEffect(function(){var e=fe.current,n=function(){if(e){var n=e.scrollTop,t=e.scrollHeight,a=e.clientHeight;Ve(t-n-a<=20)}};return e&&(e.addEventListener("scroll",n),n()),function(){e&&e.removeEventListener("scroll",n)}},[be]);var bn=C.useHeaderObserver({handlers:L,setResult:W}).processHeaderMessage;t.useEffect(function(){$&&sn(!0)},[$]),t.useEffect(function(){if(vn){var e=setTimeout(function(){hn(!1)},3e3);return function(){return clearTimeout(e)}}},[vn]),t.useEffect(function(){T&&!de&&(Tn(new KeyboardEvent("keydown",{key:"Enter"}),!1,"Save this Learning"),R(!1))},[T]),t.useEffect(function(){if(I)try{if(I.startsWith("__SKELETON__:")){var n=I.split(":"),t=n[1],a=n.slice(2).join(":"),s={role:"user",content:"",id:t,time:new Date,isSkeleton:!0,skeletonContent:a};return je(function(n){return e.__spreadArray(e.__spreadArray([],n,!0),[s],!1)}),Tn(new KeyboardEvent("keydown",{key:"Enter"}),!1,a,!1,t),dn(t),N&&N(""),void setTimeout(function(){dn(null)},2e3)}if(I.startsWith("__SKELETON_END__::")){var i=I.split("::")[1]||"";return je(function(n){return n.map(function(n){return n.isSkeleton?e.__assign(e.__assign({},n),{isSkeleton:!1,content:n.skeletonContent||i}):n})}),void(N&&N(""))}var r=l.v4();Tn(new KeyboardEvent("keydown",{key:"Enter"}),!1,I,!1,r),dn(r),N&&N(""),setTimeout(function(){return dn(null)},2e3)}catch(e){console.error("Error handling sendMessageInChat signal",e)}},[I]),t.useEffect(function(){wn(),kn();var e=function(){var e,n=(null===(e=null==rn?void 0:rn.current)||void 0===e?void 0:e.clientHeight)||0,t="calc(100% - ".concat(n,"px - 10px)");Je(t)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var jn=t.useCallback(function(e){var n="string"==typeof e?e:"smooth";pe.current&&pe.current.scrollIntoView({behavior:n,block:"end"}),ge.current&&setTimeout(function(){pe.current&&ge.current&&pe.current.scrollIntoView({behavior:n,block:"end"})},100)},[]);t.useEffect(function(){if(!Be){var n="";if(an?n=X||"Thank you teacher for teaching me, your rule has been saved successfully.":ee&&(n=te||"I'm sorry, I couldn't save your changes. Please try again."),n){var t={role:"assistant",content:n,id:l.v4(),citations:[],time:new Date};je(function(n){return e.__spreadArray(e.__spreadArray([],n,!0),[t],!1)}),sn(!1),setTimeout(function(){return jn("smooth")},100)}}},[an,ee,Be,X,te,jn]),t.useEffect(function(){ge.current&&jn("smooth")},[jn]);var wn=function(){var e={method:"get",maxBodyLength:1/0,url:"".concat(me,"/api/chatbot/getChatSettings?name=").concat(ce,"&organizationName=").concat(r),headers:{}};M.default.request(e).then(function(e){var n,t,a;(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.chatSettings)&&""!==(null===(a=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.chatSettings)||void 0===a?void 0:a.chatInitialMessage)&&De(!0)}).catch(function(e){console.error(e)})},kn=function(){return e.__awaiter(void 0,void 0,void 0,function(){var n,t;return e.__generator(this,function(e){n="".concat(me,"/api/chat/history?name=").concat(ce,"&organizationName=").concat(r);try{t={method:"GET",params:{guestSessionId:ve.current},withCredentials:!0},M.default.get(n,t).then(function(e){var n=e.data;n.length>0?(je(n),jn()):De(!0)}).catch(function(e){console.error(e)})}catch(e){Ee(!1),console.error(e)}return[2]})})};function En(e){return null==e?void 0:e.replace(/<a [^>]*>.*?<\/a>/g,function(e){return null==e?void 0:e.replace(/\*/g,"*")})}var Mn=function(n,t,a,s,i,r,o){var u,d,c,v,h,m,f,g,p,_,C,x,y,S,b,j,w,k,E,M,T,R,A,I,N,D,q,F,L,W;if(null===(d=null===(u=null==n?void 0:n.chatStream)||void 0===u?void 0:u.continueChatResult)||void 0===d?void 0:d.header_message){var P={header_message:n.chatStream.continueChatResult.header_message,responsedata:null===(h=null===(v=null===(c=null==n?void 0:n.chatStream)||void 0===c?void 0:c.continueChatResult)||void 0===v?void 0:v.message)||void 0===h?void 0:h.content};bn(P)}var z=null===(m=null==n?void 0:n.chatStream)||void 0===m?void 0:m.continueChatResult,B=null==z?void 0:z.isEnd,H=(null===(f=null==z?void 0:z.message)||void 0===f?void 0:f.citations)||[];B&&H.length>0&&K&&K(H);var G={role:"assistant",content:"",id:l.v4()};if(null===(C=null===(_=null===(p=null===(g=null==n?void 0:n.chatStream)||void 0===g?void 0:g.continueChatResult)||void 0===p?void 0:p.message)||void 0===_?void 0:_.content)||void 0===C?void 0:C.includes("WaitMessage: "))Te(!0),G.content=function(e){var n="WaitMessage: ",t=e.indexOf(n);if(-1!==t){var a=e.substring(t+13);return null==a?void 0:a.replaceAll("WaitMessage: ","")}return""}((null===(S=null===(y=null===(x=null==n?void 0:n.chatStream)||void 0===x?void 0:x.continueChatResult)||void 0===y?void 0:y.message)||void 0===S?void 0:S.content)+"\n\n"),""!==G.content&&(Ee(!1),je(e.__spreadArray(e.__spreadArray([],be,!0),[{role:"user",content:i,time:s,isFirstQuestionSent:r||!1,id:o||(null===(j=null===(b=null==n?void 0:n.chatStream)||void 0===b?void 0:b.continueChatResult)||void 0===j?void 0:j.requestId)||"",reply:""},G],!1)));else{Te(!1);var U=null===(k=null===(w=null==n?void 0:n.chatStream)||void 0===w?void 0:w.continueChatResult)||void 0===k?void 0:k.requestId;"string"==typeof U&&U&&Q&&Q(U);var Z=function(n,t,a,s){var i,r,o,u,d,c,v,h={role:"assistant",content:"",id:l.v4(),time:new Date,citations:[]},m=(null===(i=null==n?void 0:n.chatStream)||void 0===i?void 0:i.continueChatResult)||{},f=null==m?void 0:m.requestId,g=null==m?void 0:m.preserve_message,p=null==m?void 0:m.isEnd,_=(null===(r=null==m?void 0:m.message)||void 0===r?void 0:r.content)||"",C=null==m?void 0:m.is_orchestrator,x=null==m?void 0:m.thinking_break,y=(null===(o=null==m?void 0:m.message)||void 0===o?void 0:o.citations)||[];if(f&&g&&_&&!p){var S=s.current.get(f)||[];S[S.length-1]!==_&&(S.push(_),s.current.set(f,S))}var b=(f&&s.current.get(f)||[]).join("\n\n"),j="";if(p)j=b&&""!==b.trim()?b:_;else if(g)j=b;else{var w=_.replace(/<!--(?![\s\S]*-->)[\s\S]*$/,"").trimEnd(),k=!1===C||x||0!==y.length?"":w;j=b?"".concat(b,"\n\n").concat(k):k}if(h.content=En(j),!0===(null==m?void 0:m.thinking_break)&&!0===(null==m?void 0:m.is_orchestrator)&&!1===(null==m?void 0:m.isEnd)&&t.push({responsedata:_,responseFrom:m.responded_by,header_message:m.header_message,finalResponseStatus:!1}),!1===(null==m?void 0:m.thinking_break)&&!1===(null==m?void 0:m.is_orchestrator)&&!1===(null==m?void 0:m.isEnd)){if(m.explainability_id&&m.responded_by){var E=m.explainability_id,M=m.responded_by;a.has(E)||a.set(E,{responded_by:M,index:t.length})}a.has(m.explainability_id)?t[null==(T=a.get(m.explainability_id))?void 0:T.index]={responsedata:_,responseFrom:m.responded_by,header_message:m.header_message,finalResponseStatus:!0,explainability_id:null!==(u=m.explainability_id)&&void 0!==u?u:"",isParallelToolResponse:!0}:t=e.__spreadArray(e.__spreadArray([],t,!0),[{responsedata:_,responseFrom:m.responded_by,header_message:m.header_message,finalResponseStatus:!0,explainability_id:null!==(d=m.explainability_id)&&void 0!==d?d:"",isParallelToolResponse:!1}],!1)}if(!0===(null==m?void 0:m.thinking_break)&&!1===(null==m?void 0:m.is_orchestrator)&&!1===(null==m?void 0:m.isEnd)){var T;m.explainability_id&&m.responded_by&&(E=m.explainability_id,M=m.responded_by,a.has(E)||a.set(E,{responded_by:M,index:t.length})),a.has(m.explainability_id)?t[null==(T=a.get(m.explainability_id))?void 0:T.index]={responsedata:_,responseFrom:m.responded_by,header_message:m.header_message,finalResponseStatus:!1,explainability_id:null!==(c=m.explainability_id)&&void 0!==c?c:"",isParallelToolResponse:!0}:t.push({responsedata:_,responseFrom:m.responded_by,header_message:m.header_message,finalResponseStatus:!1,explainability_id:null!==(v=m.explainability_id)&&void 0!==v?v:"",isParallelToolResponse:!1})}return e.__assign({orchestratorAndAgentsMessages:t},h)}(n,a,t,_n);Z.time=new Date,Z.citations=H,Z.isEnd=null===(M=null===(E=null==n?void 0:n.chatStream)||void 0===E?void 0:E.continueChatResult)||void 0===M?void 0:M.isEnd,Z.requestId=null===(R=null===(T=null==n?void 0:n.chatStream)||void 0===T?void 0:T.continueChatResult)||void 0===R?void 0:R.requestId,Z.sessionId=ve.current,null===(A=Z.orchestratorAndAgentsMessages)||void 0===A||A.forEach(function(e){e&&e.header_message&&bn(e)}),(""!==(null==Z?void 0:Z.content)||(null==Z?void 0:Z.orchestratorAndAgentsMessages)&&(null==Z?void 0:Z.orchestratorAndAgentsMessages.length)>0)&&(Ee(!1),je(e.__spreadArray(e.__spreadArray([],be,!0),[{role:"user",content:i||"",time:s,isFirstQuestionSent:r||!1,id:o||(null===(N=null===(I=null==n?void 0:n.chatStream)||void 0===I?void 0:I.continueChatResult)||void 0===N?void 0:N.requestId)||"",requestId:null!==(F=null===(q=null===(D=null==n?void 0:n.chatStream)||void 0===D?void 0:D.continueChatResult)||void 0===q?void 0:q.requestId)&&void 0!==F?F:""},Z],!1))),Ie(null===(W=null===(L=null==n?void 0:n.chatStream)||void 0===L?void 0:L.continueChatResult)||void 0===W?void 0:W.isEnd)}},Tn=function(n,t,a,s,i,d){var c,v,h,m,f,g,p=(void 0!==a?a:xe||"").trim(),_="Enter"===(null==n?void 0:n.key)&&!(null==n?void 0:n.shiftKey)&&!de;_&&(null===(c=null==n?void 0:n.preventDefault)||void 0===c||c.call(n));var C="user"===(null===(v=be[be.length-1])||void 0===v?void 0:v.role);if(!(!p||Be||Cn.current||C||(null==n?void 0:n.key)&&!_)){if(Cn.current=!0,"I want to add a rule description"===p){Ie(!1),ge.current=!0,He(!0),!Xe&&p&&Ye(a||"manual_entry");var x=new Date;return je(function(n){return e.__spreadArray(e.__spreadArray([],n.map(function(n,t){var a;return e.__assign(e.__assign({},n),{content:null===(a=En(n.content))||void 0===a?void 0:a.replace("WaitMessage: ","")})}),!0),[{role:"user",content:p,time:x,isFirstQuestionSent:!1,id:i||l.v4()}],!1)}),jn("smooth"),void setTimeout(function(){je(function(n){return e.__spreadArray(e.__spreadArray([],n,!0),[{role:"assistant",content:"I'd be happy to help you set up a new rule! To get started, could you tell me what kind of behavior or logic you would like this rule to follow?",id:l.v4(),citations:[],time:new Date}],!1)}),jn("smooth"),setTimeout(function(){He(!1),Ie(!0)},500)},500)}Ie(!1),ge.current=!0,He(!0),!Xe&&p&&Ye(a||"manual_entry");var y=new Date;je(function(n){var t=n.map(function(n){var t;return e.__assign(e.__assign({},n),{content:null===(t=En(n.content))||void 0===t?void 0:t.replace("WaitMessage: ","")})});return i&&t.some(function(e){return e.id===i})?t.map(function(n){return n.id===i?e.__assign(e.__assign({},n),{content:p}):n}):e.__spreadArray(e.__spreadArray([],t,!0),[{role:"user",content:p,time:y,isFirstQuestionSent:!1,id:i||l.v4()}],!1)}),jn("smooth");var S=new Map,b=[],j={API_URL:o,organizationName:r,chatAssistantName:ce,selectedAIModel:"gpt-4",replyMessage:"",userName:null!==(h=null==ue?void 0:ue.name)&&void 0!==h?h:"Guest User",userEmailId:null!==(m=null==ue?void 0:ue.email)&&void 0!==m?m:"guestUser@example.com",userId:null!==(f=null==ue?void 0:ue.id)&&void 0!==f?f:"Guest User",query:p,requestId:"requestId-".concat(l.v4()),customPrompt:"",enableForBackend:!1,guestSessionId:ve.current,chatPreviewId:he.current,customMetaData:F,aiModel:"",onStreamEvent:function(e){return Mn(e,S,b,y,p,t,i)},onStreamEnd:function(n){Cn.current=!1,Ie(!0),He(!1),nn(!1);var t=Date.now(),a=gn.current.get(pn.current);if(a){var s=Math.round((t-a)/1e3).toFixed(1);je(function(n){var t=e.__spreadArray([],n,!0).reverse().findIndex(function(e){return"assistant"===e.role});if(-1===t)return n;var a=n.length-1-t;return n.map(function(n,t){return t===a?e.__assign(e.__assign({},n),{finalTimeTaken:s}):n})})}},onError:function(e){Cn.current=!1,console.error("Stream error:",e),Ie(!0),He(!1),nn(!1)}};if(p)Ee(!0),null===(g=_e.current)||void 0===g||g.blur(),ye(""),jn(),Pe(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."),gn.current.set(j.requestId,Date.now()),pn.current=j.requestId,u.startChatStreamSSE(j);d&&d(!1)}},Rn=t.useRef(null);t.useLayoutEffect(function(){Rn.current=Tn});var An=t.useCallback(function(){for(var n,t=[],a=0;a<arguments.length;a++)t[a]=arguments[a];return null===(n=Rn.current)||void 0===n?void 0:n.call.apply(n,e.__spreadArray([Rn],t,!1))},[]),In=t.useMemo(function(){return{p:function(t){t.node;var a=t.children;return e.__rest(t,["node","children"]),n.jsx("div",e.__assign({style:{margin:0,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"10px",fontFamily:"inherit"}},{children:a}))},button:function(t){t.node;var a=t.className,s=t.children,i=e.__rest(t,["node","className","children"]),r=C.extractTextFromChildren(s),o=i["data-value"],l=Xe===r||Xe===o,u=!!Xe||!!de,d="Tester Genie"===r;return n.jsx(m.ActionableButton,e.__assign({},i,{className:a,handleStream:An,isStreamEnd:Ae,disabled:u,isLastMessage:!0,style:{margin:0},isTesterGenie:d,"data-selected":l?"true":Xe?"false":void 0},{children:n.jsxs("span",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[s,d&&n.jsxs("svg",e.__assign({width:"16",height:"20",viewBox:"0 0 16 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[n.jsx("path",{d:"M7.20368 8.94768e-06C7.48895 -0.00208639 7.69331 0.364327 7.83856 0.57465C8.14381 1.01633 8.38012 1.87909 7.71077 2.14118C8.57167 2.21011 9.70406 2.93098 10.1785 3.64699C10.5932 4.27286 10.4559 5.16037 9.80301 5.56007L9.9502 7.16593C9.97671 7.44871 10.0265 7.87092 10.0299 8.14457C10.4213 8.23046 11.0787 8.55391 11.326 8.87592C11.5979 8.75656 11.9189 8.76963 12.1688 8.93469C12.3563 8.67751 12.5598 8.41456 12.7507 8.15787C12.3283 7.45155 12.5047 6.57745 13.2143 6.13784C13.5375 5.9377 13.9264 5.87277 14.2971 5.95705C14.0961 6.30964 13.8775 6.72182 13.6593 7.05857C13.7906 7.2436 13.9184 7.44225 14.044 7.63194L14.8022 7.63198C15.0349 7.30106 15.2515 6.90827 15.4835 6.59349C15.8623 7.0712 15.8156 7.79671 15.4734 8.28241C15.1318 8.76741 14.4886 8.9899 13.9118 8.88251C13.758 9.12108 13.5577 9.39243 13.3941 9.63201C13.7143 9.9316 13.7725 10.364 13.4067 10.6594C13.5231 10.8889 13.5309 11.1613 13.447 11.402C13.1502 12.2523 12.1724 12.5645 11.3474 12.5025C11.1171 12.4852 10.939 12.4698 10.7197 12.3953C10.8724 13.1271 10.7744 14.2031 10.5132 14.9051C10.1688 15.8304 9.43632 16.5569 8.54503 16.9655C7.90465 17.2706 7.21222 17.3607 6.50472 17.4505C5.74445 17.5471 4.75801 17.4362 4.08533 17.825C3.9327 17.9132 3.86566 18.0173 3.82943 18.1792C3.94996 18.5982 4.47858 18.6063 4.78474 18.8897C5.20191 19.2758 4.90716 19.9663 4.36611 19.9908C4.31476 19.9931 4.26867 19.9867 4.23186 19.9493C4.23089 19.8303 4.47587 19.7199 4.49787 19.5262C4.55075 19.0604 3.70014 19.0078 3.37835 18.8374C3.13013 18.706 2.99537 18.6309 2.82242 18.4021C2.63795 18.1579 2.58428 17.835 2.63138 17.5392C2.74868 16.7847 3.47123 16.393 4.12184 16.1497C4.61314 15.9659 5.46304 15.7158 5.52019 15.0793C5.58589 14.348 4.97543 13.5523 4.57739 12.9807C4.44275 12.7875 4.3039 12.579 4.16309 12.3919C4.18987 12.365 4.21049 12.3463 4.23916 12.3212C4.59619 12.6218 5.21209 12.6421 5.55038 12.2979C5.70457 12.144 5.78974 11.9342 5.78642 11.7164C5.78121 11.4493 5.63382 11.2002 5.4454 11.019C5.44704 10.9932 5.44824 10.9676 5.449 10.9419C5.4566 10.6648 5.37505 10.4902 5.1892 10.2943C5.18398 10.2538 5.17776 10.2134 5.17053 10.1732C5.08123 9.69297 4.71708 9.34182 4.23415 9.27108C4.16418 9.26083 3.96108 9.26105 3.92071 9.23344C3.90485 9.1828 3.9059 9.20792 3.91904 9.15527C4.22103 8.90139 4.14407 8.78214 4.31107 8.4846C4.42301 8.28513 4.73047 8.15239 4.95452 8.10701C4.96167 7.51076 5.03684 6.88562 5.10036 6.29144C5.12451 6.0655 5.12531 5.75046 5.1511 5.55257C4.11108 4.86747 4.39091 3.75946 5.25465 3.06391C5.84978 2.58469 6.34496 2.31002 7.10143 2.14517C7.01589 2.10416 6.93842 2.04811 6.87269 1.97972C6.77021 1.87349 6.70248 1.73857 6.67853 1.59293C6.60568 1.12096 7.04104 0.914625 7.18759 0.526392C7.26428 0.323403 7.03925 0.146075 7.20368 8.94768e-06Z",fill:"#475569"}),n.jsx("path",{d:"M7.459 4.5C7.48797 4.50312 7.71949 4.61154 7.76205 4.63061C8.27062 4.85835 8.87051 5.09164 9.35658 5.3582C9.36602 6.03495 9.37016 6.56625 8.70573 6.91519C8.6633 6.80883 8.63019 6.72409 8.56332 6.63044C8.43786 6.45568 8.24656 6.33963 8.03354 6.30909C7.8434 6.28211 7.65146 6.3197 7.49586 6.43503C7.21897 6.21256 6.76265 6.28197 6.5229 6.52486C6.39308 6.65639 6.34815 6.75074 6.28902 6.92344C5.59702 6.5957 5.58761 6.04267 5.60583 5.35582C5.89882 5.23844 6.21318 5.0724 6.50153 4.941C6.82145 4.79522 7.14482 4.6574 7.459 4.5Z",fill:"#D1EDFD"}),n.jsx("path",{d:"M11.0756 10.6406C11.1037 10.6701 11.1324 10.7706 11.1535 10.8145C11.2818 11.0817 11.4922 11.1945 11.7498 11.2977C11.5607 11.63 11.4567 11.8797 11.1034 12.0466L11.0839 12.0517C10.9262 12.0927 10.7996 12.0968 10.651 12.0135C10.4755 11.915 10.3807 11.6614 10.4792 11.478C10.6388 11.1809 10.8877 10.9272 11.0756 10.6406Z",fill:"#D1EDFD"}),n.jsx("path",{d:"M11.6036 9.1377C11.6993 9.11763 11.8391 9.16378 11.9294 9.19593C11.6952 9.50644 11.4706 9.81614 11.2327 10.1261L11.1572 10.2255C10.7581 9.73539 11.0333 9.24481 11.6036 9.1377Z",fill:"#D1EDFD"}),n.jsx("path",{d:"M7.49681 0.882812C7.53691 0.925159 7.61244 1.08523 7.63598 1.14156C7.74243 1.39673 7.75769 1.76908 7.38596 1.77504C7.28236 1.75599 7.15628 1.68938 7.13517 1.5783C7.0843 1.3107 7.35609 1.09964 7.48737 0.897583L7.49681 0.882812Z",fill:"#D1EDFD"}),n.jsx("path",{d:"M1.68305 6.17249C1.71659 6.1673 1.8134 6.16478 1.84892 6.16432C2.34052 6.15616 2.81496 6.34495 3.16655 6.68866C3.50847 7.01806 3.70349 7.47119 3.70765 7.94596C3.70896 8.42345 3.54045 8.85284 3.20281 9.19025C3.34033 9.28068 3.5321 9.52219 3.6543 9.65748C4.17158 9.39073 4.91447 9.69339 4.79675 10.3444C5.08751 10.5485 5.19656 10.8288 5.0585 11.1674C5.15418 11.2375 5.25595 11.3205 5.32383 11.4186C5.40228 11.5303 5.4309 11.6695 5.40291 11.8031C5.32228 12.1857 4.90085 12.3286 4.57669 12.1236C4.51367 12.0838 4.42258 11.9595 4.35299 11.9431C4.30669 11.9557 4.28453 11.9584 4.23644 11.9644C4.22885 11.9742 4.22118 11.9841 4.21343 11.9938C3.93597 12.3413 3.49234 12.4682 3.06933 12.5157C2.85285 12.518 2.70432 12.5146 2.49066 12.4609C1.80785 12.2892 1.50808 11.6167 1.70723 10.9639C1.829 10.5648 2.11891 10.2506 2.48939 10.0518C2.54655 10.132 2.57559 10.2191 2.64066 10.303C2.73571 10.2223 2.82048 10.1482 2.92363 10.0773C2.81023 9.95313 2.66811 9.7693 2.55817 9.63584C2.38871 9.6878 2.23026 9.72879 2.05298 9.74653C1.54239 9.80228 1.03118 9.64711 0.637735 9.31695C0.269964 9.01018 0.0453493 8.54827 0.00544736 8.07322C-0.0309495 7.60988 0.116099 7.15077 0.414918 6.79478C0.742554 6.41198 1.18728 6.21393 1.68305 6.17249Z",fill:"#475569"}),n.jsx("path",{d:"M1.79616 6.5951C2.54894 6.5619 3.18687 7.14364 3.22301 7.8963C3.25915 8.64894 2.67989 9.28913 1.92739 9.3282C1.17073 9.3675 0.526231 8.78435 0.489885 8.02753C0.45354 7.27071 1.03921 6.62849 1.79616 6.5951Z",fill:"#D1EDFD"}),n.jsx("path",{d:"M4.93607 11.4844C5.12839 11.6261 5.22049 11.9085 4.91876 11.9419C4.8067 11.8805 4.78491 11.8646 4.71094 11.7561C4.81572 11.6752 4.862 11.5925 4.93607 11.4844Z",fill:"#FEFEFD"}),n.jsx("path",{d:"M12.5164 3.58594L12.5715 3.59466C12.6589 3.65863 12.6908 3.94434 12.7882 4.05193C12.8789 4.15216 12.9155 4.17816 13.0326 4.24929C13.1363 4.31224 13.3325 4.34025 13.384 4.43124C13.3643 4.56218 13.0693 4.54857 12.9127 4.69344C12.6903 4.89898 12.7114 5.06971 12.5892 5.28622C12.5669 5.28439 12.5368 5.2868 12.5261 5.27346C12.4336 5.15843 12.4072 4.9308 12.3099 4.81465C12.1627 4.63903 11.9972 4.60054 11.7981 4.51372C11.7544 4.49467 11.7266 4.47099 11.7129 4.42649C11.7867 4.31876 12.0509 4.34309 12.2376 4.14892C12.43 3.94901 12.4155 3.72208 12.5164 3.58594Z",fill:"#475569"}),n.jsx("path",{d:"M2.13644 3.72656C2.24401 3.77084 2.29712 4.1268 2.431 4.25226C2.60327 4.41371 2.7311 4.41949 2.93246 4.52449C2.96024 4.53897 2.97173 4.56042 2.97671 4.58878C2.89584 4.6981 2.61854 4.70721 2.4596 4.85659C2.26275 5.04156 2.27341 5.29132 2.17022 5.42088C2.16192 5.41849 2.11671 5.40232 2.1156 5.40043C2.01291 5.21216 1.9836 5.04909 1.84812 4.87273C1.73599 4.72675 1.36534 4.69959 1.32812 4.56939C1.3835 4.47941 1.67823 4.44211 1.82291 4.30563C2.02737 4.11274 2.0042 3.8372 2.13644 3.72656Z",fill:"#475569"})]}))]}))}))}}},[An,Ae,Xe,de]),Nn=t.useMemo(function(){return be.some(function(e){return e.isSkeleton})},[be]),Dn=function(n){return e.__awaiter(void 0,void 0,void 0,function(){return e.__generator(this,function(t){switch(t.label){case 0:return le?[4,le(n)]:[3,2];case 1:t.sent(),je(function(n){return e.__spreadArray(e.__spreadArray([],n,!0),[{role:"assistant",content:"Thanks for your feedback — this will help improve future suggestions.",id:l.v4(),citations:[],time:new Date,isEnd:!0}],!1)}),setTimeout(function(){return jn("smooth")},100),t.label=2;case 2:return[2]}})})};return n.jsxs("div",e.__assign({className:"".concat(p.default.customFont," ").concat(g.default.chatContainer),style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:se&&!Nn?"0 0 20px 5px rgba(37, 99, 235, 0.5)":"none"}},{children:[n.jsxs("div",e.__assign({ref:fe,className:g.default.scrollWrapper},{children:[n.jsx("div",e.__assign({ref:rn,className:g.default.stickyHeader},{children:n.jsx(c.default,{resetChatHistory:function(){var e="".concat(me,"/api/chat/resetHistory?name=").concat(ce,"&organizationName=").concat(r);try{var n={method:"GET",params:{guestSessionId:ve.current},withCredentials:!0};M.default.get(e,n).then(function(){b(!0),Fe(""),Ye(null),on.current.clear(),_n.current.clear(),he.current="".concat(l.v4()),je([]),De(!0),null==P||P(),A&&A()}).catch(function(e){console.error(e)}).finally(function(){ve.current="".concat(ce,"-").concat(r,"-").concat(l.v4())})}catch(e){Ee(!1),console.error(e)}},isStreamEnd:Ae,chatTitle:q,onResize:U,chatSize:G,movingTowards:Z})})),n.jsxs("div",e.__assign({className:g.default.messagesList},{children:[n.jsxs("div",e.__assign({className:g.default.initialMessageRow},{children:[n.jsx("div",e.__assign({className:g.default.iconWrapper},{children:n.jsx(y.default,{})})),n.jsx("div",e.__assign({className:g.default.welcomeTextWrapper},{children:n.jsx("div",e.__assign({className:g.default.welcomeMarkdownWrapper},{children:n.jsx("span",{children:n.jsx(k.default,e.__assign({rehypePlugins:[E.default],components:In},{children:B}))})}))}))]})),be.length>0&&be.map(function(t,a){var s,i;return n.jsxs("div",e.__assign({className:g.default.messageRow},{children:["assistant"===t.role?n.jsx("div",e.__assign({className:g.default.assistantIconContainer},{children:n.jsx(y.default,{})})):n.jsx("div",{className:g.default.userSpacer}),n.jsx("div",e.__assign({className:g.default.messageContent},{children:"assistant"===t.role?n.jsxs(n.Fragment,{children:[t.orchestratorAndAgentsMessages&&t.orchestratorAndAgentsMessages.length>0&&n.jsx(d.WatchMeWork,{orchestratorAndAgentsMessages:null==t?void 0:t.orchestratorAndAgentsMessages,isStreamEnd:Ae,finalTimeTaken:null==t?void 0:t.finalTimeTaken},null!==(s=null==t?void 0:t.finalTimeTaken)&&void 0!==s?s:null==t?void 0:t.id),n.jsx(v.default,{index:a,content:null==t?void 0:t.content,role:null==t?void 0:t.role,messages:be,handleStream:Tn,isLastMessage:a===be.length-1,onSave:H,citations:null==t?void 0:t.citations,setChatSize:U,chatSize:G,isStreamEnd:Ae,messageIsEnd:null==t?void 0:t.isEnd,onViewComparison:re,onTypeResponseClick:function(){var e;hn(!0),null===(e=_e.current)||void 0===e||e.focus()},onComparisonLinkClick:oe,baseURL:me,onFeedbackSubmit:Dn,isGlobalEditActive:de}),t.hasOwnProperty("isEnd")&&!(null==t?void 0:t.isEnd)&&(null===(i=null==t?void 0:t.content)||void 0===i?void 0:i.length)>0&&n.jsxs(n.Fragment,{children:[n.jsx(h.Skeleton,{variant:"text",width:"50%",height:20}),n.jsx("div",{style:{marginTop:"10px"}}),n.jsx(h.Skeleton,{variant:"text",width:"100%",height:40})]}),n.jsx("div",e.__assign({className:g.default.timestamp},{children:t.time&&!isNaN(new Date(t.time).getTime())?new Date(t.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}):n.jsxs("div",e.__assign({className:g.default.userMessageWrapper},{children:[n.jsxs("div",e.__assign({className:g.default.userMessageBubble,style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:t.isSkeleton||Nn||t.id!==un?"none":"0 0 15px 3px rgba(37, 99, 235, 0.6)"}},{children:[t.isSkeleton?n.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:"12px",minWidth:"280px",padding:"8px 0"}},{children:[n.jsx(h.Skeleton,{variant:"text",width:"100%",height:16}),n.jsx(h.Skeleton,{variant:"text",width:"80%",height:16})]})):n.jsx(v.default,{index:a,content:null==t?void 0:t.content,role:null==t?void 0:t.role,messages:be,handleStream:Tn,isLastMessage:a===be.length-1,onSave:H,citations:null==t?void 0:t.citations,isStreamEnd:Ae,isGlobalEditActive:de,messageIsEnd:null==t?void 0:t.isEnd,onViewComparison:re,onComparisonLinkClick:oe,baseURL:me,onFeedbackSubmit:Dn}),n.jsx("div",e.__assign({style:{marginTop:"0.5rem"}},{children:n.jsx(S.UserIcon,{})}))]})),n.jsx("div",e.__assign({className:g.default.userTimestamp},{children:new Date(t.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}))}))]}),t.id)}),ke&&n.jsxs("div",e.__assign({className:g.default.loadingRow},{children:[n.jsx("div",e.__assign({className:g.default.iconWrapper,style:{marginTop:"0.2rem"}},{children:n.jsx(y.default,{})})),n.jsx("div",e.__assign({className:g.default.loadingTextWrapper},{children:n.jsx("span",{children:We})}))]})),n.jsx("div",{ref:pe,style:{float:"left",clear:"both"}})]}))]})),n.jsx("div",e.__assign({className:g.default.inputAreaWrapper},{children:n.jsx(w.default,e.__assign({title:D?"Please wait for the validation to be completed.":""},{children:n.jsxs("div",e.__assign({className:"".concat(g.default.inputBoxContainer," ").concat(yn?g.default.disabled:""),style:vn?{boxShadow:"0 0 15px 3px rgba(37, 99, 235, 0.5)",borderColor:"#2563eb",transition:"box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out"}:{transition:"box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out"}},{children:[be.length>0&&!Oe&&n.jsx("div",e.__assign({onMouseDown:function(e){e.preventDefault(),jn("smooth")},className:g.default.scrollToBottomBtn},{children:n.jsx(_.ScrollToBottom,{})})),n.jsxs("div",e.__assign({style:{width:"100%",display:"flex"}},{children:[n.jsx("textarea",{ref:_e,placeholder:V,value:xe||"",onChange:function(e){ye(e.target.value)},onFocus:function(){return Ze(!0)},onBlur:function(){return Ze(!1)},onKeyDown:function(e){return Tn(e)},disabled:yn,className:"no-scrollbar ".concat(g.default.chatTextarea),style:{minHeight:Ue?"120px":"50px",height:Ue?"120px":"50px",maxHeight:"120px"}}),n.jsx("span",e.__assign({className:g.default.sendButtonWrapper},{children:n.jsx("button",e.__assign({onClick:function(e){Sn||Tn(new KeyboardEvent("keydown",{key:"Enter"}))},disabled:Sn,className:"".concat(g.default.sendButton," ").concat(Sn?g.default.disabled:g.default.active)},{children:n.jsx(x.SendButton,{})}))}))]}))]}))}))})),n.jsxs("div",e.__assign({className:g.default.footerTools},{children:[n.jsx(w.default,e.__assign({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n.jsx("span",e.__assign({className:g.default.footerToolItem},{children:n.jsx(f.default,{amplitude:1,variant:"speaker",isActive:!1,onClick:function(){return null},disabled:!1})}))})),n.jsx(w.default,e.__assign({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:n.jsx("span",e.__assign({className:g.default.footerToolItem},{children:n.jsx(f.default,{amplitude:1,variant:"microphone",isActive:!1,onClick:function(){return null},disabled:!1})}))}))]}))]}))};
|
|
2
2
|
//# sourceMappingURL=ChatComponent.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("tslib"),e=require("react/jsx-runtime"),n=require("react"),t=require("../../InputDataReasoningCard.js"),o=require("../../organisms/ConditionSection/ConditionSection.js"),l=require("../../organisms/ConfigSection/ConfigSection.js"),a=require("../../organisms/ScopeSection/ScopeSection.js"),r=require("../../organisms/TextSection/TextSection.js"),d=require("../../AccordianSection.js"),s=require("../../_svg/ButtonCognitiveIcon.js"),c=require("lucide-react");function u(i){return i&&"object"==typeof i&&"default"in i?i:{default:i}}var v=u(n),p=function(n){var t=n.children,o=n.onAddVariant,l=n.isDisabled,a=v.default.Children.toArray(t);return e.jsxs("div",i.__assign({style:{display:"flex",flexDirection:"column",alignItems:"flex-start"}},{children:[a.map(function(i,n){return e.jsxs(v.default.Fragment,{children:[i,e.jsx("div",{style:{width:"2px",height:"20px",backgroundColor:"#E2E8F0",marginLeft:"30px"}})]},n)}),e.jsx("div",i.__assign({onClick:l?void 0:o,style:{padding:"8px 16px",border:"1px solid #E2E8F0",borderRadius:"8px",color:l?"#94a3b8":"#475569",fontSize:"14px",fontWeight:"500",cursor:l?"not-allowed":"pointer",backgroundColor:l?"#f8fafc":"#FFFFFF",opacity:l?.7:1,userSelect:"none",transition:"all 0.2s ease"}},{children:"Add Variant"}))]}))};exports.CreateRule=function(u){var g,f,h,x,y,_,m,S,T,D,C,I=u.state,A=u.handlers,j=u.uiState,b=(null==j?void 0:j.highlights)||new Map,E=b.get("global_0")||{},O=n.useState({}),w=O[0],R=O[1],V=n.useState(null),N=V[0],W=V[1],q="rule-setup"===(null==j?void 0:j.activeEditId),M=v.default.useRef(new Map),k=n.useState(null),F=k[0],B=k[1],L=n.useState(null),P=L[0],z=L[1],H=n.useState(!1),J=H[0],K=H[1],$=v.default.useRef(null==j?void 0:j.isAiStreaming);n.useEffect(function(){$.current&&!(null==j?void 0:j.isAiStreaming)&&J&&K(!1),$.current=null==j?void 0:j.isAiStreaming},[null==j?void 0:j.isAiStreaming,J]);var U=function(){var i;B(null),z(null),null===(i=null==j?void 0:j.setActiveEditId)||void 0===i||i.call(j,null)},Z=function(){var i,e,n=null!=F?F:I.ruleTitle,t=null!=P?P:I.scopeData,o=n!==I.ruleTitle,l=JSON.stringify(t)!==JSON.stringify(I.scopeData);if(!o&&!l)return B(null),z(null),void(null===(i=null==j?void 0:j.setActiveEditId)||void 0===i||i.call(j,null));if(null==j?void 0:j.setSendMessageInChat){var a="sk-".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2,8)),r=[];if(o&&r.push((null==n?void 0:n.trim())?"Title with ".concat(n):"No Title"),l){var d=null==t?void 0:t.tiers,s=d&&d.length>0?"tiers: ".concat(d.join(", ")):"No Tier Selected";r.push(s)}var c=r.join(" and ");j.setSendMessageInChat("__SKELETON__:".concat(a,":Update Rule Setup ").concat(c))}K(!0),B(null),z(null),null===(e=null==j?void 0:j.setActiveEditId)||void 0===e||e.call(j,null)},G=null!==F?null==F?void 0:F.trim():(I.ruleTitle||"").trim(),Q=null!=P?P:I.scopeData,X=G!==(I.ruleTitle||"").trim(),Y=JSON.stringify(Q)!==JSON.stringify(I.scopeData),ii=!X&&!Y||""===G,ei=v.default.useRef(null==j?void 0:j.defaultVariantOpen),ni=v.default.useRef(I.variantsByTier);v.default.useEffect(function(){var i,e,n,t,o=null,l=!1;if(ei.current!==(null==j?void 0:j.defaultVariantOpen)&&(l=!0,ei.current=null==j?void 0:j.defaultVariantOpen),l){if(null==(null==j?void 0:j.defaultVariantOpen)||(null==j?void 0:j.defaultVariantOpen)<0)return W(null),void(ni.current=I.variantsByTier);null===(e=null===(i=null==j?void 0:j.tierOptions)||void 0===i?void 0:i.filter(function(i){var e,n;return null===(n=null===(e=I.scopeData)||void 0===e?void 0:e.tiers)||void 0===n?void 0:n.includes(i)}))||void 0===e||e.forEach(function(i){var e,n=i.toLowerCase().replace(/ /g,"_");((null===(e=I.variantsByTier)||void 0===e?void 0:e[n])||[]).forEach(function(i,e){(null==j?void 0:j.defaultVariantOpen)===e&&(o="".concat(n,"-variant-").concat(e)),(null==j?void 0:j.autoScrollVariantIndex)===e&&(o="".concat(n,"-variant-").concat(e))})}),o&&W(o)}null===N&&(null==j?void 0:j.defaultVariantOpen)>=0&&(null===(t=null===(n=null==j?void 0:j.tierOptions)||void 0===n?void 0:n.filter(function(i){var e,n;return null===(n=null===(e=I.scopeData)||void 0===e?void 0:e.tiers)||void 0===n?void 0:n.includes(i)}))||void 0===t||t.forEach(function(i){var e,n=i.toLowerCase().replace(/ /g,"_");((null===(e=I.variantsByTier)||void 0===e?void 0:e[n])||[])[j.defaultVariantOpen]&&W("".concat(n,"-variant-").concat(j.defaultVariantOpen))})),ni.current=I.variantsByTier},[I.variantsByTier,null==j?void 0:j.defaultVariantOpen,null===(g=I.scopeData)||void 0===g?void 0:g.tiers,null==j?void 0:j.tierOptions,null==j?void 0:j.autoScrollVariantIndex]);var ti=function(e){R(function(n){var t;return i.__assign(i.__assign({},n),((t={})[e]=!n[e],t))})},oi=function(i){var e,n,t,o=i.split("_"),l=o[o.length-1],a=/^\d+$/.test(l)?o.slice(0,-1).join("_"):i,r=null===(e=I.fieldCitations)||void 0===e?void 0:e[a];if(Array.isArray(r)&&r.length>0)return r;var d=null===(n=I.fieldCitations)||void 0===n?void 0:n[i];return Array.isArray(d)&&d.length>0?d:null!==(t=I.citations)&&void 0!==t?t:[]},li={marginTop:"-17px",position:"relative",zIndex:1};n.useEffect(function(){var i,e;null!=(null==j?void 0:j.autoScrollVariantIndex)&&(null===(e=null===(i=null==j?void 0:j.tierOptions)||void 0===i?void 0:i.filter(function(i){var e,n;return null===(n=null===(e=I.scopeData)||void 0===e?void 0:e.tiers)||void 0===n?void 0:n.includes(i)}))||void 0===e||e.forEach(function(i){var e=i.toLowerCase().replace(/ /g,"_"),n="".concat(e,"-variant-").concat(j.autoScrollVariantIndex),t=M.current.get(n);t&&requestAnimationFrame(function(){setTimeout(function(){t.scrollIntoView({behavior:"smooth",block:"center"})},300)})}))},[null==j?void 0:j.scrollTrigger]),console.log("CreateRule state:",I),console.log("CreateRule uiState:",j);var ai=function(i){return i?i.replace(/_/g," ").replace(/([a-zA-Z])(\d)/g,"$1 $2").replace(/\b\w/g,function(i){return i.toUpperCase()}):"Variant 1"},ri=!!(null==j?void 0:j.activeEditId);return e.jsxs("div",i.__assign({className:"traffic-manager-template"},{children:[e.jsx("div",i.__assign({"data-edit-id":"rule-setup"},{children:e.jsx(d.default,i.__assign({title:{type:"other",label:(null==j?void 0:j.setupLabel)||"Rule Setup"},actionButtons:function(n,t){if(q)return null;var o=!!(null==j?void 0:j.activeEditId)&&"rule-setup"!==j.activeEditId;return e.jsx("div",i.__assign({style:{position:"relative",display:"flex",flexDirection:"column"}},{children:e.jsx("button",i.__assign({title:o?"Save active edits first":"Edit",onClick:function(e){e.stopPropagation(),o?(null==j?void 0:j.setPendingEditId)&&j.setPendingEditId(j.activeEditId||null):(!function(){var e,n;(null==j?void 0:j.activeEditId)&&"rule-setup"!==j.activeEditId||(null===(e=null==j?void 0:j.setActiveEditId)||void 0===e||e.call(j,"rule-setup"),B(null!==(n=I.ruleTitle)&&void 0!==n?n:""),z(I.scopeData?i.__assign({},I.scopeData):{}))}(),(null==j?void 0:j.setPendingEditId)&&j.setPendingEditId(null),n||t())},disabled:J,style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",padding:"6px 8px",border:"1px solid #e5e7eb",borderRadius:"8px",cursor:J?"not-allowed":"pointer",backgroundColor:"#ffffff",color:"#6b7280",opacity:J?.5:1}},{children:e.jsx(c.Pencil,{size:14})}))}))},footerData:{ruleTitle:I.ruleTitle,stations:[I.scopeData.station],tiers:null===(f=I.scopeData)||void 0===f?void 0:f.tiers},defaultOpen:"Create"===(null==j?void 0:j.usedFor),readOnly:"Create"!==(null==j?void 0:j.usedFor),isAiStreaming:null==j?void 0:j.isAiStreaming,editFlow:"Edit"===(null==j?void 0:j.usedFor)},{children:e.jsxs("div",i.__assign({style:{display:"flex",flexDirection:"column",gap:"12px"}},{children:[J&&(null==j?void 0:j.isAiStreaming)&&e.jsxs("div",i.__assign({style:{display:"flex",alignItems:"center",color:"#141414ff",fontSize:"13px",fontWeight:500,fontStyle:"italic",marginBottom:"8px",paddingLeft:"4px"}},{children:[e.jsx(c.Loader2Icon,{size:16,style:{marginRight:8,animation:"spin 1s linear infinite"}},"loader"),"Checking the correctness of your Rule Setup..."]})),e.jsx(r.TextSection,i.__assign({id:"rule-title",title:j.ruleTitle||"Rule Title",rows:1,placeholder:"Enter a short, descriptive title for the learning",required:!0,value:q&&null!==F?F:I.ruleTitle,onChange:function(i){return q?B(i):A.setRuleTitle(i)},readOnly:(null==j?void 0:j.isAiStreaming)||!q,isOpen:w.ruleTitle,onToggle:function(){return ti("ruleTitle")},isHighlighted:E.ruleTitle||!1,showCognitiveIcon:I.citation.ruleTitle,tooltipDescription:"Why this Title?",errorMessage:null===(h=j.validationErrors)||void 0===h?void 0:h.ruleTitle},j)),I.citation.ruleTitle&&e.jsx("div",i.__assign({style:li},{children:e.jsx(t.InputDataReasoningCard,{isVisible:w.ruleTitle,citation:I.citation.ruleTitle,citations:oi("ruleTitle"),fieldName:"Rule Title",fieldValue:I.ruleTitle})})),e.jsx(a.ScopeSection,i.__assign({id:"scope",title:"",required:!1,scopeData:q&&null!==P?P:I.scopeData,onScopeChange:function(e,n){q?z(function(t){var o;return i.__assign(i.__assign({},null!=t?t:I.scopeData),((o={})[e]=n,o))}):A.onScopeChange(e,n)},tierLabel:"Which tiers should this learning apply to?",stationLabel:"Which scope should this learning belong to?",highlights:E,isOpen:w.scopeData,onToggle:function(){return ti("scopeData")},showCognitiveIcon:I.citation.scopeData,cognitiveIcon:e.jsx(s.ButtonCognitiveIcon,{}),tooltipDescription:"Why this Scope?",errorMessage:(null===(x=j.validationErrors)||void 0===x?void 0:x.station)||(null===(y=j.validationErrors)||void 0===y?void 0:y.tiers),stationErrorMessage:null===(_=j.validationErrors)||void 0===_?void 0:_.station,tierErrorMessage:null===(m=j.validationErrors)||void 0===m?void 0:m.tiers,readOnly:(null==j?void 0:j.isAiStreaming)||!q},j)),I.citation.scopeData&&e.jsx("div",i.__assign({style:li},{children:e.jsx(t.InputDataReasoningCard,{isVisible:w.scopeData,citation:I.citation.scopeData,citations:oi("scopeData"),fieldName:"Scope",fieldValue:null===(T=null===(S=I.scopeData)||void 0===S?void 0:S.tiers)||void 0===T?void 0:T.join(", ")})})),q?e.jsxs("div",i.__assign({style:{display:"flex",flexDirection:"column",alignItems:"flex-start"}},{children:[e.jsxs("div",i.__assign({style:{display:"flex",justifyContent:"flex-start",alignItems:"center",gap:"16px"}},{children:[e.jsx("button",i.__assign({onClick:U,style:{background:"none",border:"none",color:"#6b7280",fontSize:"14px",fontWeight:"500",cursor:"pointer",padding:"0"}},{children:"Discard Changes"})),e.jsxs("button",i.__assign({onClick:Z,disabled:ii,style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",borderRadius:"12px",border:"none",backgroundColor:"#2563eb",color:"#ffffff",fontSize:"14px",fontWeight:"500",cursor:ii?"not-allowed":"pointer",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.05)",opacity:ii?.5:1}},{children:[e.jsx(c.Check,{size:18,strokeWidth:2.5,color:"#ffffff"}),"Save Changes"]}))]})),"rule-setup"===(null==j?void 0:j.pendingEditId)&&e.jsxs("div",i.__assign({style:{display:"flex",alignItems:"center",gap:"6px",marginTop:"8px"}},{children:[e.jsx(c.AlertTriangle,{style:{color:"#C2410C"}}),e.jsx("div",i.__assign({style:{display:"flex",color:"#C2410C",fontSize:"13px",paddingTop:"8px",alignItems:"center"}},{children:"Pending - Changes not applied yet. Apply or discard them to continue."}))]}))]})):null]}))}))})),null===(C=null===(D=null==j?void 0:j.tierOptions)||void 0===D?void 0:D.filter(function(i){var e,n;return null===(n=null===(e=I.scopeData)||void 0===e?void 0:e.tiers)||void 0===n?void 0:n.includes(i)}))||void 0===C?void 0:C.map(function(n,a,s){var c,u,v,g,f=n.toLowerCase().replace(/ /g,"_"),h=(null===(c=I.variantsByTier)||void 0===c?void 0:c[f])||[],x=h.length,y=!1;if(1===x){var _=h[0],m=!(null===(u=null==_?void 0:_.ruleDescription)||void 0===u?void 0:u.trim()),S=(null===(v=null==_?void 0:_.whenToApplyConditions)||void 0===v?void 0:v.some(function(i){return(null==i?void 0:i.text)&&""!==i.text.trim()}))||!1,T=(null===(g=null==_?void 0:_.whenNotToApplyConditions)||void 0===g?void 0:g.some(function(i){return(null==i?void 0:i.text)&&""!==i.text.trim()}))||!1;m&&!S&&!T&&(y=!0)}var D=y?void 0:"".concat(x," ").concat(1===x?"variant":"variants"," configured for this tier"),C=!((null==j?void 0:j.defaultTierOpen)>=0)||a===j.defaultTierOpen;return console.log("Rendering tier : ",n),e.jsx(d.default,i.__assign({variant:"tier-header",title:{type:"other",label:n},subtitle:D,defaultOpen:C,footerData:{description:"Variants for ".concat(n)}},{children:e.jsx(p,i.__assign({onAddVariant:function(){var i;return null===(i=A.addNewVariant)||void 0===i?void 0:i.call(A,f)},isDisabled:null==j?void 0:j.isAiStreaming},{children:h.map(function(n,a){var s,c,u,v,p,g,h,x,y,_,m,S=n.variantType||"default",T="".concat(f,"-variant-").concat(a),D=!0===n.is_variant,C="default"===S||"default_variant"===S;(null==j?void 0:j.defaultVariantOpen)>=0&&j.defaultVariantOpen;var E="".concat(f,"_").concat(a),O=b.get(E)||{},R=(null===(c=null===(s=j.separationItemsByTier)||void 0===s?void 0:s[f])||void 0===c?void 0:c.get(a))||[],V=(null===(v=null===(u=j.togglesByTier)||void 0===u?void 0:u[f])||void 0===v?void 0:v.get(a))||[];(null==j?void 0:j.autoScrollVariantIndex)===a||n.is_variant,console.log("Rendering ".concat(f," variant ").concat(a,":"),n),console.log("Rendering Variant : ",n),console.log("Open Accordion ID:",N,"Current Variant ID:",T);var q=null===(p=null==j?void 0:j.activeEditId)||void 0===p?void 0:p.startsWith("condition-wta-".concat(f,"-").concat(a)),k=null===(g=null==j?void 0:j.activeEditId)||void 0===g?void 0:g.startsWith("condition-wnta-".concat(f,"-").concat(a));return e.jsx("div",i.__assign({ref:function(i){i?M.current.set(T,i):M.current.delete(T)},style:{width:"100%"}},{children:e.jsx(d.default,i.__assign({title:{type:C?"default":"variant",label:ai(S),number:a+1,isNewVariant:D,isDefault:n.isDefault,isModified:n.isModified},defaultOpen:!0,expanded:N===T,onToggle:function(){var i,e=N===T;console.log("is closing:",e),W(e?null:T),null===(i=null==j?void 0:j.setActiveVariantAccordionIndex)||void 0===i||i.call(j,e?null:a)},variant:"rule-behavior",footerData:{ruleTitle:S,description:n.ruleDescription||""}},{children:e.jsxs("div",i.__assign({style:{display:"flex",flexDirection:"column",gap:"12px"}},{children:[e.jsx(r.TextSection,i.__assign({id:"rule-description-".concat(f,"-").concat(a),title:j.ruleDescriptionTitle||"Rule Description",rows:2,placeholder:"Explain the learning behaviour",required:!0,readOnly:n.isReadOnly||(null==j?void 0:j.isAiStreaming)||ri&&(null==j?void 0:j.activeEditId)!=="rule-description-".concat(f,"-").concat(a),value:n.ruleDescription||"",onChange:function(i){return A.setRuleDescription(f,a,i)},isOpen:w["ruleDescription-".concat(f)],onToggle:function(){return ti("ruleDescription-".concat(f))},isHighlighted:O.ruleDescription||!1,showCognitiveIcon:null===(h=I.citation)||void 0===h?void 0:h["ruleDescription_".concat(f)],tooltipDescription:"Why this Description?",errorMessage:null===(x=j.validationErrors)||void 0===x?void 0:x["ruleDescription-".concat(f,"-").concat(a)],enableInlineEdit:!0,setSendMessageInChat:null==j?void 0:j.setSendMessageInChat,isAiStreaming:null==j?void 0:j.isAiStreaming,fieldName:"Rule Description"},j)),(null===(y=I.citation)||void 0===y?void 0:y["ruleDescription_".concat(f)])&&e.jsx("div",i.__assign({style:li},{children:e.jsx(t.InputDataReasoningCard,{isVisible:w["ruleDescription-".concat(f)],citation:I.citation["ruleDescription_".concat(f)],citations:oi("ruleDescription_".concat(f,"_").concat(a)),fieldName:"Rule Description",fieldValue:n.ruleDescription})})),e.jsx(o.ConditionSection,i.__assign({id:"when-to-apply-".concat(f,"-").concat(a),idPrefix:"condition-wta",title:j.whenToApplyTitle||"When to apply",required:!0,dividerRequired:!0,readOnly:n.isReadOnly||(null==j?void 0:j.isAiStreaming)||ri&&!q,conditions:n.whenToApplyConditions||[],onAdd:function(){return A.addWhenToApply(f,a)},onRemove:function(i,e,n){return A.removeWhenToApply(i,e,n)},onEdit:function(i,e,n,t){return A.editWhenToApply(i,e,n,t)},index:a,tierKey:f,isHighlighted:O.wta||!1,highlightedIds:null==j?void 0:j.highlightedIds,tooltipDescription:"Why this Condition?",citations:oi("whenToApply_".concat(f,"_").concat(a)),bordered:!0,addLabel:"Add When to apply",isAiStreaming:j.isAiStreaming,errorMessage:(null===(_=j.validationErrors)||void 0===_?void 0:_["whenToApply-".concat(f,"-").concat(a)])||(null==j?void 0:j.conflictReason)},j)),e.jsx(o.ConditionSection,i.__assign({id:"when-not-to-apply-".concat(f,"-").concat(a),idPrefix:"condition-wnta",title:j.whenNotToApplyTitle||"When NOT to apply",required:!1,dividerRequired:!0,readOnly:n.isReadOnly||(null==j?void 0:j.isAiStreaming)||ri&&!k,conditions:n.whenNotToApplyConditions||[],onAdd:function(){return A.addWhenNotToApply(f,a)},onRemove:function(i,e,n){return A.removeWhenNotToApply(i,e,n)},onEdit:function(i,e,n,t){return A.editWhenNotToApply(i,e,n,t)},index:a,tierKey:f,isHighlighted:O.wnta||!1,highlightedIds:null==j?void 0:j.highlightedIds,tooltipDescription:"Why this Condition?",citations:oi("whenNotToApply_".concat(f,"_").concat(a)),bordered:!0,addLabel:"Add When NOT to apply",isAiStreaming:j.isAiStreaming},j)),e.jsx(l.ConfigSection,i.__assign({id:"config-".concat(f,"-").concat(a),title:j.configTitle||"Configuration",required:!1,highlights:O,bordered:!0,readOnly:n.isReadOnly||(null==j?void 0:j.isAiStreaming)||ri&&(null==j?void 0:j.activeEditId)!=="config-".concat(f,"-").concat(a),onConfigChange:function(i,e){return A.onConfigChange(f,a,i,e)},separationItems:R,toggles:V,index:a},j)),(null===(m=n.reasoning)||void 0===m?void 0:m.configData)&&e.jsx("div",i.__assign({style:li},{children:e.jsx(t.InputDataReasoningCard,{citation:n.reasoning.configData,citations:oi("configData_".concat(f,"_").concat(a)),fieldName:"Configuration",fieldValue:"Proposed Configuration"})}))]}))}),T)}),"".concat(f,"-variant-").concat(a))})}))}),"tier-".concat(a))})]}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("tslib"),e=require("react/jsx-runtime"),n=require("react"),t=require("../../InputDataReasoningCard.js"),o=require("../../organisms/ConditionSection/ConditionSection.js"),l=require("../../organisms/ConfigSection/ConfigSection.js"),a=require("../../organisms/ScopeSection/ScopeSection.js"),r=require("../../organisms/TextSection/TextSection.js"),d=require("../../AccordianSection.js"),s=require("../../_svg/ButtonCognitiveIcon.js"),c=require("lucide-react");function u(i){return i&&"object"==typeof i&&"default"in i?i:{default:i}}var v=u(n),p=function(n){var t=n.children,o=n.onAddVariant,l=n.isDisabled,a=n.showAddVariantBtn,r=void 0===a||a,d=v.default.Children.toArray(t);return e.jsxs("div",i.__assign({style:{display:"flex",flexDirection:"column",alignItems:"flex-start"}},{children:[d.map(function(i,n){var t=!(n===d.length-1)||r;return e.jsxs(v.default.Fragment,{children:[i,t&&e.jsx("div",{style:{width:"2px",height:"20px",backgroundColor:"#E2E8F0",marginLeft:"30px"}})]},n)}),r&&e.jsx("div",i.__assign({onClick:l?void 0:o,style:{padding:"8px 16px",border:"1px solid #E2E8F0",borderRadius:"8px",color:l?"#94a3b8":"#475569",fontSize:"14px",fontWeight:"500",cursor:l?"not-allowed":"pointer",backgroundColor:l?"#f8fafc":"#FFFFFF",opacity:l?.7:1,userSelect:"none",transition:"all 0.2s ease"}},{children:"Add Variant"}))]}))};exports.CreateRule=function(u){var g,f,h,x,y,_,m,S,T,D,C,A=u.state,I=u.handlers,j=u.uiState,b=(null==j?void 0:j.highlights)||new Map,E=b.get("global_0")||{},O=n.useState({}),w=O[0],R=O[1],V=n.useState(null),N=V[0],W=V[1],q="rule-setup"===(null==j?void 0:j.activeEditId),M=v.default.useRef(new Map),B=n.useState(null),F=B[0],k=B[1],L=n.useState(null),P=L[0],z=L[1],H=n.useState(!1),J=H[0],K=H[1],$=v.default.useRef(null==j?void 0:j.isAiStreaming);n.useEffect(function(){$.current&&!(null==j?void 0:j.isAiStreaming)&&J&&K(!1),$.current=null==j?void 0:j.isAiStreaming},[null==j?void 0:j.isAiStreaming,J]);var U=function(){var i;k(null),z(null),null===(i=null==j?void 0:j.setActiveEditId)||void 0===i||i.call(j,null)},Z=function(){var i,e,n=null!=F?F:A.ruleTitle,t=null!=P?P:A.scopeData,o=n!==A.ruleTitle,l=JSON.stringify(t)!==JSON.stringify(A.scopeData);if(!o&&!l)return k(null),z(null),void(null===(i=null==j?void 0:j.setActiveEditId)||void 0===i||i.call(j,null));if(null==j?void 0:j.setSendMessageInChat){var a="sk-".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2,8)),r=[];if(o&&r.push((null==n?void 0:n.trim())?"Title with ".concat(n):"No Title"),l){var d=null==t?void 0:t.tiers,s=d&&d.length>0?"tiers: ".concat(d.join(", ")):"No Tier Selected";r.push(s)}var c=r.join(" and ");j.setSendMessageInChat("__SKELETON__:".concat(a,":Update Rule Setup ").concat(c))}K(!0),k(null),z(null),null===(e=null==j?void 0:j.setActiveEditId)||void 0===e||e.call(j,null)},G=null!==F?null==F?void 0:F.trim():(A.ruleTitle||"").trim(),Q=null!=P?P:A.scopeData,X=G!==(A.ruleTitle||"").trim(),Y=JSON.stringify(Q)!==JSON.stringify(A.scopeData),ii=!X&&!Y||""===G,ei=v.default.useRef(null==j?void 0:j.defaultVariantOpen),ni=v.default.useRef(A.variantsByTier);v.default.useEffect(function(){var i,e,n,t,o=null,l=!1;if(ei.current!==(null==j?void 0:j.defaultVariantOpen)&&(l=!0,ei.current=null==j?void 0:j.defaultVariantOpen),l){if(null==(null==j?void 0:j.defaultVariantOpen)||(null==j?void 0:j.defaultVariantOpen)<0)return W(null),void(ni.current=A.variantsByTier);null===(e=null===(i=null==j?void 0:j.tierOptions)||void 0===i?void 0:i.filter(function(i){var e,n;return null===(n=null===(e=A.scopeData)||void 0===e?void 0:e.tiers)||void 0===n?void 0:n.includes(i)}))||void 0===e||e.forEach(function(i){var e,n=i.toLowerCase().replace(/ /g,"_");((null===(e=A.variantsByTier)||void 0===e?void 0:e[n])||[]).forEach(function(i,e){(null==j?void 0:j.defaultVariantOpen)===e&&(o="".concat(n,"-variant-").concat(e)),(null==j?void 0:j.autoScrollVariantIndex)===e&&(o="".concat(n,"-variant-").concat(e))})}),o&&W(o)}null===N&&(null==j?void 0:j.defaultVariantOpen)>=0&&(null===(t=null===(n=null==j?void 0:j.tierOptions)||void 0===n?void 0:n.filter(function(i){var e,n;return null===(n=null===(e=A.scopeData)||void 0===e?void 0:e.tiers)||void 0===n?void 0:n.includes(i)}))||void 0===t||t.forEach(function(i){var e,n=i.toLowerCase().replace(/ /g,"_");((null===(e=A.variantsByTier)||void 0===e?void 0:e[n])||[])[j.defaultVariantOpen]&&W("".concat(n,"-variant-").concat(j.defaultVariantOpen))})),ni.current=A.variantsByTier},[A.variantsByTier,null==j?void 0:j.defaultVariantOpen,null===(g=A.scopeData)||void 0===g?void 0:g.tiers,null==j?void 0:j.tierOptions,null==j?void 0:j.autoScrollVariantIndex]);var ti=function(e){R(function(n){var t;return i.__assign(i.__assign({},n),((t={})[e]=!n[e],t))})},oi=function(i){var e,n,t,o=i.split("_"),l=o[o.length-1],a=/^\d+$/.test(l)?o.slice(0,-1).join("_"):i,r=null===(e=A.fieldCitations)||void 0===e?void 0:e[a];if(Array.isArray(r)&&r.length>0)return r;var d=null===(n=A.fieldCitations)||void 0===n?void 0:n[i];return Array.isArray(d)&&d.length>0?d:null!==(t=A.citations)&&void 0!==t?t:[]},li={marginTop:"-17px",position:"relative",zIndex:1};n.useEffect(function(){var i,e;null!=(null==j?void 0:j.autoScrollVariantIndex)&&(null===(e=null===(i=null==j?void 0:j.tierOptions)||void 0===i?void 0:i.filter(function(i){var e,n;return null===(n=null===(e=A.scopeData)||void 0===e?void 0:e.tiers)||void 0===n?void 0:n.includes(i)}))||void 0===e||e.forEach(function(i){var e=i.toLowerCase().replace(/ /g,"_"),n="".concat(e,"-variant-").concat(j.autoScrollVariantIndex),t=M.current.get(n);t&&requestAnimationFrame(function(){setTimeout(function(){t.scrollIntoView({behavior:"smooth",block:"center"})},300)})}))},[null==j?void 0:j.scrollTrigger]),console.log("CreateRule state:",A),console.log("CreateRule uiState:",j);var ai=function(i){return i?i.replace(/_/g," ").replace(/([a-zA-Z])(\d)/g,"$1 $2").replace(/\b\w/g,function(i){return i.toUpperCase()}):"Variant 1"},ri=!!(null==j?void 0:j.activeEditId);return e.jsxs("div",i.__assign({className:"traffic-manager-template"},{children:[e.jsx("div",i.__assign({"data-edit-id":"rule-setup"},{children:e.jsx(d.default,i.__assign({title:{type:"other",label:(null==j?void 0:j.setupLabel)||"Rule Setup"},actionButtons:function(n,t){if(q)return null;var o=!!(null==j?void 0:j.activeEditId)&&"rule-setup"!==j.activeEditId;return e.jsx("div",i.__assign({style:{position:"relative",display:"flex",flexDirection:"column"}},{children:e.jsx("button",i.__assign({title:o?"Save active edits first":"Edit",onClick:function(e){e.stopPropagation(),o?(null==j?void 0:j.setPendingEditId)&&j.setPendingEditId(j.activeEditId||null):(!function(){var e,n;(null==j?void 0:j.activeEditId)&&"rule-setup"!==j.activeEditId||(null===(e=null==j?void 0:j.setActiveEditId)||void 0===e||e.call(j,"rule-setup"),k(null!==(n=A.ruleTitle)&&void 0!==n?n:""),z(A.scopeData?i.__assign({},A.scopeData):{}))}(),(null==j?void 0:j.setPendingEditId)&&j.setPendingEditId(null),n||t())},disabled:J,style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",padding:"6px 8px",border:"1px solid #e5e7eb",borderRadius:"8px",cursor:J?"not-allowed":"pointer",backgroundColor:"#ffffff",color:"#6b7280",opacity:J?.5:1}},{children:e.jsx(c.Pencil,{size:14})}))}))},footerData:{ruleTitle:A.ruleTitle,stations:[A.scopeData.station],tiers:null===(f=A.scopeData)||void 0===f?void 0:f.tiers},defaultOpen:"Create"===(null==j?void 0:j.usedFor),readOnly:"Create"!==(null==j?void 0:j.usedFor),isAiStreaming:null==j?void 0:j.isAiStreaming,editFlow:"Edit"===(null==j?void 0:j.usedFor)},{children:e.jsxs("div",i.__assign({style:{display:"flex",flexDirection:"column",gap:"12px"}},{children:[J&&(null==j?void 0:j.isAiStreaming)&&e.jsxs("div",i.__assign({style:{display:"flex",alignItems:"center",color:"#141414ff",fontSize:"13px",fontWeight:500,fontStyle:"italic",marginBottom:"8px",paddingLeft:"4px"}},{children:[e.jsx(c.Loader2Icon,{size:16,style:{marginRight:8,animation:"spin 1s linear infinite"}},"loader"),"Checking the correctness of your Rule Setup..."]})),e.jsx(r.TextSection,i.__assign({id:"rule-title",title:j.ruleTitle||"Rule Title",rows:1,placeholder:"Enter a short, descriptive title for the learning",required:!0,value:q&&null!==F?F:A.ruleTitle,onChange:function(i){return q?k(i):I.setRuleTitle(i)},readOnly:(null==j?void 0:j.isAiStreaming)||!q,isOpen:w.ruleTitle,onToggle:function(){return ti("ruleTitle")},isHighlighted:E.ruleTitle||!1,showCognitiveIcon:A.citation.ruleTitle,tooltipDescription:"Why this Title?",errorMessage:null===(h=j.validationErrors)||void 0===h?void 0:h.ruleTitle},j)),A.citation.ruleTitle&&e.jsx("div",i.__assign({style:li},{children:e.jsx(t.InputDataReasoningCard,{isVisible:w.ruleTitle,citation:A.citation.ruleTitle,citations:oi("ruleTitle"),fieldName:"Rule Title",fieldValue:A.ruleTitle})})),e.jsx(a.ScopeSection,i.__assign({id:"scope",title:"",required:!1,scopeData:q&&null!==P?P:A.scopeData,onScopeChange:function(e,n){q?z(function(t){var o;return i.__assign(i.__assign({},null!=t?t:A.scopeData),((o={})[e]=n,o))}):I.onScopeChange(e,n)},tierLabel:"Which tiers should this learning apply to?",stationLabel:"Which scope should this learning belong to?",highlights:E,isOpen:w.scopeData,onToggle:function(){return ti("scopeData")},showCognitiveIcon:A.citation.scopeData,cognitiveIcon:e.jsx(s.ButtonCognitiveIcon,{}),tooltipDescription:"Why this Scope?",errorMessage:(null===(x=j.validationErrors)||void 0===x?void 0:x.station)||(null===(y=j.validationErrors)||void 0===y?void 0:y.tiers),stationErrorMessage:null===(_=j.validationErrors)||void 0===_?void 0:_.station,tierErrorMessage:null===(m=j.validationErrors)||void 0===m?void 0:m.tiers,readOnly:(null==j?void 0:j.isAiStreaming)||!q},j)),A.citation.scopeData&&e.jsx("div",i.__assign({style:li},{children:e.jsx(t.InputDataReasoningCard,{isVisible:w.scopeData,citation:A.citation.scopeData,citations:oi("scopeData"),fieldName:"Scope",fieldValue:null===(T=null===(S=A.scopeData)||void 0===S?void 0:S.tiers)||void 0===T?void 0:T.join(", ")})})),q?e.jsxs("div",i.__assign({style:{display:"flex",flexDirection:"column",alignItems:"flex-start"}},{children:[e.jsxs("div",i.__assign({style:{display:"flex",justifyContent:"flex-start",alignItems:"center",gap:"16px"}},{children:[e.jsx("button",i.__assign({onClick:U,style:{background:"none",border:"none",color:"#6b7280",fontSize:"14px",fontWeight:"500",cursor:"pointer",padding:"0"}},{children:"Discard Changes"})),e.jsxs("button",i.__assign({onClick:Z,disabled:ii,style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",borderRadius:"12px",border:"none",backgroundColor:"#2563eb",color:"#ffffff",fontSize:"14px",fontWeight:"500",cursor:ii?"not-allowed":"pointer",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.05)",opacity:ii?.5:1}},{children:[e.jsx(c.Check,{size:18,strokeWidth:2.5,color:"#ffffff"}),"Save Changes"]}))]})),"rule-setup"===(null==j?void 0:j.pendingEditId)&&e.jsxs("div",i.__assign({style:{display:"flex",alignItems:"center",gap:"6px",marginTop:"8px"}},{children:[e.jsx(c.AlertTriangle,{style:{color:"#C2410C"}}),e.jsx("div",i.__assign({style:{display:"flex",color:"#C2410C",fontSize:"13px",paddingTop:"8px",alignItems:"center"}},{children:"Pending - Changes not applied yet. Apply or discard them to continue."}))]}))]})):null]}))}))})),null===(C=null===(D=null==j?void 0:j.tierOptions)||void 0===D?void 0:D.filter(function(i){var e,n;return null===(n=null===(e=A.scopeData)||void 0===e?void 0:e.tiers)||void 0===n?void 0:n.includes(i)}))||void 0===C?void 0:C.map(function(n,a,s){var c,u,v,g,f=n.toLowerCase().replace(/ /g,"_"),h=(null===(c=A.variantsByTier)||void 0===c?void 0:c[f])||[],x=h.length,y=!1;if(1===x){var _=h[0],m=!(null===(u=null==_?void 0:_.ruleDescription)||void 0===u?void 0:u.trim()),S=(null===(v=null==_?void 0:_.whenToApplyConditions)||void 0===v?void 0:v.some(function(i){return(null==i?void 0:i.text)&&""!==i.text.trim()}))||!1,T=(null===(g=null==_?void 0:_.whenNotToApplyConditions)||void 0===g?void 0:g.some(function(i){return(null==i?void 0:i.text)&&""!==i.text.trim()}))||!1;m&&!S&&!T&&(y=!0)}var D=y?void 0:"".concat(x," ").concat(1===x?"variant":"variants"," configured for this tier"),C=!((null==j?void 0:j.defaultTierOpen)>=0)||a===j.defaultTierOpen;return console.log("Rendering tier : ",n),e.jsx(d.default,i.__assign({variant:"tier-header",title:{type:"other",label:n},subtitle:D,defaultOpen:C,footerData:{description:"Variants for ".concat(n)}},{children:e.jsx(p,i.__assign({onAddVariant:function(){var i;return null===(i=I.addNewVariant)||void 0===i?void 0:i.call(I,f)},isDisabled:null==j?void 0:j.isAiStreaming,showAddVariantBtn:"Edit"!==(null==j?void 0:j.usedFor)},{children:h.map(function(n,a){var s,c,u,v,p,g,h,x,y,_,m,S=n.variantType||"default",T="".concat(f,"-variant-").concat(a),D=!0===n.is_variant,C="default"===S||"default_variant"===S;(null==j?void 0:j.defaultVariantOpen)>=0&&j.defaultVariantOpen;var E="".concat(f,"_").concat(a),O=b.get(E)||{},R=(null===(c=null===(s=j.separationItemsByTier)||void 0===s?void 0:s[f])||void 0===c?void 0:c.get(a))||[],V=(null===(v=null===(u=j.togglesByTier)||void 0===u?void 0:u[f])||void 0===v?void 0:v.get(a))||[];(null==j?void 0:j.autoScrollVariantIndex)===a||n.is_variant,console.log("Rendering ".concat(f," variant ").concat(a,":"),n),console.log("Rendering Variant : ",n),console.log("Open Accordion ID:",N,"Current Variant ID:",T);var q=null===(p=null==j?void 0:j.activeEditId)||void 0===p?void 0:p.startsWith("condition-wta-".concat(f,"-").concat(a)),B=null===(g=null==j?void 0:j.activeEditId)||void 0===g?void 0:g.startsWith("condition-wnta-".concat(f,"-").concat(a));return e.jsx("div",i.__assign({ref:function(i){i?M.current.set(T,i):M.current.delete(T)},style:{width:"100%"}},{children:e.jsx(d.default,i.__assign({title:{type:C?"default":"variant",label:ai(S),number:a+1,isNewVariant:D,isDefault:n.isDefault,isModified:n.isModified},defaultOpen:!0,expanded:N===T,onToggle:function(){var i,e=N===T;console.log("is closing:",e),W(e?null:T),null===(i=null==j?void 0:j.setActiveVariantAccordionIndex)||void 0===i||i.call(j,e?null:a)},variant:"rule-behavior",footerData:{ruleTitle:S,description:n.ruleDescription||""}},{children:e.jsxs("div",i.__assign({style:{display:"flex",flexDirection:"column",gap:"12px"}},{children:[e.jsx(r.TextSection,i.__assign({id:"rule-description-".concat(f,"-").concat(a),title:j.ruleDescriptionTitle||"Rule Description",rows:2,placeholder:"Explain the learning behaviour",required:!0,readOnly:n.isReadOnly||(null==j?void 0:j.isAiStreaming)||ri&&(null==j?void 0:j.activeEditId)!=="rule-description-".concat(f,"-").concat(a),value:n.ruleDescription||"",onChange:function(i){return I.setRuleDescription(f,a,i)},isOpen:w["ruleDescription-".concat(f)],onToggle:function(){return ti("ruleDescription-".concat(f))},isHighlighted:O.ruleDescription||!1,showCognitiveIcon:null===(h=A.citation)||void 0===h?void 0:h["ruleDescription_".concat(f)],tooltipDescription:"Why this Description?",errorMessage:null===(x=j.validationErrors)||void 0===x?void 0:x["ruleDescription-".concat(f,"-").concat(a)],enableInlineEdit:!0,setSendMessageInChat:null==j?void 0:j.setSendMessageInChat,isAiStreaming:null==j?void 0:j.isAiStreaming,fieldName:"Rule Description"},j)),(null===(y=A.citation)||void 0===y?void 0:y["ruleDescription_".concat(f)])&&e.jsx("div",i.__assign({style:li},{children:e.jsx(t.InputDataReasoningCard,{isVisible:w["ruleDescription-".concat(f)],citation:A.citation["ruleDescription_".concat(f)],citations:oi("ruleDescription_".concat(f,"_").concat(a)),fieldName:"Rule Description",fieldValue:n.ruleDescription})})),e.jsx(o.ConditionSection,i.__assign({id:"when-to-apply-".concat(f,"-").concat(a),idPrefix:"condition-wta",title:j.whenToApplyTitle||"When to apply",required:!0,dividerRequired:!0,readOnly:n.isReadOnly||(null==j?void 0:j.isAiStreaming)||ri&&!q,conditions:n.whenToApplyConditions||[],onAdd:function(){return I.addWhenToApply(f,a)},onRemove:function(i,e,n){return I.removeWhenToApply(i,e,n)},onEdit:function(i,e,n,t){return I.editWhenToApply(i,e,n,t)},index:a,tierKey:f,isHighlighted:O.wta||!1,highlightedIds:null==j?void 0:j.highlightedIds,tooltipDescription:"Why this Condition?",citations:oi("whenToApply_".concat(f,"_").concat(a)),bordered:!0,addLabel:"Add When to apply",isAiStreaming:j.isAiStreaming,errorMessage:(null===(_=j.validationErrors)||void 0===_?void 0:_["whenToApply-".concat(f,"-").concat(a)])||(null==j?void 0:j.conflictReason)},j)),e.jsx(o.ConditionSection,i.__assign({id:"when-not-to-apply-".concat(f,"-").concat(a),idPrefix:"condition-wnta",title:j.whenNotToApplyTitle||"When NOT to apply",required:!1,dividerRequired:!0,readOnly:n.isReadOnly||(null==j?void 0:j.isAiStreaming)||ri&&!B,conditions:n.whenNotToApplyConditions||[],onAdd:function(){return I.addWhenNotToApply(f,a)},onRemove:function(i,e,n){return I.removeWhenNotToApply(i,e,n)},onEdit:function(i,e,n,t){return I.editWhenNotToApply(i,e,n,t)},index:a,tierKey:f,isHighlighted:O.wnta||!1,highlightedIds:null==j?void 0:j.highlightedIds,tooltipDescription:"Why this Condition?",citations:oi("whenNotToApply_".concat(f,"_").concat(a)),bordered:!0,addLabel:"Add When NOT to apply",isAiStreaming:j.isAiStreaming},j)),e.jsx(l.ConfigSection,i.__assign({id:"config-".concat(f,"-").concat(a),title:j.configTitle||"Configuration",required:!1,highlights:O,bordered:!0,readOnly:n.isReadOnly||(null==j?void 0:j.isAiStreaming)||ri&&(null==j?void 0:j.activeEditId)!=="config-".concat(f,"-").concat(a),onConfigChange:function(i,e){return I.onConfigChange(f,a,i,e)},separationItems:R,toggles:V,index:a},j)),(null===(m=n.reasoning)||void 0===m?void 0:m.configData)&&e.jsx("div",i.__assign({style:li},{children:e.jsx(t.InputDataReasoningCard,{citation:n.reasoning.configData,citations:oi("configData_".concat(f,"_").concat(a)),fieldName:"Configuration",fieldValue:"Proposed Configuration"})}))]}))}),T)}),"".concat(f,"-variant-").concat(a))})}))}),"tier-".concat(a))})]}))};
|
|
2
2
|
//# sourceMappingURL=CreateRule.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"tslib";import{jsxs as i,jsx as
|
|
1
|
+
import{__assign as e}from"tslib";import{jsxs as i,jsx as o,Fragment as r}from"react/jsx-runtime";import{useState as t,useEffect as n}from"react";import{ChevronUp as d,ChevronDown as l}from"lucide-react";import a from"./TooltipComponent.js";var p=function(p){var s,c,f=p.title,x=p.subtitle,g=p.children,h=p.defaultOpen,u=void 0===h||h,v=p.footerData,y=p.readOnly,b=void 0!==y&&y,m=p.variant,F=void 0===m?"default":m,w=p.expanded,C=p.onToggle,D=p.actionButtons,E=p.isAiStreaming,S=p.editFlow,z=void 0!==S&&S,k=t(u),I=k[0],B=k[1];n(function(){B(u)},[u]);var R=void 0!==w,T=R?w:I,A=function(){R?null==C||C():B(!T)},W="variant"===f.type,j="other"===f.type,L="tier-header"===F,N="rule-behavior"===F,O={padding:"12px 14px 0px 14px",display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",borderRadius:L?"0px":"8px",borderBottom:L?"1px solid #E2E8F0":"none"},V={alignItems:"center",gap:"8px",margin:0,fontSize:"12px",fontWeight:600,padding:j?"":"6px 10px",borderRadius:"4px",color:b?"#717b8c":L&&T?"#2563EB":"#19213D",backgroundColor:N&&!f.isNewVariant?"#F7F8FA":W?"#FDF2F8":f.isDefault?"#F7F8FA":"transparent",border:W?"1px solid #FCE7F3":f.isDefault?"1px solid #F0F2F5":"none"},M={fontSize:"12px",fontWeight:400,color:"#666F8D",paddingLeft:j?"0px":"10px"},P={badge:{display:"inline-flex",alignItems:"center",gap:"8px",backgroundColor:"#f0fdf4",color:"#367c46",padding:"6px 10px",borderRadius:"8px",border:"1px solid #e1f6e8",fontSize:"12px",fontWeight:"600",lineHeight:"1.2",width:"fit-content"},defaultTag:{backgroundColor:"#f0f4f8",color:"#475569",fontSize:"11px",fontWeight:"600",padding:"2px 8px",borderRadius:"4px",textTransform:"uppercase",border:"1px solid #cbd5e1"},modifiedTag:{boxSizing:"border-box",display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",padding:"2px 8px",backgroundColor:"#FFFAE3",border:"1px solid #FDEDAA",borderRadius:"4px",color:"#854D0E",fontSize:"11px",fontWeight:"700",letterSpacing:"0.5px"}};return i("div",e({style:{width:"100%",backgroundColor:"#ffffff",overflow:"hidden",border:L?"none":N&&T?"1px solid #2563EB":"1px solid #E2E8F0",borderRadius:"8px",marginBottom:"0px"}},{children:[i("div",e({onClick:A,style:O},{children:[i("div",e({style:{display:"flex",flexDirection:"column",gap:"4px",margin:0,fontSize:"12px",fontWeight:600,borderRadius:"4px"}},{children:[!f.isNewVariant&&i("div",e({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[o("div",e({style:V},{children:f.label})),f.isDefault&&o("span",e({style:P.defaultTag},{children:"Default"})),f.isModified&&o("span",e({style:P.modifiedTag},{children:"MODIFIED"}))]})),o("div",{children:f.isNewVariant&&i("div",e({style:P.badge},{children:[o("svg",e({width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor"},{children:o("path",{d:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"})})),o("div",{children:"New Variant"})]}))}),x&&o("div",e({style:M},{children:x}))]})),i("div",e({style:{display:"flex",alignItems:"center",gap:"12px",paddingRight:"4px"}},{children:[D&&!E&&(z?o(a,e({description:"Coming Soon"},{children:o("div",e({onClick:function(e){return e.stopPropagation()},style:{cursor:"not-allowed",opacity:.6}},{children:o("div",e({style:{pointerEvents:"none"}},{children:D(T,function(){})}))}))})):o("div",e({onClick:function(e){return e.stopPropagation()}},{children:D(T,A)}))),o("div",e({onClick:A,style:{cursor:"pointer",display:"flex",alignItems:"center"}},{children:T?o(d,{size:18,color:L?"#2563EB":"#64748B"}):o(l,{size:18,color:"#64748B"})}))]}))]})),!T&&v&&o("div",e({style:{fontSize:"12px",color:"#475569",fontWeight:400,padding:"0 16px 12px 16px",display:"flex",alignItems:"center",gap:"8px"}},{children:j?i(r,{children:[o("span",e({style:{fontWeight:500,color:"#475569"}},{children:v.ruleTitle||"No Title"})),(null!==(c=null===(s=v.tiers)||void 0===s?void 0:s.length)&&void 0!==c?c:0)>0&&i(r,{children:[o("div",{style:{width:"4px",height:"4px",backgroundColor:"#676970",borderRadius:"50%"}}),o("span",{children:Array.isArray(v.tiers)?v.tiers.join(", "):v.tiers})]})]}):o("span",e({style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},{children:v.description}))})),T&&o("div",e({style:{padding:"12px"}},{children:g}))]}))};export{p as default};
|
|
2
2
|
//# sourceMappingURL=AccordianSection.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__makeTemplateObject as e,__spreadArray as n,__assign as t,__awaiter as i,__generator as o,__rest as a}from"tslib";import{jsx as r,jsxs as s,Fragment as l}from"react/jsx-runtime";import{useRef as d,useState as c,useMemo as u,useEffect as v,useCallback as m,useLayoutEffect as h}from"react";import{keyframes as p}from"@mui/material";import g from"@mui/material/Tooltip";import f from"react-markdown";import C from"rehype-raw";import y from"axios";import{v4 as b}from"uuid";import{startChatStreamSSE as w}from"@e-llm-studio/streaming-response";import{WatchMeWork as S}from"@e-llm-studio/watch-me-work";import x from"./ChatHeader.js";import k from"../MessageRendering/MessageRendering.js";import{Skeleton as _}from"../atoms/SkeletonLoader/SkeletonLoader.js";import{ActionableButton as E}from"../MessageRendering/ClickableChatComponents.js";import T from"../AudioWaveform.js";import M from"./ChatComponent.module.css.js";import I from"../../InstantLearning.module.css.js";import{ScrollToBottom as N}from"../_svg/ScrollToBottom.js";import{useHeaderObserver as D,extractTextFromChildren as R}from"../../helpers/utils.js";import{SendButton as L}from"../_svg/SendButton.js";import A from"../_svg/SparkleIcon.js";import{UserIcon as F}from"../_svg/UserIcon.js";var W,q=function(e,n){return y.post("".concat(e||"https://devllmstudio.creativeworkspace.ai","/api/chat/chatResponse"),{name:"ilggcautopromptgen",organizationName:"techolution",prompt:n||"Generate a query"},{headers:{"Content-Type":"application/json"},withCredentials:!0}).then(function(e){return e.data}).catch(function(e){throw console.error("Error calling auto-generate API:",e),e})},P=function(q){var P=q.chatAssistantName,j=q.organizationName,z=q.baseUrl;q.baseWebsocketUrl;var B=q.setIsNewChatClicked;q.ThinkingBulbIconComponent;var H=q.isFormSaveClicked,G=q.setIsFormSavedClicked,Z=q.onResetLearningData,U=q.sendMessageInChat,K=q.setSendMessageInChat,V=q.isFormValidating,O=q.chatTitle,Q=q.customMetaData,J=q.headerMessageHandlers;q.aiResponse;var $=q.setAIResponse,X=q.onResetChat,Y=q.initialChatMessage,ee=void 0===Y?"":Y,ne=q.onSave,te=q.chatSize,ie=q.setChatSize,oe=q.movingTowards,ae=q.setCitations,re=q.textareaPlaceholder,se=void 0===re?"Tell me more about this learning...":re,le=q.setCurrentRequestId,de=q.showSavedMessage,ce=void 0!==de&&de,ue=q.savedMessage,ve=q.isError,me=void 0!==ve&&ve,he=q.errorMessage,pe=void 0===he?"There was an error saving your changes.":he;q.isSaving;var ge=q.isHighlighted,fe=void 0!==ge&&ge,Ce=q.onStreamingStateChange,ye=q.onViewComparison;q.isCopyEnabled;var be=q.onComparisonLinkClick,we=q.onSubmitFeedback,Se=q.userDetails,xe=q.isGlobalEditActive,ke=P,_e=d("".concat(ke,"-").concat(j,"-").concat(b())),Ee=d("".concat(b())),Te=z,Me=d(null),Ie=d(!0),Ne=d(null),De=d(null),Re=c(""),Le=Re[0],Ae=Re[1],Fe=c([]),We=Fe[0],qe=Fe[1],Pe=c(!1),je=Pe[0],ze=Pe[1],Be=c(!1);Be[0];var He=Be[1],Ge=c(!0),Ze=Ge[0],Ue=Ge[1],Ke=c(!0);Ke[0];var Ve=Ke[1],Oe=c("");Oe[0];var Qe=Oe[1],Je=c(""),$e=Je[0],Xe=Je[1],Ye=c(!1),en=Ye[0],nn=Ye[1],tn=c(!1),on=tn[0],an=tn[1],rn=c(!0),sn=rn[0],ln=rn[1],dn=c("100%");dn[0];var cn=dn[1],un=c(null),vn=un[0],mn=un[1],hn=c(!1);hn[0];var pn=hn[1],gn=c(!1),fn=gn[0],Cn=gn[1],yn=d(null),bn=d(new Set),wn=c(null),Sn=wn[0],xn=wn[1],kn=c(!1),_n=kn[0],En=kn[1],Tn=c(!1);Tn[0],Tn[1];var Mn=c(null);Mn[0],Mn[1],d(null),d(null);var In=d(new Map),Nn=d(""),Dn=d(new Map);p(W||(W=e(["\n 0%, 80%, 100% {\n transform: scale(0);\n }\n 40% {\n transform: scale(1.0);\n }\n "],["\n 0%, 80%, 100% {\n transform: scale(0);\n }\n 40% {\n transform: scale(1.0);\n }\n "])));var Rn=u(function(){return""===(null==Le?void 0:Le.trim())||en},[Le,en]),Ln=u(function(){return V},[V]),An=u(function(){return Rn||en||V||!!xe},[Rn,en,V,xe]);v(function(){null==Ce||Ce(en)},[en,Ce]),v(function(){var e=Me.current,n=function(){if(e){var n=e.scrollTop,t=e.scrollHeight,i=e.clientHeight;ln(t-n-i<=20)}};return e&&(e.addEventListener("scroll",n),n()),function(){e&&e.removeEventListener("scroll",n)}},[We]);var Fn=D({handlers:J,setResult:$}).processHeaderMessage;v(function(){ce&&Cn(!0)},[ce]),v(function(){if(_n){var e=setTimeout(function(){En(!1)},3e3);return function(){return clearTimeout(e)}}},[_n]),v(function(){H&&!xe&&(Bn(new KeyboardEvent("keydown",{key:"Enter"}),!1,"Save this Learning"),G(!1))},[H]),v(function(){if(U)try{if(U.startsWith("__SKELETON__:")){var e=U.split(":"),i=e[1],o=e.slice(2).join(":"),a={role:"user",content:"",id:i,time:new Date,isSkeleton:!0,skeletonContent:o};return qe(function(e){return n(n([],e,!0),[a],!1)}),Bn(new KeyboardEvent("keydown",{key:"Enter"}),!1,o,!1,i),xn(i),K&&K(""),void setTimeout(function(){xn(null)},2e3)}if(U.startsWith("__SKELETON_END__::")){var r=U.split("::")[1]||"";return qe(function(e){return e.map(function(e){return e.isSkeleton?t(t({},e),{isSkeleton:!1,content:e.skeletonContent||r}):e})}),void(K&&K(""))}var s=b();Bn(new KeyboardEvent("keydown",{key:"Enter"}),!1,U,!1,s),xn(s),K&&K(""),setTimeout(function(){return xn(null)},2e3)}catch(e){console.error("Error handling sendMessageInChat signal",e)}},[U]),v(function(){qn(),Pn();var e=function(){var e,n=(null===(e=null==yn?void 0:yn.current)||void 0===e?void 0:e.clientHeight)||0,t="calc(100% - ".concat(n,"px - 10px)");cn(t)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var Wn=m(function(e){var n="string"==typeof e?e:"smooth";Ne.current&&Ne.current.scrollIntoView({behavior:n,block:"end"}),Ie.current&&setTimeout(function(){Ne.current&&Ie.current&&Ne.current.scrollIntoView({behavior:n,block:"end"})},100)},[]);v(function(){if(!en){var e="";if(fn?e=ue||"Thank you teacher for teaching me, your rule has been saved successfully.":me&&(e=pe||"I'm sorry, I couldn't save your changes. Please try again."),e){var t={role:"assistant",content:e,id:b(),citations:[],time:new Date};qe(function(e){return n(n([],e,!0),[t],!1)}),Cn(!1),setTimeout(function(){return Wn("smooth")},100)}}},[fn,me,en,ue,pe,Wn]),v(function(){Ie.current&&Wn("smooth")},[Wn]);var qn=function(){var e={method:"get",maxBodyLength:1/0,url:"".concat(Te,"/api/chatbot/getChatSettings?name=").concat(ke,"&organizationName=").concat(j),headers:{}};y.request(e).then(function(e){var n,t,i;(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.chatSettings)&&""!==(null===(i=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.chatSettings)||void 0===i?void 0:i.chatInitialMessage)&&Ve(!0)}).catch(function(e){console.error(e)})},Pn=function(){return i(void 0,void 0,void 0,function(){var e,n;return o(this,function(t){e="".concat(Te,"/api/chat/history?name=").concat(ke,"&organizationName=").concat(j);try{n={method:"GET",params:{guestSessionId:_e.current},withCredentials:!0},y.get(e,n).then(function(e){var n=e.data;n.length>0?(qe(n),Wn()):Ve(!0)}).catch(function(e){console.error(e)})}catch(e){ze(!1),console.error(e)}return[2]})})};function jn(e){return null==e?void 0:e.replace(/<a [^>]*>.*?<\/a>/g,function(e){return null==e?void 0:e.replace(/\*/g,"*")})}var zn=function(e,i,o,a,r,s,l){var d,c,u,v,m,h,p,g,f,C,y,w,S,x,k,_,E,T,M,I,N,D,R,L,A,F,W,q,P,j;if(null===(c=null===(d=null==e?void 0:e.chatStream)||void 0===d?void 0:d.continueChatResult)||void 0===c?void 0:c.header_message){var z={header_message:e.chatStream.continueChatResult.header_message,responsedata:null===(m=null===(v=null===(u=null==e?void 0:e.chatStream)||void 0===u?void 0:u.continueChatResult)||void 0===v?void 0:v.message)||void 0===m?void 0:m.content};Fn(z)}var B=null===(h=null==e?void 0:e.chatStream)||void 0===h?void 0:h.continueChatResult,H=null==B?void 0:B.isEnd,G=(null===(p=null==B?void 0:B.message)||void 0===p?void 0:p.citations)||[];H&&G.length>0&&ae&&ae(G);var Z={role:"assistant",content:"",id:b()};if(null===(y=null===(C=null===(f=null===(g=null==e?void 0:e.chatStream)||void 0===g?void 0:g.continueChatResult)||void 0===f?void 0:f.message)||void 0===C?void 0:C.content)||void 0===y?void 0:y.includes("WaitMessage: "))He(!0),Z.content=function(e){var n="WaitMessage: ",t=e.indexOf(n);if(-1!==t){var i=e.substring(t+13);return null==i?void 0:i.replaceAll("WaitMessage: ","")}return""}((null===(x=null===(S=null===(w=null==e?void 0:e.chatStream)||void 0===w?void 0:w.continueChatResult)||void 0===S?void 0:S.message)||void 0===x?void 0:x.content)+"\n\n"),""!==Z.content&&(ze(!1),qe(n(n([],We,!0),[{role:"user",content:r,time:a,isFirstQuestionSent:s||!1,id:l||(null===(_=null===(k=null==e?void 0:e.chatStream)||void 0===k?void 0:k.continueChatResult)||void 0===_?void 0:_.requestId)||"",reply:""},Z],!1)));else{He(!1);var U=null===(T=null===(E=null==e?void 0:e.chatStream)||void 0===E?void 0:E.continueChatResult)||void 0===T?void 0:T.requestId;"string"==typeof U&&U&&le&&le(U);var K=function(e,i,o,a){var r,s,l,d,c,u,v,m={role:"assistant",content:"",id:b(),time:new Date,citations:[]},h=(null===(r=null==e?void 0:e.chatStream)||void 0===r?void 0:r.continueChatResult)||{},p=null==h?void 0:h.requestId,g=null==h?void 0:h.preserve_message,f=null==h?void 0:h.isEnd,C=(null===(s=null==h?void 0:h.message)||void 0===s?void 0:s.content)||"",y=null==h?void 0:h.is_orchestrator,w=null==h?void 0:h.thinking_break,S=(null===(l=null==h?void 0:h.message)||void 0===l?void 0:l.citations)||[];if(p&&g&&C&&!f){var x=a.current.get(p)||[];x[x.length-1]!==C&&(x.push(C),a.current.set(p,x))}var k=(p&&a.current.get(p)||[]).join("\n\n"),_="";if(f)_=k&&""!==k.trim()?k:C;else if(g)_=k;else{var E=C.replace(/<!--(?![\s\S]*-->)[\s\S]*$/,"").trimEnd(),T=!1===y||w||0!==S.length?"":E;_=k?"".concat(k,"\n\n").concat(T):T}if(m.content=jn(_),!0===(null==h?void 0:h.thinking_break)&&!0===(null==h?void 0:h.is_orchestrator)&&!1===(null==h?void 0:h.isEnd)&&i.push({responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!1}),!1===(null==h?void 0:h.thinking_break)&&!1===(null==h?void 0:h.is_orchestrator)&&!1===(null==h?void 0:h.isEnd)){if(h.explainability_id&&h.responded_by){var M=h.explainability_id,I=h.responded_by;o.has(M)||o.set(M,{responded_by:I,index:i.length})}o.has(h.explainability_id)?i[null==(N=o.get(h.explainability_id))?void 0:N.index]={responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!0,explainability_id:null!==(d=h.explainability_id)&&void 0!==d?d:"",isParallelToolResponse:!0}:i=n(n([],i,!0),[{responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!0,explainability_id:null!==(c=h.explainability_id)&&void 0!==c?c:"",isParallelToolResponse:!1}],!1)}if(!0===(null==h?void 0:h.thinking_break)&&!1===(null==h?void 0:h.is_orchestrator)&&!1===(null==h?void 0:h.isEnd)){var N;h.explainability_id&&h.responded_by&&(M=h.explainability_id,I=h.responded_by,o.has(M)||o.set(M,{responded_by:I,index:i.length})),o.has(h.explainability_id)?i[null==(N=o.get(h.explainability_id))?void 0:N.index]={responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!1,explainability_id:null!==(u=h.explainability_id)&&void 0!==u?u:"",isParallelToolResponse:!0}:i.push({responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!1,explainability_id:null!==(v=h.explainability_id)&&void 0!==v?v:"",isParallelToolResponse:!1})}return t({orchestratorAndAgentsMessages:i},m)}(e,o,i,Dn);K.time=new Date,K.citations=G,K.isEnd=null===(I=null===(M=null==e?void 0:e.chatStream)||void 0===M?void 0:M.continueChatResult)||void 0===I?void 0:I.isEnd,K.requestId=null===(D=null===(N=null==e?void 0:e.chatStream)||void 0===N?void 0:N.continueChatResult)||void 0===D?void 0:D.requestId,K.sessionId=_e.current,null===(R=K.orchestratorAndAgentsMessages)||void 0===R||R.forEach(function(e){e&&e.header_message&&Fn(e)}),(""!==(null==K?void 0:K.content)||(null==K?void 0:K.orchestratorAndAgentsMessages)&&(null==K?void 0:K.orchestratorAndAgentsMessages.length)>0)&&(ze(!1),qe(n(n([],We,!0),[{role:"user",content:r||"",time:a,isFirstQuestionSent:s||!1,id:l||(null===(A=null===(L=null==e?void 0:e.chatStream)||void 0===L?void 0:L.continueChatResult)||void 0===A?void 0:A.requestId)||"",requestId:null!==(q=null===(W=null===(F=null==e?void 0:e.chatStream)||void 0===F?void 0:F.continueChatResult)||void 0===W?void 0:W.requestId)&&void 0!==q?q:""},K],!1))),Ue(null===(j=null===(P=null==e?void 0:e.chatStream)||void 0===P?void 0:P.continueChatResult)||void 0===j?void 0:j.isEnd)}},Bn=function(e,i,o,a,r,s){var l,d,c,u,v,m=(void 0!==o?o:Le||"").trim(),h="Enter"===(null==e?void 0:e.key)&&!(null==e?void 0:e.shiftKey)&&!xe;if(h&&(null===(l=null==e?void 0:e.preventDefault)||void 0===l||l.call(e)),!(!m||en&&!o||(null==e?void 0:e.key)&&!h)){if("I want to add a rule description"===m){Ue(!1),Ie.current=!0,nn(!0),!vn&&m&&mn(o||"manual_entry");var p=new Date;return qe(function(e){return n(n([],e.map(function(e,n){var i;return t(t({},e),{content:null===(i=jn(e.content))||void 0===i?void 0:i.replace("WaitMessage: ","")})}),!0),[{role:"user",content:m,time:p,isFirstQuestionSent:!1,id:r||b()}],!1)}),Wn("smooth"),void setTimeout(function(){qe(function(e){return n(n([],e,!0),[{role:"assistant",content:"I'd be happy to help you set up a new rule! To get started, could you tell me what kind of behavior or logic you would like this rule to follow?",id:b(),citations:[],time:new Date}],!1)}),Wn("smooth"),setTimeout(function(){nn(!1),Ue(!0)},500)},500)}Ue(!1),Ie.current=!0,nn(!0),!vn&&m&&mn(o||"manual_entry");var g=new Date;qe(function(e){var i=e.map(function(e){var n;return t(t({},e),{content:null===(n=jn(e.content))||void 0===n?void 0:n.replace("WaitMessage: ","")})});return r&&i.some(function(e){return e.id===r})?i.map(function(e){return e.id===r?t(t({},e),{content:m}):e}):n(n([],i,!0),[{role:"user",content:m,time:g,isFirstQuestionSent:!1,id:r||b()}],!1)}),Wn("smooth");var f=new Map,C=[],y={API_URL:z,organizationName:j,chatAssistantName:ke,selectedAIModel:"gpt-4",replyMessage:"",userName:null!==(d=null==Se?void 0:Se.name)&&void 0!==d?d:"Guest User",userEmailId:null!==(c=null==Se?void 0:Se.email)&&void 0!==c?c:"guestUser@example.com",userId:null!==(u=null==Se?void 0:Se.id)&&void 0!==u?u:"Guest User",query:m,requestId:"requestId-".concat(b()),customPrompt:"",enableForBackend:!1,guestSessionId:_e.current,chatPreviewId:Ee.current,customMetaData:Q,aiModel:"",onStreamEvent:function(e){return zn(e,f,C,g,m,i,r)},onStreamEnd:function(e){Ue(!0),nn(!1),pn(!1);var i=Date.now(),o=In.current.get(Nn.current);if(o){var a=Math.round((i-o)/1e3).toFixed(1);qe(function(e){var i=n([],e,!0).reverse().findIndex(function(e){return"assistant"===e.role});if(-1===i)return e;var o=e.length-1-i;return e.map(function(e,n){return n===o?t(t({},e),{finalTimeTaken:a}):e})})}},onError:function(e){console.error("Stream error:",e),Ue(!0),nn(!1),pn(!1)}};if(m)ze(!0),null===(v=De.current)||void 0===v||v.blur(),Ae(""),Wn(),Xe(r?"Just a moment, processing your request...":"Okay, got it. Let me take a moment to work on this and I'll get back to you shortly."),In.current.set(y.requestId,Date.now()),Nn.current=y.requestId,w(y);s&&s(!1)}},Hn=d(null);h(function(){Hn.current=Bn});var Gn=m(function(){for(var e,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return null===(e=Hn.current)||void 0===e?void 0:e.call.apply(e,n([Hn],t,!1))},[]),Zn=u(function(){return{p:function(e){e.node;var n=e.children;return a(e,["node","children"]),r("div",t({style:{margin:0,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"10px",fontFamily:"inherit"}},{children:n}))},button:function(e){e.node;var n=e.className,i=e.children,o=a(e,["node","className","children"]),l=R(i),d=o["data-value"],c="Tester Genie"===l;return r(E,t({},o,{className:n,handleStream:Gn,isStreamEnd:Ze,disabled:!!vn||!!xe,isLastMessage:!0,style:{margin:0},isTesterGenie:c,"data-selected":vn===l||vn===d?"true":vn?"false":void 0},{children:s("span",t({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[i,c&&s("svg",t({width:"16",height:"20",viewBox:"0 0 16 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[r("path",{d:"M7.20368 8.94768e-06C7.48895 -0.00208639 7.69331 0.364327 7.83856 0.57465C8.14381 1.01633 8.38012 1.87909 7.71077 2.14118C8.57167 2.21011 9.70406 2.93098 10.1785 3.64699C10.5932 4.27286 10.4559 5.16037 9.80301 5.56007L9.9502 7.16593C9.97671 7.44871 10.0265 7.87092 10.0299 8.14457C10.4213 8.23046 11.0787 8.55391 11.326 8.87592C11.5979 8.75656 11.9189 8.76963 12.1688 8.93469C12.3563 8.67751 12.5598 8.41456 12.7507 8.15787C12.3283 7.45155 12.5047 6.57745 13.2143 6.13784C13.5375 5.9377 13.9264 5.87277 14.2971 5.95705C14.0961 6.30964 13.8775 6.72182 13.6593 7.05857C13.7906 7.2436 13.9184 7.44225 14.044 7.63194L14.8022 7.63198C15.0349 7.30106 15.2515 6.90827 15.4835 6.59349C15.8623 7.0712 15.8156 7.79671 15.4734 8.28241C15.1318 8.76741 14.4886 8.9899 13.9118 8.88251C13.758 9.12108 13.5577 9.39243 13.3941 9.63201C13.7143 9.9316 13.7725 10.364 13.4067 10.6594C13.5231 10.8889 13.5309 11.1613 13.447 11.402C13.1502 12.2523 12.1724 12.5645 11.3474 12.5025C11.1171 12.4852 10.939 12.4698 10.7197 12.3953C10.8724 13.1271 10.7744 14.2031 10.5132 14.9051C10.1688 15.8304 9.43632 16.5569 8.54503 16.9655C7.90465 17.2706 7.21222 17.3607 6.50472 17.4505C5.74445 17.5471 4.75801 17.4362 4.08533 17.825C3.9327 17.9132 3.86566 18.0173 3.82943 18.1792C3.94996 18.5982 4.47858 18.6063 4.78474 18.8897C5.20191 19.2758 4.90716 19.9663 4.36611 19.9908C4.31476 19.9931 4.26867 19.9867 4.23186 19.9493C4.23089 19.8303 4.47587 19.7199 4.49787 19.5262C4.55075 19.0604 3.70014 19.0078 3.37835 18.8374C3.13013 18.706 2.99537 18.6309 2.82242 18.4021C2.63795 18.1579 2.58428 17.835 2.63138 17.5392C2.74868 16.7847 3.47123 16.393 4.12184 16.1497C4.61314 15.9659 5.46304 15.7158 5.52019 15.0793C5.58589 14.348 4.97543 13.5523 4.57739 12.9807C4.44275 12.7875 4.3039 12.579 4.16309 12.3919C4.18987 12.365 4.21049 12.3463 4.23916 12.3212C4.59619 12.6218 5.21209 12.6421 5.55038 12.2979C5.70457 12.144 5.78974 11.9342 5.78642 11.7164C5.78121 11.4493 5.63382 11.2002 5.4454 11.019C5.44704 10.9932 5.44824 10.9676 5.449 10.9419C5.4566 10.6648 5.37505 10.4902 5.1892 10.2943C5.18398 10.2538 5.17776 10.2134 5.17053 10.1732C5.08123 9.69297 4.71708 9.34182 4.23415 9.27108C4.16418 9.26083 3.96108 9.26105 3.92071 9.23344C3.90485 9.1828 3.9059 9.20792 3.91904 9.15527C4.22103 8.90139 4.14407 8.78214 4.31107 8.4846C4.42301 8.28513 4.73047 8.15239 4.95452 8.10701C4.96167 7.51076 5.03684 6.88562 5.10036 6.29144C5.12451 6.0655 5.12531 5.75046 5.1511 5.55257C4.11108 4.86747 4.39091 3.75946 5.25465 3.06391C5.84978 2.58469 6.34496 2.31002 7.10143 2.14517C7.01589 2.10416 6.93842 2.04811 6.87269 1.97972C6.77021 1.87349 6.70248 1.73857 6.67853 1.59293C6.60568 1.12096 7.04104 0.914625 7.18759 0.526392C7.26428 0.323403 7.03925 0.146075 7.20368 8.94768e-06Z",fill:"#475569"}),r("path",{d:"M7.459 4.5C7.48797 4.50312 7.71949 4.61154 7.76205 4.63061C8.27062 4.85835 8.87051 5.09164 9.35658 5.3582C9.36602 6.03495 9.37016 6.56625 8.70573 6.91519C8.6633 6.80883 8.63019 6.72409 8.56332 6.63044C8.43786 6.45568 8.24656 6.33963 8.03354 6.30909C7.8434 6.28211 7.65146 6.3197 7.49586 6.43503C7.21897 6.21256 6.76265 6.28197 6.5229 6.52486C6.39308 6.65639 6.34815 6.75074 6.28902 6.92344C5.59702 6.5957 5.58761 6.04267 5.60583 5.35582C5.89882 5.23844 6.21318 5.0724 6.50153 4.941C6.82145 4.79522 7.14482 4.6574 7.459 4.5Z",fill:"#D1EDFD"}),r("path",{d:"M11.0756 10.6406C11.1037 10.6701 11.1324 10.7706 11.1535 10.8145C11.2818 11.0817 11.4922 11.1945 11.7498 11.2977C11.5607 11.63 11.4567 11.8797 11.1034 12.0466L11.0839 12.0517C10.9262 12.0927 10.7996 12.0968 10.651 12.0135C10.4755 11.915 10.3807 11.6614 10.4792 11.478C10.6388 11.1809 10.8877 10.9272 11.0756 10.6406Z",fill:"#D1EDFD"}),r("path",{d:"M11.6036 9.1377C11.6993 9.11763 11.8391 9.16378 11.9294 9.19593C11.6952 9.50644 11.4706 9.81614 11.2327 10.1261L11.1572 10.2255C10.7581 9.73539 11.0333 9.24481 11.6036 9.1377Z",fill:"#D1EDFD"}),r("path",{d:"M7.49681 0.882812C7.53691 0.925159 7.61244 1.08523 7.63598 1.14156C7.74243 1.39673 7.75769 1.76908 7.38596 1.77504C7.28236 1.75599 7.15628 1.68938 7.13517 1.5783C7.0843 1.3107 7.35609 1.09964 7.48737 0.897583L7.49681 0.882812Z",fill:"#D1EDFD"}),r("path",{d:"M1.68305 6.17249C1.71659 6.1673 1.8134 6.16478 1.84892 6.16432C2.34052 6.15616 2.81496 6.34495 3.16655 6.68866C3.50847 7.01806 3.70349 7.47119 3.70765 7.94596C3.70896 8.42345 3.54045 8.85284 3.20281 9.19025C3.34033 9.28068 3.5321 9.52219 3.6543 9.65748C4.17158 9.39073 4.91447 9.69339 4.79675 10.3444C5.08751 10.5485 5.19656 10.8288 5.0585 11.1674C5.15418 11.2375 5.25595 11.3205 5.32383 11.4186C5.40228 11.5303 5.4309 11.6695 5.40291 11.8031C5.32228 12.1857 4.90085 12.3286 4.57669 12.1236C4.51367 12.0838 4.42258 11.9595 4.35299 11.9431C4.30669 11.9557 4.28453 11.9584 4.23644 11.9644C4.22885 11.9742 4.22118 11.9841 4.21343 11.9938C3.93597 12.3413 3.49234 12.4682 3.06933 12.5157C2.85285 12.518 2.70432 12.5146 2.49066 12.4609C1.80785 12.2892 1.50808 11.6167 1.70723 10.9639C1.829 10.5648 2.11891 10.2506 2.48939 10.0518C2.54655 10.132 2.57559 10.2191 2.64066 10.303C2.73571 10.2223 2.82048 10.1482 2.92363 10.0773C2.81023 9.95313 2.66811 9.7693 2.55817 9.63584C2.38871 9.6878 2.23026 9.72879 2.05298 9.74653C1.54239 9.80228 1.03118 9.64711 0.637735 9.31695C0.269964 9.01018 0.0453493 8.54827 0.00544736 8.07322C-0.0309495 7.60988 0.116099 7.15077 0.414918 6.79478C0.742554 6.41198 1.18728 6.21393 1.68305 6.17249Z",fill:"#475569"}),r("path",{d:"M1.79616 6.5951C2.54894 6.5619 3.18687 7.14364 3.22301 7.8963C3.25915 8.64894 2.67989 9.28913 1.92739 9.3282C1.17073 9.3675 0.526231 8.78435 0.489885 8.02753C0.45354 7.27071 1.03921 6.62849 1.79616 6.5951Z",fill:"#D1EDFD"}),r("path",{d:"M4.93607 11.4844C5.12839 11.6261 5.22049 11.9085 4.91876 11.9419C4.8067 11.8805 4.78491 11.8646 4.71094 11.7561C4.81572 11.6752 4.862 11.5925 4.93607 11.4844Z",fill:"#FEFEFD"}),r("path",{d:"M12.5164 3.58594L12.5715 3.59466C12.6589 3.65863 12.6908 3.94434 12.7882 4.05193C12.8789 4.15216 12.9155 4.17816 13.0326 4.24929C13.1363 4.31224 13.3325 4.34025 13.384 4.43124C13.3643 4.56218 13.0693 4.54857 12.9127 4.69344C12.6903 4.89898 12.7114 5.06971 12.5892 5.28622C12.5669 5.28439 12.5368 5.2868 12.5261 5.27346C12.4336 5.15843 12.4072 4.9308 12.3099 4.81465C12.1627 4.63903 11.9972 4.60054 11.7981 4.51372C11.7544 4.49467 11.7266 4.47099 11.7129 4.42649C11.7867 4.31876 12.0509 4.34309 12.2376 4.14892C12.43 3.94901 12.4155 3.72208 12.5164 3.58594Z",fill:"#475569"}),r("path",{d:"M2.13644 3.72656C2.24401 3.77084 2.29712 4.1268 2.431 4.25226C2.60327 4.41371 2.7311 4.41949 2.93246 4.52449C2.96024 4.53897 2.97173 4.56042 2.97671 4.58878C2.89584 4.6981 2.61854 4.70721 2.4596 4.85659C2.26275 5.04156 2.27341 5.29132 2.17022 5.42088C2.16192 5.41849 2.11671 5.40232 2.1156 5.40043C2.01291 5.21216 1.9836 5.04909 1.84812 4.87273C1.73599 4.72675 1.36534 4.69959 1.32812 4.56939C1.3835 4.47941 1.67823 4.44211 1.82291 4.30563C2.02737 4.11274 2.0042 3.8372 2.13644 3.72656Z",fill:"#475569"})]}))]}))}))}}},[Gn,Ze,vn,xe]),Un=u(function(){return We.some(function(e){return e.isSkeleton})},[We]),Kn=function(e){return i(void 0,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return we?[4,we(e)]:[3,2];case 1:t.sent(),qe(function(e){return n(n([],e,!0),[{role:"assistant",content:"Thanks for your feedback — this will help improve future suggestions.",id:b(),citations:[],time:new Date,isEnd:!0}],!1)}),setTimeout(function(){return Wn("smooth")},100),t.label=2;case 2:return[2]}})})};return s("div",t({className:"".concat(I.customFont," ").concat(M.chatContainer),style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:fe&&!Un?"0 0 20px 5px rgba(37, 99, 235, 0.5)":"none"}},{children:[s("div",t({ref:Me,className:M.scrollWrapper},{children:[r("div",t({ref:yn,className:M.stickyHeader},{children:r(x,{resetChatHistory:function(){var e="".concat(Te,"/api/chat/resetHistory?name=").concat(ke,"&organizationName=").concat(j);try{var n={method:"GET",params:{guestSessionId:_e.current},withCredentials:!0};y.get(e,n).then(function(){B(!0),Qe(""),mn(null),bn.current.clear(),Dn.current.clear(),Ee.current="".concat(b()),qe([]),Ve(!0),null==X||X(),Z&&Z()}).catch(function(e){console.error(e)}).finally(function(){_e.current="".concat(ke,"-").concat(j,"-").concat(b())})}catch(e){ze(!1),console.error(e)}},isStreamEnd:Ze,chatTitle:O,onResize:ie,chatSize:te,movingTowards:oe})})),s("div",t({className:M.messagesList},{children:[s("div",t({className:M.initialMessageRow},{children:[r("div",t({className:M.iconWrapper},{children:r(A,{})})),r("div",t({className:M.welcomeTextWrapper},{children:r("div",t({className:M.welcomeMarkdownWrapper},{children:r("span",{children:r(f,t({rehypePlugins:[C],components:Zn},{children:ee}))})}))}))]})),We.length>0&&We.map(function(e,n){var i,o;return s("div",t({className:M.messageRow},{children:["assistant"===e.role?r("div",t({className:M.assistantIconContainer},{children:r(A,{})})):r("div",{className:M.userSpacer}),r("div",t({className:M.messageContent},{children:"assistant"===e.role?s(l,{children:[e.orchestratorAndAgentsMessages&&e.orchestratorAndAgentsMessages.length>0&&r(S,{orchestratorAndAgentsMessages:null==e?void 0:e.orchestratorAndAgentsMessages,isStreamEnd:Ze,finalTimeTaken:null==e?void 0:e.finalTimeTaken},null!==(i=null==e?void 0:e.finalTimeTaken)&&void 0!==i?i:null==e?void 0:e.id),r(k,{index:n,content:null==e?void 0:e.content,role:null==e?void 0:e.role,messages:We,handleStream:Bn,isLastMessage:n===We.length-1,onSave:ne,citations:null==e?void 0:e.citations,setChatSize:ie,chatSize:te,isStreamEnd:Ze,messageIsEnd:null==e?void 0:e.isEnd,onViewComparison:ye,onTypeResponseClick:function(){var e;En(!0),null===(e=De.current)||void 0===e||e.focus()},onComparisonLinkClick:be,baseURL:Te,onFeedbackSubmit:Kn,isGlobalEditActive:xe}),e.hasOwnProperty("isEnd")&&!(null==e?void 0:e.isEnd)&&(null===(o=null==e?void 0:e.content)||void 0===o?void 0:o.length)>0&&s(l,{children:[r(_,{variant:"text",width:"50%",height:20}),r("div",{style:{marginTop:"10px"}}),r(_,{variant:"text",width:"100%",height:40})]}),r("div",t({className:M.timestamp},{children:e.time&&!isNaN(new Date(e.time).getTime())?new Date(e.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}):s("div",t({className:M.userMessageWrapper},{children:[s("div",t({className:M.userMessageBubble,style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:e.isSkeleton||Un||e.id!==Sn?"none":"0 0 15px 3px rgba(37, 99, 235, 0.6)"}},{children:[e.isSkeleton?s("div",t({style:{display:"flex",flexDirection:"column",gap:"12px",minWidth:"280px",padding:"8px 0"}},{children:[r(_,{variant:"text",width:"100%",height:16}),r(_,{variant:"text",width:"80%",height:16})]})):r(k,{index:n,content:null==e?void 0:e.content,role:null==e?void 0:e.role,messages:We,handleStream:Bn,isLastMessage:n===We.length-1,onSave:ne,citations:null==e?void 0:e.citations,isStreamEnd:Ze,isGlobalEditActive:xe,messageIsEnd:null==e?void 0:e.isEnd,onViewComparison:ye,onComparisonLinkClick:be,baseURL:Te,onFeedbackSubmit:Kn}),r("div",t({style:{marginTop:"0.5rem"}},{children:r(F,{})}))]})),r("div",t({className:M.userTimestamp},{children:new Date(e.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}))}))]}),e.id)}),je&&s("div",t({className:M.loadingRow},{children:[r("div",t({className:M.iconWrapper,style:{marginTop:"0.2rem"}},{children:r(A,{})})),r("div",t({className:M.loadingTextWrapper},{children:r("span",{children:$e})}))]})),r("div",{ref:Ne,style:{float:"left",clear:"both"}})]}))]})),r("div",t({className:M.inputAreaWrapper},{children:r(g,t({title:V?"Please wait for the validation to be completed.":""},{children:s("div",t({className:"".concat(M.inputBoxContainer," ").concat(Ln?M.disabled:""),style:_n?{boxShadow:"0 0 15px 3px rgba(37, 99, 235, 0.5)",borderColor:"#2563eb",transition:"box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out"}:{transition:"box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out"}},{children:[We.length>0&&!sn&&r("div",t({onMouseDown:function(e){e.preventDefault(),Wn("smooth")},className:M.scrollToBottomBtn},{children:r(N,{})})),s("div",t({style:{width:"100%",display:"flex"}},{children:[r("textarea",{ref:De,placeholder:se,value:Le||"",onChange:function(e){Ae(e.target.value)},onFocus:function(){return an(!0)},onBlur:function(){return an(!1)},onKeyDown:function(e){return Bn(e)},disabled:Ln,className:"no-scrollbar ".concat(M.chatTextarea),style:{minHeight:on?"120px":"50px",height:on?"120px":"50px",maxHeight:"120px"}}),r("span",t({className:M.sendButtonWrapper},{children:r("button",t({onClick:function(e){An||Bn(new KeyboardEvent("keydown",{key:"Enter"}))},disabled:An,className:"".concat(M.sendButton," ").concat(An?M.disabled:M.active)},{children:r(L,{})}))}))]}))]}))}))})),s("div",t({className:M.footerTools},{children:[r(g,t({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:r("span",t({className:M.footerToolItem},{children:r(T,{amplitude:1,variant:"speaker",isActive:!1,onClick:function(){return null},disabled:!1})}))})),r(g,t({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:r("span",t({className:M.footerToolItem},{children:r(T,{amplitude:1,variant:"microphone",isActive:!1,onClick:function(){return null},disabled:!1})}))}))]}))]}))};export{q as autoGeneratePrompt,P as default};
|
|
1
|
+
import{__makeTemplateObject as e,__spreadArray as n,__assign as t,__awaiter as i,__generator as o,__rest as a}from"tslib";import{jsx as r,jsxs as s,Fragment as l}from"react/jsx-runtime";import{useRef as d,useState as c,useMemo as u,useEffect as v,useCallback as m,useLayoutEffect as h}from"react";import{keyframes as p}from"@mui/material";import g from"@mui/material/Tooltip";import f from"react-markdown";import C from"rehype-raw";import y from"axios";import{v4 as b}from"uuid";import{startChatStreamSSE as w}from"@e-llm-studio/streaming-response";import{WatchMeWork as S}from"@e-llm-studio/watch-me-work";import x from"./ChatHeader.js";import k from"../MessageRendering/MessageRendering.js";import{Skeleton as _}from"../atoms/SkeletonLoader/SkeletonLoader.js";import{ActionableButton as E}from"../MessageRendering/ClickableChatComponents.js";import T from"../AudioWaveform.js";import M from"./ChatComponent.module.css.js";import I from"../../InstantLearning.module.css.js";import{ScrollToBottom as N}from"../_svg/ScrollToBottom.js";import{useHeaderObserver as D,extractTextFromChildren as R}from"../../helpers/utils.js";import{SendButton as L}from"../_svg/SendButton.js";import A from"../_svg/SparkleIcon.js";import{UserIcon as F}from"../_svg/UserIcon.js";var W,q=function(e,n){return y.post("".concat(e||"https://devllmstudio.creativeworkspace.ai","/api/chat/chatResponse"),{name:"ilggcautopromptgen",organizationName:"techolution",prompt:n||"Generate a query"},{headers:{"Content-Type":"application/json"},withCredentials:!0}).then(function(e){return e.data}).catch(function(e){throw console.error("Error calling auto-generate API:",e),e})},P=function(q){var P=q.chatAssistantName,j=q.organizationName,z=q.baseUrl;q.baseWebsocketUrl;var B=q.setIsNewChatClicked;q.ThinkingBulbIconComponent;var H=q.isFormSaveClicked,G=q.setIsFormSavedClicked,Z=q.onResetLearningData,U=q.sendMessageInChat,K=q.setSendMessageInChat,V=q.isFormValidating,O=q.chatTitle,Q=q.customMetaData,J=q.headerMessageHandlers;q.aiResponse;var $=q.setAIResponse,X=q.onResetChat,Y=q.initialChatMessage,ee=void 0===Y?"":Y,ne=q.onSave,te=q.chatSize,ie=q.setChatSize,oe=q.movingTowards,ae=q.setCitations,re=q.textareaPlaceholder,se=void 0===re?"Tell me more about this learning...":re,le=q.setCurrentRequestId,de=q.showSavedMessage,ce=void 0!==de&&de,ue=q.savedMessage,ve=q.isError,me=void 0!==ve&&ve,he=q.errorMessage,pe=void 0===he?"There was an error saving your changes.":he;q.isSaving;var ge=q.isHighlighted,fe=void 0!==ge&&ge,Ce=q.onStreamingStateChange,ye=q.onViewComparison;q.isCopyEnabled;var be=q.onComparisonLinkClick,we=q.onSubmitFeedback,Se=q.userDetails,xe=q.isGlobalEditActive,ke=P,_e=d("".concat(ke,"-").concat(j,"-").concat(b())),Ee=d("".concat(b())),Te=z,Me=d(null),Ie=d(!0),Ne=d(null),De=d(null),Re=c(""),Le=Re[0],Ae=Re[1],Fe=c([]),We=Fe[0],qe=Fe[1],Pe=c(!1),je=Pe[0],ze=Pe[1],Be=c(!1);Be[0];var He=Be[1],Ge=c(!0),Ze=Ge[0],Ue=Ge[1],Ke=c(!0);Ke[0];var Ve=Ke[1],Oe=c("");Oe[0];var Qe=Oe[1],Je=c(""),$e=Je[0],Xe=Je[1],Ye=c(!1),en=Ye[0],nn=Ye[1],tn=c(!1),on=tn[0],an=tn[1],rn=c(!0),sn=rn[0],ln=rn[1],dn=c("100%");dn[0];var cn=dn[1],un=c(null),vn=un[0],mn=un[1],hn=c(!1);hn[0];var pn=hn[1],gn=c(!1),fn=gn[0],Cn=gn[1],yn=d(null),bn=d(new Set),wn=c(null),Sn=wn[0],xn=wn[1],kn=c(!1),_n=kn[0],En=kn[1],Tn=c(!1);Tn[0],Tn[1];var Mn=c(null);Mn[0],Mn[1],d(null),d(null);var In=d(new Map),Nn=d(""),Dn=d(new Map),Rn=d(!1);p(W||(W=e(["\n 0%, 80%, 100% {\n transform: scale(0);\n }\n 40% {\n transform: scale(1.0);\n }\n "],["\n 0%, 80%, 100% {\n transform: scale(0);\n }\n 40% {\n transform: scale(1.0);\n }\n "])));var Ln=u(function(){return""===(null==Le?void 0:Le.trim())||en},[Le,en]),An=u(function(){return V},[V]),Fn=u(function(){return Ln||en||V||!!xe},[Ln,en,V,xe]);v(function(){null==Ce||Ce(en)},[en,Ce]),v(function(){var e=Me.current,n=function(){if(e){var n=e.scrollTop,t=e.scrollHeight,i=e.clientHeight;ln(t-n-i<=20)}};return e&&(e.addEventListener("scroll",n),n()),function(){e&&e.removeEventListener("scroll",n)}},[We]);var Wn=D({handlers:J,setResult:$}).processHeaderMessage;v(function(){ce&&Cn(!0)},[ce]),v(function(){if(_n){var e=setTimeout(function(){En(!1)},3e3);return function(){return clearTimeout(e)}}},[_n]),v(function(){H&&!xe&&(Hn(new KeyboardEvent("keydown",{key:"Enter"}),!1,"Save this Learning"),G(!1))},[H]),v(function(){if(U)try{if(U.startsWith("__SKELETON__:")){var e=U.split(":"),i=e[1],o=e.slice(2).join(":"),a={role:"user",content:"",id:i,time:new Date,isSkeleton:!0,skeletonContent:o};return qe(function(e){return n(n([],e,!0),[a],!1)}),Hn(new KeyboardEvent("keydown",{key:"Enter"}),!1,o,!1,i),xn(i),K&&K(""),void setTimeout(function(){xn(null)},2e3)}if(U.startsWith("__SKELETON_END__::")){var r=U.split("::")[1]||"";return qe(function(e){return e.map(function(e){return e.isSkeleton?t(t({},e),{isSkeleton:!1,content:e.skeletonContent||r}):e})}),void(K&&K(""))}var s=b();Hn(new KeyboardEvent("keydown",{key:"Enter"}),!1,U,!1,s),xn(s),K&&K(""),setTimeout(function(){return xn(null)},2e3)}catch(e){console.error("Error handling sendMessageInChat signal",e)}},[U]),v(function(){Pn(),jn();var e=function(){var e,n=(null===(e=null==yn?void 0:yn.current)||void 0===e?void 0:e.clientHeight)||0,t="calc(100% - ".concat(n,"px - 10px)");cn(t)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var qn=m(function(e){var n="string"==typeof e?e:"smooth";Ne.current&&Ne.current.scrollIntoView({behavior:n,block:"end"}),Ie.current&&setTimeout(function(){Ne.current&&Ie.current&&Ne.current.scrollIntoView({behavior:n,block:"end"})},100)},[]);v(function(){if(!en){var e="";if(fn?e=ue||"Thank you teacher for teaching me, your rule has been saved successfully.":me&&(e=pe||"I'm sorry, I couldn't save your changes. Please try again."),e){var t={role:"assistant",content:e,id:b(),citations:[],time:new Date};qe(function(e){return n(n([],e,!0),[t],!1)}),Cn(!1),setTimeout(function(){return qn("smooth")},100)}}},[fn,me,en,ue,pe,qn]),v(function(){Ie.current&&qn("smooth")},[qn]);var Pn=function(){var e={method:"get",maxBodyLength:1/0,url:"".concat(Te,"/api/chatbot/getChatSettings?name=").concat(ke,"&organizationName=").concat(j),headers:{}};y.request(e).then(function(e){var n,t,i;(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.chatSettings)&&""!==(null===(i=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.chatSettings)||void 0===i?void 0:i.chatInitialMessage)&&Ve(!0)}).catch(function(e){console.error(e)})},jn=function(){return i(void 0,void 0,void 0,function(){var e,n;return o(this,function(t){e="".concat(Te,"/api/chat/history?name=").concat(ke,"&organizationName=").concat(j);try{n={method:"GET",params:{guestSessionId:_e.current},withCredentials:!0},y.get(e,n).then(function(e){var n=e.data;n.length>0?(qe(n),qn()):Ve(!0)}).catch(function(e){console.error(e)})}catch(e){ze(!1),console.error(e)}return[2]})})};function zn(e){return null==e?void 0:e.replace(/<a [^>]*>.*?<\/a>/g,function(e){return null==e?void 0:e.replace(/\*/g,"*")})}var Bn=function(e,i,o,a,r,s,l){var d,c,u,v,m,h,p,g,f,C,y,w,S,x,k,_,E,T,M,I,N,D,R,L,A,F,W,q,P,j;if(null===(c=null===(d=null==e?void 0:e.chatStream)||void 0===d?void 0:d.continueChatResult)||void 0===c?void 0:c.header_message){var z={header_message:e.chatStream.continueChatResult.header_message,responsedata:null===(m=null===(v=null===(u=null==e?void 0:e.chatStream)||void 0===u?void 0:u.continueChatResult)||void 0===v?void 0:v.message)||void 0===m?void 0:m.content};Wn(z)}var B=null===(h=null==e?void 0:e.chatStream)||void 0===h?void 0:h.continueChatResult,H=null==B?void 0:B.isEnd,G=(null===(p=null==B?void 0:B.message)||void 0===p?void 0:p.citations)||[];H&&G.length>0&&ae&&ae(G);var Z={role:"assistant",content:"",id:b()};if(null===(y=null===(C=null===(f=null===(g=null==e?void 0:e.chatStream)||void 0===g?void 0:g.continueChatResult)||void 0===f?void 0:f.message)||void 0===C?void 0:C.content)||void 0===y?void 0:y.includes("WaitMessage: "))He(!0),Z.content=function(e){var n="WaitMessage: ",t=e.indexOf(n);if(-1!==t){var i=e.substring(t+13);return null==i?void 0:i.replaceAll("WaitMessage: ","")}return""}((null===(x=null===(S=null===(w=null==e?void 0:e.chatStream)||void 0===w?void 0:w.continueChatResult)||void 0===S?void 0:S.message)||void 0===x?void 0:x.content)+"\n\n"),""!==Z.content&&(ze(!1),qe(n(n([],We,!0),[{role:"user",content:r,time:a,isFirstQuestionSent:s||!1,id:l||(null===(_=null===(k=null==e?void 0:e.chatStream)||void 0===k?void 0:k.continueChatResult)||void 0===_?void 0:_.requestId)||"",reply:""},Z],!1)));else{He(!1);var U=null===(T=null===(E=null==e?void 0:e.chatStream)||void 0===E?void 0:E.continueChatResult)||void 0===T?void 0:T.requestId;"string"==typeof U&&U&&le&&le(U);var K=function(e,i,o,a){var r,s,l,d,c,u,v,m={role:"assistant",content:"",id:b(),time:new Date,citations:[]},h=(null===(r=null==e?void 0:e.chatStream)||void 0===r?void 0:r.continueChatResult)||{},p=null==h?void 0:h.requestId,g=null==h?void 0:h.preserve_message,f=null==h?void 0:h.isEnd,C=(null===(s=null==h?void 0:h.message)||void 0===s?void 0:s.content)||"",y=null==h?void 0:h.is_orchestrator,w=null==h?void 0:h.thinking_break,S=(null===(l=null==h?void 0:h.message)||void 0===l?void 0:l.citations)||[];if(p&&g&&C&&!f){var x=a.current.get(p)||[];x[x.length-1]!==C&&(x.push(C),a.current.set(p,x))}var k=(p&&a.current.get(p)||[]).join("\n\n"),_="";if(f)_=k&&""!==k.trim()?k:C;else if(g)_=k;else{var E=C.replace(/<!--(?![\s\S]*-->)[\s\S]*$/,"").trimEnd(),T=!1===y||w||0!==S.length?"":E;_=k?"".concat(k,"\n\n").concat(T):T}if(m.content=zn(_),!0===(null==h?void 0:h.thinking_break)&&!0===(null==h?void 0:h.is_orchestrator)&&!1===(null==h?void 0:h.isEnd)&&i.push({responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!1}),!1===(null==h?void 0:h.thinking_break)&&!1===(null==h?void 0:h.is_orchestrator)&&!1===(null==h?void 0:h.isEnd)){if(h.explainability_id&&h.responded_by){var M=h.explainability_id,I=h.responded_by;o.has(M)||o.set(M,{responded_by:I,index:i.length})}o.has(h.explainability_id)?i[null==(N=o.get(h.explainability_id))?void 0:N.index]={responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!0,explainability_id:null!==(d=h.explainability_id)&&void 0!==d?d:"",isParallelToolResponse:!0}:i=n(n([],i,!0),[{responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!0,explainability_id:null!==(c=h.explainability_id)&&void 0!==c?c:"",isParallelToolResponse:!1}],!1)}if(!0===(null==h?void 0:h.thinking_break)&&!1===(null==h?void 0:h.is_orchestrator)&&!1===(null==h?void 0:h.isEnd)){var N;h.explainability_id&&h.responded_by&&(M=h.explainability_id,I=h.responded_by,o.has(M)||o.set(M,{responded_by:I,index:i.length})),o.has(h.explainability_id)?i[null==(N=o.get(h.explainability_id))?void 0:N.index]={responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!1,explainability_id:null!==(u=h.explainability_id)&&void 0!==u?u:"",isParallelToolResponse:!0}:i.push({responsedata:C,responseFrom:h.responded_by,header_message:h.header_message,finalResponseStatus:!1,explainability_id:null!==(v=h.explainability_id)&&void 0!==v?v:"",isParallelToolResponse:!1})}return t({orchestratorAndAgentsMessages:i},m)}(e,o,i,Dn);K.time=new Date,K.citations=G,K.isEnd=null===(I=null===(M=null==e?void 0:e.chatStream)||void 0===M?void 0:M.continueChatResult)||void 0===I?void 0:I.isEnd,K.requestId=null===(D=null===(N=null==e?void 0:e.chatStream)||void 0===N?void 0:N.continueChatResult)||void 0===D?void 0:D.requestId,K.sessionId=_e.current,null===(R=K.orchestratorAndAgentsMessages)||void 0===R||R.forEach(function(e){e&&e.header_message&&Wn(e)}),(""!==(null==K?void 0:K.content)||(null==K?void 0:K.orchestratorAndAgentsMessages)&&(null==K?void 0:K.orchestratorAndAgentsMessages.length)>0)&&(ze(!1),qe(n(n([],We,!0),[{role:"user",content:r||"",time:a,isFirstQuestionSent:s||!1,id:l||(null===(A=null===(L=null==e?void 0:e.chatStream)||void 0===L?void 0:L.continueChatResult)||void 0===A?void 0:A.requestId)||"",requestId:null!==(q=null===(W=null===(F=null==e?void 0:e.chatStream)||void 0===F?void 0:F.continueChatResult)||void 0===W?void 0:W.requestId)&&void 0!==q?q:""},K],!1))),Ue(null===(j=null===(P=null==e?void 0:e.chatStream)||void 0===P?void 0:P.continueChatResult)||void 0===j?void 0:j.isEnd)}},Hn=function(e,i,o,a,r,s){var l,d,c,u,v,m,h=(void 0!==o?o:Le||"").trim(),p="Enter"===(null==e?void 0:e.key)&&!(null==e?void 0:e.shiftKey)&&!xe;p&&(null===(l=null==e?void 0:e.preventDefault)||void 0===l||l.call(e));var g="user"===(null===(d=We[We.length-1])||void 0===d?void 0:d.role);if(!(!h||en||Rn.current||g||(null==e?void 0:e.key)&&!p)){if(Rn.current=!0,"I want to add a rule description"===h){Ue(!1),Ie.current=!0,nn(!0),!vn&&h&&mn(o||"manual_entry");var f=new Date;return qe(function(e){return n(n([],e.map(function(e,n){var i;return t(t({},e),{content:null===(i=zn(e.content))||void 0===i?void 0:i.replace("WaitMessage: ","")})}),!0),[{role:"user",content:h,time:f,isFirstQuestionSent:!1,id:r||b()}],!1)}),qn("smooth"),void setTimeout(function(){qe(function(e){return n(n([],e,!0),[{role:"assistant",content:"I'd be happy to help you set up a new rule! To get started, could you tell me what kind of behavior or logic you would like this rule to follow?",id:b(),citations:[],time:new Date}],!1)}),qn("smooth"),setTimeout(function(){nn(!1),Ue(!0)},500)},500)}Ue(!1),Ie.current=!0,nn(!0),!vn&&h&&mn(o||"manual_entry");var C=new Date;qe(function(e){var i=e.map(function(e){var n;return t(t({},e),{content:null===(n=zn(e.content))||void 0===n?void 0:n.replace("WaitMessage: ","")})});return r&&i.some(function(e){return e.id===r})?i.map(function(e){return e.id===r?t(t({},e),{content:h}):e}):n(n([],i,!0),[{role:"user",content:h,time:C,isFirstQuestionSent:!1,id:r||b()}],!1)}),qn("smooth");var y=new Map,S=[],x={API_URL:z,organizationName:j,chatAssistantName:ke,selectedAIModel:"gpt-4",replyMessage:"",userName:null!==(c=null==Se?void 0:Se.name)&&void 0!==c?c:"Guest User",userEmailId:null!==(u=null==Se?void 0:Se.email)&&void 0!==u?u:"guestUser@example.com",userId:null!==(v=null==Se?void 0:Se.id)&&void 0!==v?v:"Guest User",query:h,requestId:"requestId-".concat(b()),customPrompt:"",enableForBackend:!1,guestSessionId:_e.current,chatPreviewId:Ee.current,customMetaData:Q,aiModel:"",onStreamEvent:function(e){return Bn(e,y,S,C,h,i,r)},onStreamEnd:function(e){Rn.current=!1,Ue(!0),nn(!1),pn(!1);var i=Date.now(),o=In.current.get(Nn.current);if(o){var a=Math.round((i-o)/1e3).toFixed(1);qe(function(e){var i=n([],e,!0).reverse().findIndex(function(e){return"assistant"===e.role});if(-1===i)return e;var o=e.length-1-i;return e.map(function(e,n){return n===o?t(t({},e),{finalTimeTaken:a}):e})})}},onError:function(e){Rn.current=!1,console.error("Stream error:",e),Ue(!0),nn(!1),pn(!1)}};if(h)ze(!0),null===(m=De.current)||void 0===m||m.blur(),Ae(""),qn(),Xe(r?"Just a moment, processing your request...":"Okay, got it. Let me take a moment to work on this and I'll get back to you shortly."),In.current.set(x.requestId,Date.now()),Nn.current=x.requestId,w(x);s&&s(!1)}},Gn=d(null);h(function(){Gn.current=Hn});var Zn=m(function(){for(var e,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return null===(e=Gn.current)||void 0===e?void 0:e.call.apply(e,n([Gn],t,!1))},[]),Un=u(function(){return{p:function(e){e.node;var n=e.children;return a(e,["node","children"]),r("div",t({style:{margin:0,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"10px",fontFamily:"inherit"}},{children:n}))},button:function(e){e.node;var n=e.className,i=e.children,o=a(e,["node","className","children"]),l=R(i),d=o["data-value"],c="Tester Genie"===l;return r(E,t({},o,{className:n,handleStream:Zn,isStreamEnd:Ze,disabled:!!vn||!!xe,isLastMessage:!0,style:{margin:0},isTesterGenie:c,"data-selected":vn===l||vn===d?"true":vn?"false":void 0},{children:s("span",t({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[i,c&&s("svg",t({width:"16",height:"20",viewBox:"0 0 16 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[r("path",{d:"M7.20368 8.94768e-06C7.48895 -0.00208639 7.69331 0.364327 7.83856 0.57465C8.14381 1.01633 8.38012 1.87909 7.71077 2.14118C8.57167 2.21011 9.70406 2.93098 10.1785 3.64699C10.5932 4.27286 10.4559 5.16037 9.80301 5.56007L9.9502 7.16593C9.97671 7.44871 10.0265 7.87092 10.0299 8.14457C10.4213 8.23046 11.0787 8.55391 11.326 8.87592C11.5979 8.75656 11.9189 8.76963 12.1688 8.93469C12.3563 8.67751 12.5598 8.41456 12.7507 8.15787C12.3283 7.45155 12.5047 6.57745 13.2143 6.13784C13.5375 5.9377 13.9264 5.87277 14.2971 5.95705C14.0961 6.30964 13.8775 6.72182 13.6593 7.05857C13.7906 7.2436 13.9184 7.44225 14.044 7.63194L14.8022 7.63198C15.0349 7.30106 15.2515 6.90827 15.4835 6.59349C15.8623 7.0712 15.8156 7.79671 15.4734 8.28241C15.1318 8.76741 14.4886 8.9899 13.9118 8.88251C13.758 9.12108 13.5577 9.39243 13.3941 9.63201C13.7143 9.9316 13.7725 10.364 13.4067 10.6594C13.5231 10.8889 13.5309 11.1613 13.447 11.402C13.1502 12.2523 12.1724 12.5645 11.3474 12.5025C11.1171 12.4852 10.939 12.4698 10.7197 12.3953C10.8724 13.1271 10.7744 14.2031 10.5132 14.9051C10.1688 15.8304 9.43632 16.5569 8.54503 16.9655C7.90465 17.2706 7.21222 17.3607 6.50472 17.4505C5.74445 17.5471 4.75801 17.4362 4.08533 17.825C3.9327 17.9132 3.86566 18.0173 3.82943 18.1792C3.94996 18.5982 4.47858 18.6063 4.78474 18.8897C5.20191 19.2758 4.90716 19.9663 4.36611 19.9908C4.31476 19.9931 4.26867 19.9867 4.23186 19.9493C4.23089 19.8303 4.47587 19.7199 4.49787 19.5262C4.55075 19.0604 3.70014 19.0078 3.37835 18.8374C3.13013 18.706 2.99537 18.6309 2.82242 18.4021C2.63795 18.1579 2.58428 17.835 2.63138 17.5392C2.74868 16.7847 3.47123 16.393 4.12184 16.1497C4.61314 15.9659 5.46304 15.7158 5.52019 15.0793C5.58589 14.348 4.97543 13.5523 4.57739 12.9807C4.44275 12.7875 4.3039 12.579 4.16309 12.3919C4.18987 12.365 4.21049 12.3463 4.23916 12.3212C4.59619 12.6218 5.21209 12.6421 5.55038 12.2979C5.70457 12.144 5.78974 11.9342 5.78642 11.7164C5.78121 11.4493 5.63382 11.2002 5.4454 11.019C5.44704 10.9932 5.44824 10.9676 5.449 10.9419C5.4566 10.6648 5.37505 10.4902 5.1892 10.2943C5.18398 10.2538 5.17776 10.2134 5.17053 10.1732C5.08123 9.69297 4.71708 9.34182 4.23415 9.27108C4.16418 9.26083 3.96108 9.26105 3.92071 9.23344C3.90485 9.1828 3.9059 9.20792 3.91904 9.15527C4.22103 8.90139 4.14407 8.78214 4.31107 8.4846C4.42301 8.28513 4.73047 8.15239 4.95452 8.10701C4.96167 7.51076 5.03684 6.88562 5.10036 6.29144C5.12451 6.0655 5.12531 5.75046 5.1511 5.55257C4.11108 4.86747 4.39091 3.75946 5.25465 3.06391C5.84978 2.58469 6.34496 2.31002 7.10143 2.14517C7.01589 2.10416 6.93842 2.04811 6.87269 1.97972C6.77021 1.87349 6.70248 1.73857 6.67853 1.59293C6.60568 1.12096 7.04104 0.914625 7.18759 0.526392C7.26428 0.323403 7.03925 0.146075 7.20368 8.94768e-06Z",fill:"#475569"}),r("path",{d:"M7.459 4.5C7.48797 4.50312 7.71949 4.61154 7.76205 4.63061C8.27062 4.85835 8.87051 5.09164 9.35658 5.3582C9.36602 6.03495 9.37016 6.56625 8.70573 6.91519C8.6633 6.80883 8.63019 6.72409 8.56332 6.63044C8.43786 6.45568 8.24656 6.33963 8.03354 6.30909C7.8434 6.28211 7.65146 6.3197 7.49586 6.43503C7.21897 6.21256 6.76265 6.28197 6.5229 6.52486C6.39308 6.65639 6.34815 6.75074 6.28902 6.92344C5.59702 6.5957 5.58761 6.04267 5.60583 5.35582C5.89882 5.23844 6.21318 5.0724 6.50153 4.941C6.82145 4.79522 7.14482 4.6574 7.459 4.5Z",fill:"#D1EDFD"}),r("path",{d:"M11.0756 10.6406C11.1037 10.6701 11.1324 10.7706 11.1535 10.8145C11.2818 11.0817 11.4922 11.1945 11.7498 11.2977C11.5607 11.63 11.4567 11.8797 11.1034 12.0466L11.0839 12.0517C10.9262 12.0927 10.7996 12.0968 10.651 12.0135C10.4755 11.915 10.3807 11.6614 10.4792 11.478C10.6388 11.1809 10.8877 10.9272 11.0756 10.6406Z",fill:"#D1EDFD"}),r("path",{d:"M11.6036 9.1377C11.6993 9.11763 11.8391 9.16378 11.9294 9.19593C11.6952 9.50644 11.4706 9.81614 11.2327 10.1261L11.1572 10.2255C10.7581 9.73539 11.0333 9.24481 11.6036 9.1377Z",fill:"#D1EDFD"}),r("path",{d:"M7.49681 0.882812C7.53691 0.925159 7.61244 1.08523 7.63598 1.14156C7.74243 1.39673 7.75769 1.76908 7.38596 1.77504C7.28236 1.75599 7.15628 1.68938 7.13517 1.5783C7.0843 1.3107 7.35609 1.09964 7.48737 0.897583L7.49681 0.882812Z",fill:"#D1EDFD"}),r("path",{d:"M1.68305 6.17249C1.71659 6.1673 1.8134 6.16478 1.84892 6.16432C2.34052 6.15616 2.81496 6.34495 3.16655 6.68866C3.50847 7.01806 3.70349 7.47119 3.70765 7.94596C3.70896 8.42345 3.54045 8.85284 3.20281 9.19025C3.34033 9.28068 3.5321 9.52219 3.6543 9.65748C4.17158 9.39073 4.91447 9.69339 4.79675 10.3444C5.08751 10.5485 5.19656 10.8288 5.0585 11.1674C5.15418 11.2375 5.25595 11.3205 5.32383 11.4186C5.40228 11.5303 5.4309 11.6695 5.40291 11.8031C5.32228 12.1857 4.90085 12.3286 4.57669 12.1236C4.51367 12.0838 4.42258 11.9595 4.35299 11.9431C4.30669 11.9557 4.28453 11.9584 4.23644 11.9644C4.22885 11.9742 4.22118 11.9841 4.21343 11.9938C3.93597 12.3413 3.49234 12.4682 3.06933 12.5157C2.85285 12.518 2.70432 12.5146 2.49066 12.4609C1.80785 12.2892 1.50808 11.6167 1.70723 10.9639C1.829 10.5648 2.11891 10.2506 2.48939 10.0518C2.54655 10.132 2.57559 10.2191 2.64066 10.303C2.73571 10.2223 2.82048 10.1482 2.92363 10.0773C2.81023 9.95313 2.66811 9.7693 2.55817 9.63584C2.38871 9.6878 2.23026 9.72879 2.05298 9.74653C1.54239 9.80228 1.03118 9.64711 0.637735 9.31695C0.269964 9.01018 0.0453493 8.54827 0.00544736 8.07322C-0.0309495 7.60988 0.116099 7.15077 0.414918 6.79478C0.742554 6.41198 1.18728 6.21393 1.68305 6.17249Z",fill:"#475569"}),r("path",{d:"M1.79616 6.5951C2.54894 6.5619 3.18687 7.14364 3.22301 7.8963C3.25915 8.64894 2.67989 9.28913 1.92739 9.3282C1.17073 9.3675 0.526231 8.78435 0.489885 8.02753C0.45354 7.27071 1.03921 6.62849 1.79616 6.5951Z",fill:"#D1EDFD"}),r("path",{d:"M4.93607 11.4844C5.12839 11.6261 5.22049 11.9085 4.91876 11.9419C4.8067 11.8805 4.78491 11.8646 4.71094 11.7561C4.81572 11.6752 4.862 11.5925 4.93607 11.4844Z",fill:"#FEFEFD"}),r("path",{d:"M12.5164 3.58594L12.5715 3.59466C12.6589 3.65863 12.6908 3.94434 12.7882 4.05193C12.8789 4.15216 12.9155 4.17816 13.0326 4.24929C13.1363 4.31224 13.3325 4.34025 13.384 4.43124C13.3643 4.56218 13.0693 4.54857 12.9127 4.69344C12.6903 4.89898 12.7114 5.06971 12.5892 5.28622C12.5669 5.28439 12.5368 5.2868 12.5261 5.27346C12.4336 5.15843 12.4072 4.9308 12.3099 4.81465C12.1627 4.63903 11.9972 4.60054 11.7981 4.51372C11.7544 4.49467 11.7266 4.47099 11.7129 4.42649C11.7867 4.31876 12.0509 4.34309 12.2376 4.14892C12.43 3.94901 12.4155 3.72208 12.5164 3.58594Z",fill:"#475569"}),r("path",{d:"M2.13644 3.72656C2.24401 3.77084 2.29712 4.1268 2.431 4.25226C2.60327 4.41371 2.7311 4.41949 2.93246 4.52449C2.96024 4.53897 2.97173 4.56042 2.97671 4.58878C2.89584 4.6981 2.61854 4.70721 2.4596 4.85659C2.26275 5.04156 2.27341 5.29132 2.17022 5.42088C2.16192 5.41849 2.11671 5.40232 2.1156 5.40043C2.01291 5.21216 1.9836 5.04909 1.84812 4.87273C1.73599 4.72675 1.36534 4.69959 1.32812 4.56939C1.3835 4.47941 1.67823 4.44211 1.82291 4.30563C2.02737 4.11274 2.0042 3.8372 2.13644 3.72656Z",fill:"#475569"})]}))]}))}))}}},[Zn,Ze,vn,xe]),Kn=u(function(){return We.some(function(e){return e.isSkeleton})},[We]),Vn=function(e){return i(void 0,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return we?[4,we(e)]:[3,2];case 1:t.sent(),qe(function(e){return n(n([],e,!0),[{role:"assistant",content:"Thanks for your feedback — this will help improve future suggestions.",id:b(),citations:[],time:new Date,isEnd:!0}],!1)}),setTimeout(function(){return qn("smooth")},100),t.label=2;case 2:return[2]}})})};return s("div",t({className:"".concat(I.customFont," ").concat(M.chatContainer),style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:fe&&!Kn?"0 0 20px 5px rgba(37, 99, 235, 0.5)":"none"}},{children:[s("div",t({ref:Me,className:M.scrollWrapper},{children:[r("div",t({ref:yn,className:M.stickyHeader},{children:r(x,{resetChatHistory:function(){var e="".concat(Te,"/api/chat/resetHistory?name=").concat(ke,"&organizationName=").concat(j);try{var n={method:"GET",params:{guestSessionId:_e.current},withCredentials:!0};y.get(e,n).then(function(){B(!0),Qe(""),mn(null),bn.current.clear(),Dn.current.clear(),Ee.current="".concat(b()),qe([]),Ve(!0),null==X||X(),Z&&Z()}).catch(function(e){console.error(e)}).finally(function(){_e.current="".concat(ke,"-").concat(j,"-").concat(b())})}catch(e){ze(!1),console.error(e)}},isStreamEnd:Ze,chatTitle:O,onResize:ie,chatSize:te,movingTowards:oe})})),s("div",t({className:M.messagesList},{children:[s("div",t({className:M.initialMessageRow},{children:[r("div",t({className:M.iconWrapper},{children:r(A,{})})),r("div",t({className:M.welcomeTextWrapper},{children:r("div",t({className:M.welcomeMarkdownWrapper},{children:r("span",{children:r(f,t({rehypePlugins:[C],components:Un},{children:ee}))})}))}))]})),We.length>0&&We.map(function(e,n){var i,o;return s("div",t({className:M.messageRow},{children:["assistant"===e.role?r("div",t({className:M.assistantIconContainer},{children:r(A,{})})):r("div",{className:M.userSpacer}),r("div",t({className:M.messageContent},{children:"assistant"===e.role?s(l,{children:[e.orchestratorAndAgentsMessages&&e.orchestratorAndAgentsMessages.length>0&&r(S,{orchestratorAndAgentsMessages:null==e?void 0:e.orchestratorAndAgentsMessages,isStreamEnd:Ze,finalTimeTaken:null==e?void 0:e.finalTimeTaken},null!==(i=null==e?void 0:e.finalTimeTaken)&&void 0!==i?i:null==e?void 0:e.id),r(k,{index:n,content:null==e?void 0:e.content,role:null==e?void 0:e.role,messages:We,handleStream:Hn,isLastMessage:n===We.length-1,onSave:ne,citations:null==e?void 0:e.citations,setChatSize:ie,chatSize:te,isStreamEnd:Ze,messageIsEnd:null==e?void 0:e.isEnd,onViewComparison:ye,onTypeResponseClick:function(){var e;En(!0),null===(e=De.current)||void 0===e||e.focus()},onComparisonLinkClick:be,baseURL:Te,onFeedbackSubmit:Vn,isGlobalEditActive:xe}),e.hasOwnProperty("isEnd")&&!(null==e?void 0:e.isEnd)&&(null===(o=null==e?void 0:e.content)||void 0===o?void 0:o.length)>0&&s(l,{children:[r(_,{variant:"text",width:"50%",height:20}),r("div",{style:{marginTop:"10px"}}),r(_,{variant:"text",width:"100%",height:40})]}),r("div",t({className:M.timestamp},{children:e.time&&!isNaN(new Date(e.time).getTime())?new Date(e.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}):s("div",t({className:M.userMessageWrapper},{children:[s("div",t({className:M.userMessageBubble,style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:e.isSkeleton||Kn||e.id!==Sn?"none":"0 0 15px 3px rgba(37, 99, 235, 0.6)"}},{children:[e.isSkeleton?s("div",t({style:{display:"flex",flexDirection:"column",gap:"12px",minWidth:"280px",padding:"8px 0"}},{children:[r(_,{variant:"text",width:"100%",height:16}),r(_,{variant:"text",width:"80%",height:16})]})):r(k,{index:n,content:null==e?void 0:e.content,role:null==e?void 0:e.role,messages:We,handleStream:Hn,isLastMessage:n===We.length-1,onSave:ne,citations:null==e?void 0:e.citations,isStreamEnd:Ze,isGlobalEditActive:xe,messageIsEnd:null==e?void 0:e.isEnd,onViewComparison:ye,onComparisonLinkClick:be,baseURL:Te,onFeedbackSubmit:Vn}),r("div",t({style:{marginTop:"0.5rem"}},{children:r(F,{})}))]})),r("div",t({className:M.userTimestamp},{children:new Date(e.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}))}))]}),e.id)}),je&&s("div",t({className:M.loadingRow},{children:[r("div",t({className:M.iconWrapper,style:{marginTop:"0.2rem"}},{children:r(A,{})})),r("div",t({className:M.loadingTextWrapper},{children:r("span",{children:$e})}))]})),r("div",{ref:Ne,style:{float:"left",clear:"both"}})]}))]})),r("div",t({className:M.inputAreaWrapper},{children:r(g,t({title:V?"Please wait for the validation to be completed.":""},{children:s("div",t({className:"".concat(M.inputBoxContainer," ").concat(An?M.disabled:""),style:_n?{boxShadow:"0 0 15px 3px rgba(37, 99, 235, 0.5)",borderColor:"#2563eb",transition:"box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out"}:{transition:"box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out"}},{children:[We.length>0&&!sn&&r("div",t({onMouseDown:function(e){e.preventDefault(),qn("smooth")},className:M.scrollToBottomBtn},{children:r(N,{})})),s("div",t({style:{width:"100%",display:"flex"}},{children:[r("textarea",{ref:De,placeholder:se,value:Le||"",onChange:function(e){Ae(e.target.value)},onFocus:function(){return an(!0)},onBlur:function(){return an(!1)},onKeyDown:function(e){return Hn(e)},disabled:An,className:"no-scrollbar ".concat(M.chatTextarea),style:{minHeight:on?"120px":"50px",height:on?"120px":"50px",maxHeight:"120px"}}),r("span",t({className:M.sendButtonWrapper},{children:r("button",t({onClick:function(e){Fn||Hn(new KeyboardEvent("keydown",{key:"Enter"}))},disabled:Fn,className:"".concat(M.sendButton," ").concat(Fn?M.disabled:M.active)},{children:r(L,{})}))}))]}))]}))}))})),s("div",t({className:M.footerTools},{children:[r(g,t({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:r("span",t({className:M.footerToolItem},{children:r(T,{amplitude:1,variant:"speaker",isActive:!1,onClick:function(){return null},disabled:!1})}))})),r(g,t({title:"Coming soon",placement:"top",arrow:!0,componentsProps:{tooltip:{sx:{fontSize:"0.875rem",padding:"0.5rem",fontFamily:"Plus Jakarta Sans, sans-serif"}}}},{children:r("span",t({className:M.footerToolItem},{children:r(T,{amplitude:1,variant:"microphone",isActive:!1,onClick:function(){return null},disabled:!1})}))}))]}))]}))};export{q as autoGeneratePrompt,P as default};
|
|
2
2
|
//# sourceMappingURL=ChatComponent.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as i}from"tslib";import{jsxs as e,jsx as n}from"react/jsx-runtime";import t,{useState as o,useEffect as l}from"react";import{InputDataReasoningCard as r}from"../../InputDataReasoningCard.js";import{ConditionSection as a}from"../../organisms/ConditionSection/ConditionSection.js";import{ConfigSection as d}from"../../organisms/ConfigSection/ConfigSection.js";import{ScopeSection as c}from"../../organisms/ScopeSection/ScopeSection.js";import{TextSection as u}from"../../organisms/TextSection/TextSection.js";import s from"../../AccordianSection.js";import{ButtonCognitiveIcon as v}from"../../_svg/ButtonCognitiveIcon.js";import{Loader2Icon as p,Pencil as f,Check as g,AlertTriangle as h}from"lucide-react";var y=function(o){var l=o.children,r=o.onAddVariant,a=o.isDisabled,d=t.Children.toArray(l);return e("div",i({style:{display:"flex",flexDirection:"column",alignItems:"flex-start"}},{children:[d.map(function(i,o){return e(t.Fragment,{children:[i,n("div",{style:{width:"2px",height:"20px",backgroundColor:"#E2E8F0",marginLeft:"30px"}})]},o)}),n("div",i({onClick:a?void 0:r,style:{padding:"8px 16px",border:"1px solid #E2E8F0",borderRadius:"8px",color:a?"#94a3b8":"#475569",fontSize:"14px",fontWeight:"500",cursor:a?"not-allowed":"pointer",backgroundColor:a?"#f8fafc":"#FFFFFF",opacity:a?.7:1,userSelect:"none",transition:"all 0.2s ease"}},{children:"Add Variant"}))]}))},m=function(m){var x,T,D,S,C,A,I,b,E,O,w,V=m.state,R=m.handlers,_=m.uiState,N=(null==_?void 0:_.highlights)||new Map,W=N.get("global_0")||{},M=o({}),j=M[0],F=M[1],k=o(null),B=k[0],L=k[1],z="rule-setup"===(null==_?void 0:_.activeEditId),q=t.useRef(new Map),P=o(null),H=P[0],J=P[1],K=o(null),$=K[0],U=K[1],Z=o(!1),G=Z[0],Q=Z[1],X=t.useRef(null==_?void 0:_.isAiStreaming);l(function(){X.current&&!(null==_?void 0:_.isAiStreaming)&&G&&Q(!1),X.current=null==_?void 0:_.isAiStreaming},[null==_?void 0:_.isAiStreaming,G]);var Y=function(){var i;J(null),U(null),null===(i=null==_?void 0:_.setActiveEditId)||void 0===i||i.call(_,null)},ii=function(){var i,e,n=null!=H?H:V.ruleTitle,t=null!=$?$:V.scopeData,o=n!==V.ruleTitle,l=JSON.stringify(t)!==JSON.stringify(V.scopeData);if(!o&&!l)return J(null),U(null),void(null===(i=null==_?void 0:_.setActiveEditId)||void 0===i||i.call(_,null));if(null==_?void 0:_.setSendMessageInChat){var r="sk-".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2,8)),a=[];if(o&&a.push((null==n?void 0:n.trim())?"Title with ".concat(n):"No Title"),l){var d=null==t?void 0:t.tiers,c=d&&d.length>0?"tiers: ".concat(d.join(", ")):"No Tier Selected";a.push(c)}var u=a.join(" and ");_.setSendMessageInChat("__SKELETON__:".concat(r,":Update Rule Setup ").concat(u))}Q(!0),J(null),U(null),null===(e=null==_?void 0:_.setActiveEditId)||void 0===e||e.call(_,null)},ei=null!==H?null==H?void 0:H.trim():(V.ruleTitle||"").trim(),ni=null!=$?$:V.scopeData,ti=ei!==(V.ruleTitle||"").trim(),oi=JSON.stringify(ni)!==JSON.stringify(V.scopeData),li=!ti&&!oi||""===ei,ri=t.useRef(null==_?void 0:_.defaultVariantOpen),ai=t.useRef(V.variantsByTier);t.useEffect(function(){var i,e,n,t,o=null,l=!1;if(ri.current!==(null==_?void 0:_.defaultVariantOpen)&&(l=!0,ri.current=null==_?void 0:_.defaultVariantOpen),l){if(null==(null==_?void 0:_.defaultVariantOpen)||(null==_?void 0:_.defaultVariantOpen)<0)return L(null),void(ai.current=V.variantsByTier);null===(e=null===(i=null==_?void 0:_.tierOptions)||void 0===i?void 0:i.filter(function(i){var e,n;return null===(n=null===(e=V.scopeData)||void 0===e?void 0:e.tiers)||void 0===n?void 0:n.includes(i)}))||void 0===e||e.forEach(function(i){var e,n=i.toLowerCase().replace(/ /g,"_");((null===(e=V.variantsByTier)||void 0===e?void 0:e[n])||[]).forEach(function(i,e){(null==_?void 0:_.defaultVariantOpen)===e&&(o="".concat(n,"-variant-").concat(e)),(null==_?void 0:_.autoScrollVariantIndex)===e&&(o="".concat(n,"-variant-").concat(e))})}),o&&L(o)}null===B&&(null==_?void 0:_.defaultVariantOpen)>=0&&(null===(t=null===(n=null==_?void 0:_.tierOptions)||void 0===n?void 0:n.filter(function(i){var e,n;return null===(n=null===(e=V.scopeData)||void 0===e?void 0:e.tiers)||void 0===n?void 0:n.includes(i)}))||void 0===t||t.forEach(function(i){var e,n=i.toLowerCase().replace(/ /g,"_");((null===(e=V.variantsByTier)||void 0===e?void 0:e[n])||[])[_.defaultVariantOpen]&&L("".concat(n,"-variant-").concat(_.defaultVariantOpen))})),ai.current=V.variantsByTier},[V.variantsByTier,null==_?void 0:_.defaultVariantOpen,null===(x=V.scopeData)||void 0===x?void 0:x.tiers,null==_?void 0:_.tierOptions,null==_?void 0:_.autoScrollVariantIndex]);var di=function(e){F(function(n){var t;return i(i({},n),((t={})[e]=!n[e],t))})},ci=function(i){var e,n,t,o=i.split("_"),l=o[o.length-1],r=/^\d+$/.test(l)?o.slice(0,-1).join("_"):i,a=null===(e=V.fieldCitations)||void 0===e?void 0:e[r];if(Array.isArray(a)&&a.length>0)return a;var d=null===(n=V.fieldCitations)||void 0===n?void 0:n[i];return Array.isArray(d)&&d.length>0?d:null!==(t=V.citations)&&void 0!==t?t:[]},ui={marginTop:"-17px",position:"relative",zIndex:1};l(function(){var i,e;null!=(null==_?void 0:_.autoScrollVariantIndex)&&(null===(e=null===(i=null==_?void 0:_.tierOptions)||void 0===i?void 0:i.filter(function(i){var e,n;return null===(n=null===(e=V.scopeData)||void 0===e?void 0:e.tiers)||void 0===n?void 0:n.includes(i)}))||void 0===e||e.forEach(function(i){var e=i.toLowerCase().replace(/ /g,"_"),n="".concat(e,"-variant-").concat(_.autoScrollVariantIndex),t=q.current.get(n);t&&requestAnimationFrame(function(){setTimeout(function(){t.scrollIntoView({behavior:"smooth",block:"center"})},300)})}))},[null==_?void 0:_.scrollTrigger]),console.log("CreateRule state:",V),console.log("CreateRule uiState:",_);var si=function(i){return i?i.replace(/_/g," ").replace(/([a-zA-Z])(\d)/g,"$1 $2").replace(/\b\w/g,function(i){return i.toUpperCase()}):"Variant 1"},vi=!!(null==_?void 0:_.activeEditId);return e("div",i({className:"traffic-manager-template"},{children:[n("div",i({"data-edit-id":"rule-setup"},{children:n(s,i({title:{type:"other",label:(null==_?void 0:_.setupLabel)||"Rule Setup"},actionButtons:function(e,t){if(z)return null;var o=!!(null==_?void 0:_.activeEditId)&&"rule-setup"!==_.activeEditId;return n("div",i({style:{position:"relative",display:"flex",flexDirection:"column"}},{children:n("button",i({title:o?"Save active edits first":"Edit",onClick:function(n){n.stopPropagation(),o?(null==_?void 0:_.setPendingEditId)&&_.setPendingEditId(_.activeEditId||null):(!function(){var e,n;(null==_?void 0:_.activeEditId)&&"rule-setup"!==_.activeEditId||(null===(e=null==_?void 0:_.setActiveEditId)||void 0===e||e.call(_,"rule-setup"),J(null!==(n=V.ruleTitle)&&void 0!==n?n:""),U(V.scopeData?i({},V.scopeData):{}))}(),(null==_?void 0:_.setPendingEditId)&&_.setPendingEditId(null),e||t())},disabled:G,style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",padding:"6px 8px",border:"1px solid #e5e7eb",borderRadius:"8px",cursor:G?"not-allowed":"pointer",backgroundColor:"#ffffff",color:"#6b7280",opacity:G?.5:1}},{children:n(f,{size:14})}))}))},footerData:{ruleTitle:V.ruleTitle,stations:[V.scopeData.station],tiers:null===(T=V.scopeData)||void 0===T?void 0:T.tiers},defaultOpen:"Create"===(null==_?void 0:_.usedFor),readOnly:"Create"!==(null==_?void 0:_.usedFor),isAiStreaming:null==_?void 0:_.isAiStreaming,editFlow:"Edit"===(null==_?void 0:_.usedFor)},{children:e("div",i({style:{display:"flex",flexDirection:"column",gap:"12px"}},{children:[G&&(null==_?void 0:_.isAiStreaming)&&e("div",i({style:{display:"flex",alignItems:"center",color:"#141414ff",fontSize:"13px",fontWeight:500,fontStyle:"italic",marginBottom:"8px",paddingLeft:"4px"}},{children:[n(p,{size:16,style:{marginRight:8,animation:"spin 1s linear infinite"}},"loader"),"Checking the correctness of your Rule Setup..."]})),n(u,i({id:"rule-title",title:_.ruleTitle||"Rule Title",rows:1,placeholder:"Enter a short, descriptive title for the learning",required:!0,value:z&&null!==H?H:V.ruleTitle,onChange:function(i){return z?J(i):R.setRuleTitle(i)},readOnly:(null==_?void 0:_.isAiStreaming)||!z,isOpen:j.ruleTitle,onToggle:function(){return di("ruleTitle")},isHighlighted:W.ruleTitle||!1,showCognitiveIcon:V.citation.ruleTitle,tooltipDescription:"Why this Title?",errorMessage:null===(D=_.validationErrors)||void 0===D?void 0:D.ruleTitle},_)),V.citation.ruleTitle&&n("div",i({style:ui},{children:n(r,{isVisible:j.ruleTitle,citation:V.citation.ruleTitle,citations:ci("ruleTitle"),fieldName:"Rule Title",fieldValue:V.ruleTitle})})),n(c,i({id:"scope",title:"",required:!1,scopeData:z&&null!==$?$:V.scopeData,onScopeChange:function(e,n){z?U(function(t){var o;return i(i({},null!=t?t:V.scopeData),((o={})[e]=n,o))}):R.onScopeChange(e,n)},tierLabel:"Which tiers should this learning apply to?",stationLabel:"Which scope should this learning belong to?",highlights:W,isOpen:j.scopeData,onToggle:function(){return di("scopeData")},showCognitiveIcon:V.citation.scopeData,cognitiveIcon:n(v,{}),tooltipDescription:"Why this Scope?",errorMessage:(null===(S=_.validationErrors)||void 0===S?void 0:S.station)||(null===(C=_.validationErrors)||void 0===C?void 0:C.tiers),stationErrorMessage:null===(A=_.validationErrors)||void 0===A?void 0:A.station,tierErrorMessage:null===(I=_.validationErrors)||void 0===I?void 0:I.tiers,readOnly:(null==_?void 0:_.isAiStreaming)||!z},_)),V.citation.scopeData&&n("div",i({style:ui},{children:n(r,{isVisible:j.scopeData,citation:V.citation.scopeData,citations:ci("scopeData"),fieldName:"Scope",fieldValue:null===(E=null===(b=V.scopeData)||void 0===b?void 0:b.tiers)||void 0===E?void 0:E.join(", ")})})),z?e("div",i({style:{display:"flex",flexDirection:"column",alignItems:"flex-start"}},{children:[e("div",i({style:{display:"flex",justifyContent:"flex-start",alignItems:"center",gap:"16px"}},{children:[n("button",i({onClick:Y,style:{background:"none",border:"none",color:"#6b7280",fontSize:"14px",fontWeight:"500",cursor:"pointer",padding:"0"}},{children:"Discard Changes"})),e("button",i({onClick:ii,disabled:li,style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",borderRadius:"12px",border:"none",backgroundColor:"#2563eb",color:"#ffffff",fontSize:"14px",fontWeight:"500",cursor:li?"not-allowed":"pointer",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.05)",opacity:li?.5:1}},{children:[n(g,{size:18,strokeWidth:2.5,color:"#ffffff"}),"Save Changes"]}))]})),"rule-setup"===(null==_?void 0:_.pendingEditId)&&e("div",i({style:{display:"flex",alignItems:"center",gap:"6px",marginTop:"8px"}},{children:[n(h,{style:{color:"#C2410C"}}),n("div",i({style:{display:"flex",color:"#C2410C",fontSize:"13px",paddingTop:"8px",alignItems:"center"}},{children:"Pending - Changes not applied yet. Apply or discard them to continue."}))]}))]})):null]}))}))})),null===(w=null===(O=null==_?void 0:_.tierOptions)||void 0===O?void 0:O.filter(function(i){var e,n;return null===(n=null===(e=V.scopeData)||void 0===e?void 0:e.tiers)||void 0===n?void 0:n.includes(i)}))||void 0===w?void 0:w.map(function(t,o,l){var c,v,p,f,g=t.toLowerCase().replace(/ /g,"_"),h=(null===(c=V.variantsByTier)||void 0===c?void 0:c[g])||[],m=h.length,x=!1;if(1===m){var T=h[0],D=!(null===(v=null==T?void 0:T.ruleDescription)||void 0===v?void 0:v.trim()),S=(null===(p=null==T?void 0:T.whenToApplyConditions)||void 0===p?void 0:p.some(function(i){return(null==i?void 0:i.text)&&""!==i.text.trim()}))||!1,C=(null===(f=null==T?void 0:T.whenNotToApplyConditions)||void 0===f?void 0:f.some(function(i){return(null==i?void 0:i.text)&&""!==i.text.trim()}))||!1;D&&!S&&!C&&(x=!0)}var A=x?void 0:"".concat(m," ").concat(1===m?"variant":"variants"," configured for this tier"),I=!((null==_?void 0:_.defaultTierOpen)>=0)||o===_.defaultTierOpen;return console.log("Rendering tier : ",t),n(s,i({variant:"tier-header",title:{type:"other",label:t},subtitle:A,defaultOpen:I,footerData:{description:"Variants for ".concat(t)}},{children:n(y,i({onAddVariant:function(){var i;return null===(i=R.addNewVariant)||void 0===i?void 0:i.call(R,g)},isDisabled:null==_?void 0:_.isAiStreaming},{children:h.map(function(t,o){var l,c,v,p,f,h,y,m,x,T,D,S=t.variantType||"default",C="".concat(g,"-variant-").concat(o),A=!0===t.is_variant,I="default"===S||"default_variant"===S;(null==_?void 0:_.defaultVariantOpen)>=0&&_.defaultVariantOpen;var b="".concat(g,"_").concat(o),E=N.get(b)||{},O=(null===(c=null===(l=_.separationItemsByTier)||void 0===l?void 0:l[g])||void 0===c?void 0:c.get(o))||[],w=(null===(p=null===(v=_.togglesByTier)||void 0===v?void 0:v[g])||void 0===p?void 0:p.get(o))||[];(null==_?void 0:_.autoScrollVariantIndex)===o||t.is_variant,console.log("Rendering ".concat(g," variant ").concat(o,":"),t),console.log("Rendering Variant : ",t),console.log("Open Accordion ID:",B,"Current Variant ID:",C);var W=null===(f=null==_?void 0:_.activeEditId)||void 0===f?void 0:f.startsWith("condition-wta-".concat(g,"-").concat(o)),M=null===(h=null==_?void 0:_.activeEditId)||void 0===h?void 0:h.startsWith("condition-wnta-".concat(g,"-").concat(o));return n("div",i({ref:function(i){i?q.current.set(C,i):q.current.delete(C)},style:{width:"100%"}},{children:n(s,i({title:{type:I?"default":"variant",label:si(S),number:o+1,isNewVariant:A,isDefault:t.isDefault,isModified:t.isModified},defaultOpen:!0,expanded:B===C,onToggle:function(){var i,e=B===C;console.log("is closing:",e),L(e?null:C),null===(i=null==_?void 0:_.setActiveVariantAccordionIndex)||void 0===i||i.call(_,e?null:o)},variant:"rule-behavior",footerData:{ruleTitle:S,description:t.ruleDescription||""}},{children:e("div",i({style:{display:"flex",flexDirection:"column",gap:"12px"}},{children:[n(u,i({id:"rule-description-".concat(g,"-").concat(o),title:_.ruleDescriptionTitle||"Rule Description",rows:2,placeholder:"Explain the learning behaviour",required:!0,readOnly:t.isReadOnly||(null==_?void 0:_.isAiStreaming)||vi&&(null==_?void 0:_.activeEditId)!=="rule-description-".concat(g,"-").concat(o),value:t.ruleDescription||"",onChange:function(i){return R.setRuleDescription(g,o,i)},isOpen:j["ruleDescription-".concat(g)],onToggle:function(){return di("ruleDescription-".concat(g))},isHighlighted:E.ruleDescription||!1,showCognitiveIcon:null===(y=V.citation)||void 0===y?void 0:y["ruleDescription_".concat(g)],tooltipDescription:"Why this Description?",errorMessage:null===(m=_.validationErrors)||void 0===m?void 0:m["ruleDescription-".concat(g,"-").concat(o)],enableInlineEdit:!0,setSendMessageInChat:null==_?void 0:_.setSendMessageInChat,isAiStreaming:null==_?void 0:_.isAiStreaming,fieldName:"Rule Description"},_)),(null===(x=V.citation)||void 0===x?void 0:x["ruleDescription_".concat(g)])&&n("div",i({style:ui},{children:n(r,{isVisible:j["ruleDescription-".concat(g)],citation:V.citation["ruleDescription_".concat(g)],citations:ci("ruleDescription_".concat(g,"_").concat(o)),fieldName:"Rule Description",fieldValue:t.ruleDescription})})),n(a,i({id:"when-to-apply-".concat(g,"-").concat(o),idPrefix:"condition-wta",title:_.whenToApplyTitle||"When to apply",required:!0,dividerRequired:!0,readOnly:t.isReadOnly||(null==_?void 0:_.isAiStreaming)||vi&&!W,conditions:t.whenToApplyConditions||[],onAdd:function(){return R.addWhenToApply(g,o)},onRemove:function(i,e,n){return R.removeWhenToApply(i,e,n)},onEdit:function(i,e,n,t){return R.editWhenToApply(i,e,n,t)},index:o,tierKey:g,isHighlighted:E.wta||!1,highlightedIds:null==_?void 0:_.highlightedIds,tooltipDescription:"Why this Condition?",citations:ci("whenToApply_".concat(g,"_").concat(o)),bordered:!0,addLabel:"Add When to apply",isAiStreaming:_.isAiStreaming,errorMessage:(null===(T=_.validationErrors)||void 0===T?void 0:T["whenToApply-".concat(g,"-").concat(o)])||(null==_?void 0:_.conflictReason)},_)),n(a,i({id:"when-not-to-apply-".concat(g,"-").concat(o),idPrefix:"condition-wnta",title:_.whenNotToApplyTitle||"When NOT to apply",required:!1,dividerRequired:!0,readOnly:t.isReadOnly||(null==_?void 0:_.isAiStreaming)||vi&&!M,conditions:t.whenNotToApplyConditions||[],onAdd:function(){return R.addWhenNotToApply(g,o)},onRemove:function(i,e,n){return R.removeWhenNotToApply(i,e,n)},onEdit:function(i,e,n,t){return R.editWhenNotToApply(i,e,n,t)},index:o,tierKey:g,isHighlighted:E.wnta||!1,highlightedIds:null==_?void 0:_.highlightedIds,tooltipDescription:"Why this Condition?",citations:ci("whenNotToApply_".concat(g,"_").concat(o)),bordered:!0,addLabel:"Add When NOT to apply",isAiStreaming:_.isAiStreaming},_)),n(d,i({id:"config-".concat(g,"-").concat(o),title:_.configTitle||"Configuration",required:!1,highlights:E,bordered:!0,readOnly:t.isReadOnly||(null==_?void 0:_.isAiStreaming)||vi&&(null==_?void 0:_.activeEditId)!=="config-".concat(g,"-").concat(o),onConfigChange:function(i,e){return R.onConfigChange(g,o,i,e)},separationItems:O,toggles:w,index:o},_)),(null===(D=t.reasoning)||void 0===D?void 0:D.configData)&&n("div",i({style:ui},{children:n(r,{citation:t.reasoning.configData,citations:ci("configData_".concat(g,"_").concat(o)),fieldName:"Configuration",fieldValue:"Proposed Configuration"})}))]}))}),C)}),"".concat(g,"-variant-").concat(o))})}))}),"tier-".concat(o))})]}))};export{m as CreateRule};
|
|
1
|
+
import{__assign as i}from"tslib";import{jsxs as n,jsx as e}from"react/jsx-runtime";import t,{useState as o,useEffect as l}from"react";import{InputDataReasoningCard as r}from"../../InputDataReasoningCard.js";import{ConditionSection as a}from"../../organisms/ConditionSection/ConditionSection.js";import{ConfigSection as d}from"../../organisms/ConfigSection/ConfigSection.js";import{ScopeSection as c}from"../../organisms/ScopeSection/ScopeSection.js";import{TextSection as u}from"../../organisms/TextSection/TextSection.js";import s from"../../AccordianSection.js";import{ButtonCognitiveIcon as v}from"../../_svg/ButtonCognitiveIcon.js";import{Loader2Icon as p,Pencil as f,Check as g,AlertTriangle as h}from"lucide-react";var y=function(o){var l=o.children,r=o.onAddVariant,a=o.isDisabled,d=o.showAddVariantBtn,c=void 0===d||d,u=t.Children.toArray(l);return n("div",i({style:{display:"flex",flexDirection:"column",alignItems:"flex-start"}},{children:[u.map(function(i,o){var l=!(o===u.length-1)||c;return n(t.Fragment,{children:[i,l&&e("div",{style:{width:"2px",height:"20px",backgroundColor:"#E2E8F0",marginLeft:"30px"}})]},o)}),c&&e("div",i({onClick:a?void 0:r,style:{padding:"8px 16px",border:"1px solid #E2E8F0",borderRadius:"8px",color:a?"#94a3b8":"#475569",fontSize:"14px",fontWeight:"500",cursor:a?"not-allowed":"pointer",backgroundColor:a?"#f8fafc":"#FFFFFF",opacity:a?.7:1,userSelect:"none",transition:"all 0.2s ease"}},{children:"Add Variant"}))]}))},m=function(m){var x,T,D,S,C,A,I,b,E,O,w,V=m.state,R=m.handlers,_=m.uiState,N=(null==_?void 0:_.highlights)||new Map,W=N.get("global_0")||{},F=o({}),M=F[0],j=F[1],B=o(null),k=B[0],L=B[1],z="rule-setup"===(null==_?void 0:_.activeEditId),q=t.useRef(new Map),P=o(null),H=P[0],J=P[1],K=o(null),$=K[0],U=K[1],Z=o(!1),G=Z[0],Q=Z[1],X=t.useRef(null==_?void 0:_.isAiStreaming);l(function(){X.current&&!(null==_?void 0:_.isAiStreaming)&&G&&Q(!1),X.current=null==_?void 0:_.isAiStreaming},[null==_?void 0:_.isAiStreaming,G]);var Y=function(){var i;J(null),U(null),null===(i=null==_?void 0:_.setActiveEditId)||void 0===i||i.call(_,null)},ii=function(){var i,n,e=null!=H?H:V.ruleTitle,t=null!=$?$:V.scopeData,o=e!==V.ruleTitle,l=JSON.stringify(t)!==JSON.stringify(V.scopeData);if(!o&&!l)return J(null),U(null),void(null===(i=null==_?void 0:_.setActiveEditId)||void 0===i||i.call(_,null));if(null==_?void 0:_.setSendMessageInChat){var r="sk-".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2,8)),a=[];if(o&&a.push((null==e?void 0:e.trim())?"Title with ".concat(e):"No Title"),l){var d=null==t?void 0:t.tiers,c=d&&d.length>0?"tiers: ".concat(d.join(", ")):"No Tier Selected";a.push(c)}var u=a.join(" and ");_.setSendMessageInChat("__SKELETON__:".concat(r,":Update Rule Setup ").concat(u))}Q(!0),J(null),U(null),null===(n=null==_?void 0:_.setActiveEditId)||void 0===n||n.call(_,null)},ni=null!==H?null==H?void 0:H.trim():(V.ruleTitle||"").trim(),ei=null!=$?$:V.scopeData,ti=ni!==(V.ruleTitle||"").trim(),oi=JSON.stringify(ei)!==JSON.stringify(V.scopeData),li=!ti&&!oi||""===ni,ri=t.useRef(null==_?void 0:_.defaultVariantOpen),ai=t.useRef(V.variantsByTier);t.useEffect(function(){var i,n,e,t,o=null,l=!1;if(ri.current!==(null==_?void 0:_.defaultVariantOpen)&&(l=!0,ri.current=null==_?void 0:_.defaultVariantOpen),l){if(null==(null==_?void 0:_.defaultVariantOpen)||(null==_?void 0:_.defaultVariantOpen)<0)return L(null),void(ai.current=V.variantsByTier);null===(n=null===(i=null==_?void 0:_.tierOptions)||void 0===i?void 0:i.filter(function(i){var n,e;return null===(e=null===(n=V.scopeData)||void 0===n?void 0:n.tiers)||void 0===e?void 0:e.includes(i)}))||void 0===n||n.forEach(function(i){var n,e=i.toLowerCase().replace(/ /g,"_");((null===(n=V.variantsByTier)||void 0===n?void 0:n[e])||[]).forEach(function(i,n){(null==_?void 0:_.defaultVariantOpen)===n&&(o="".concat(e,"-variant-").concat(n)),(null==_?void 0:_.autoScrollVariantIndex)===n&&(o="".concat(e,"-variant-").concat(n))})}),o&&L(o)}null===k&&(null==_?void 0:_.defaultVariantOpen)>=0&&(null===(t=null===(e=null==_?void 0:_.tierOptions)||void 0===e?void 0:e.filter(function(i){var n,e;return null===(e=null===(n=V.scopeData)||void 0===n?void 0:n.tiers)||void 0===e?void 0:e.includes(i)}))||void 0===t||t.forEach(function(i){var n,e=i.toLowerCase().replace(/ /g,"_");((null===(n=V.variantsByTier)||void 0===n?void 0:n[e])||[])[_.defaultVariantOpen]&&L("".concat(e,"-variant-").concat(_.defaultVariantOpen))})),ai.current=V.variantsByTier},[V.variantsByTier,null==_?void 0:_.defaultVariantOpen,null===(x=V.scopeData)||void 0===x?void 0:x.tiers,null==_?void 0:_.tierOptions,null==_?void 0:_.autoScrollVariantIndex]);var di=function(n){j(function(e){var t;return i(i({},e),((t={})[n]=!e[n],t))})},ci=function(i){var n,e,t,o=i.split("_"),l=o[o.length-1],r=/^\d+$/.test(l)?o.slice(0,-1).join("_"):i,a=null===(n=V.fieldCitations)||void 0===n?void 0:n[r];if(Array.isArray(a)&&a.length>0)return a;var d=null===(e=V.fieldCitations)||void 0===e?void 0:e[i];return Array.isArray(d)&&d.length>0?d:null!==(t=V.citations)&&void 0!==t?t:[]},ui={marginTop:"-17px",position:"relative",zIndex:1};l(function(){var i,n;null!=(null==_?void 0:_.autoScrollVariantIndex)&&(null===(n=null===(i=null==_?void 0:_.tierOptions)||void 0===i?void 0:i.filter(function(i){var n,e;return null===(e=null===(n=V.scopeData)||void 0===n?void 0:n.tiers)||void 0===e?void 0:e.includes(i)}))||void 0===n||n.forEach(function(i){var n=i.toLowerCase().replace(/ /g,"_"),e="".concat(n,"-variant-").concat(_.autoScrollVariantIndex),t=q.current.get(e);t&&requestAnimationFrame(function(){setTimeout(function(){t.scrollIntoView({behavior:"smooth",block:"center"})},300)})}))},[null==_?void 0:_.scrollTrigger]),console.log("CreateRule state:",V),console.log("CreateRule uiState:",_);var si=function(i){return i?i.replace(/_/g," ").replace(/([a-zA-Z])(\d)/g,"$1 $2").replace(/\b\w/g,function(i){return i.toUpperCase()}):"Variant 1"},vi=!!(null==_?void 0:_.activeEditId);return n("div",i({className:"traffic-manager-template"},{children:[e("div",i({"data-edit-id":"rule-setup"},{children:e(s,i({title:{type:"other",label:(null==_?void 0:_.setupLabel)||"Rule Setup"},actionButtons:function(n,t){if(z)return null;var o=!!(null==_?void 0:_.activeEditId)&&"rule-setup"!==_.activeEditId;return e("div",i({style:{position:"relative",display:"flex",flexDirection:"column"}},{children:e("button",i({title:o?"Save active edits first":"Edit",onClick:function(e){e.stopPropagation(),o?(null==_?void 0:_.setPendingEditId)&&_.setPendingEditId(_.activeEditId||null):(!function(){var n,e;(null==_?void 0:_.activeEditId)&&"rule-setup"!==_.activeEditId||(null===(n=null==_?void 0:_.setActiveEditId)||void 0===n||n.call(_,"rule-setup"),J(null!==(e=V.ruleTitle)&&void 0!==e?e:""),U(V.scopeData?i({},V.scopeData):{}))}(),(null==_?void 0:_.setPendingEditId)&&_.setPendingEditId(null),n||t())},disabled:G,style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",padding:"6px 8px",border:"1px solid #e5e7eb",borderRadius:"8px",cursor:G?"not-allowed":"pointer",backgroundColor:"#ffffff",color:"#6b7280",opacity:G?.5:1}},{children:e(f,{size:14})}))}))},footerData:{ruleTitle:V.ruleTitle,stations:[V.scopeData.station],tiers:null===(T=V.scopeData)||void 0===T?void 0:T.tiers},defaultOpen:"Create"===(null==_?void 0:_.usedFor),readOnly:"Create"!==(null==_?void 0:_.usedFor),isAiStreaming:null==_?void 0:_.isAiStreaming,editFlow:"Edit"===(null==_?void 0:_.usedFor)},{children:n("div",i({style:{display:"flex",flexDirection:"column",gap:"12px"}},{children:[G&&(null==_?void 0:_.isAiStreaming)&&n("div",i({style:{display:"flex",alignItems:"center",color:"#141414ff",fontSize:"13px",fontWeight:500,fontStyle:"italic",marginBottom:"8px",paddingLeft:"4px"}},{children:[e(p,{size:16,style:{marginRight:8,animation:"spin 1s linear infinite"}},"loader"),"Checking the correctness of your Rule Setup..."]})),e(u,i({id:"rule-title",title:_.ruleTitle||"Rule Title",rows:1,placeholder:"Enter a short, descriptive title for the learning",required:!0,value:z&&null!==H?H:V.ruleTitle,onChange:function(i){return z?J(i):R.setRuleTitle(i)},readOnly:(null==_?void 0:_.isAiStreaming)||!z,isOpen:M.ruleTitle,onToggle:function(){return di("ruleTitle")},isHighlighted:W.ruleTitle||!1,showCognitiveIcon:V.citation.ruleTitle,tooltipDescription:"Why this Title?",errorMessage:null===(D=_.validationErrors)||void 0===D?void 0:D.ruleTitle},_)),V.citation.ruleTitle&&e("div",i({style:ui},{children:e(r,{isVisible:M.ruleTitle,citation:V.citation.ruleTitle,citations:ci("ruleTitle"),fieldName:"Rule Title",fieldValue:V.ruleTitle})})),e(c,i({id:"scope",title:"",required:!1,scopeData:z&&null!==$?$:V.scopeData,onScopeChange:function(n,e){z?U(function(t){var o;return i(i({},null!=t?t:V.scopeData),((o={})[n]=e,o))}):R.onScopeChange(n,e)},tierLabel:"Which tiers should this learning apply to?",stationLabel:"Which scope should this learning belong to?",highlights:W,isOpen:M.scopeData,onToggle:function(){return di("scopeData")},showCognitiveIcon:V.citation.scopeData,cognitiveIcon:e(v,{}),tooltipDescription:"Why this Scope?",errorMessage:(null===(S=_.validationErrors)||void 0===S?void 0:S.station)||(null===(C=_.validationErrors)||void 0===C?void 0:C.tiers),stationErrorMessage:null===(A=_.validationErrors)||void 0===A?void 0:A.station,tierErrorMessage:null===(I=_.validationErrors)||void 0===I?void 0:I.tiers,readOnly:(null==_?void 0:_.isAiStreaming)||!z},_)),V.citation.scopeData&&e("div",i({style:ui},{children:e(r,{isVisible:M.scopeData,citation:V.citation.scopeData,citations:ci("scopeData"),fieldName:"Scope",fieldValue:null===(E=null===(b=V.scopeData)||void 0===b?void 0:b.tiers)||void 0===E?void 0:E.join(", ")})})),z?n("div",i({style:{display:"flex",flexDirection:"column",alignItems:"flex-start"}},{children:[n("div",i({style:{display:"flex",justifyContent:"flex-start",alignItems:"center",gap:"16px"}},{children:[e("button",i({onClick:Y,style:{background:"none",border:"none",color:"#6b7280",fontSize:"14px",fontWeight:"500",cursor:"pointer",padding:"0"}},{children:"Discard Changes"})),n("button",i({onClick:ii,disabled:li,style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",borderRadius:"12px",border:"none",backgroundColor:"#2563eb",color:"#ffffff",fontSize:"14px",fontWeight:"500",cursor:li?"not-allowed":"pointer",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.05)",opacity:li?.5:1}},{children:[e(g,{size:18,strokeWidth:2.5,color:"#ffffff"}),"Save Changes"]}))]})),"rule-setup"===(null==_?void 0:_.pendingEditId)&&n("div",i({style:{display:"flex",alignItems:"center",gap:"6px",marginTop:"8px"}},{children:[e(h,{style:{color:"#C2410C"}}),e("div",i({style:{display:"flex",color:"#C2410C",fontSize:"13px",paddingTop:"8px",alignItems:"center"}},{children:"Pending - Changes not applied yet. Apply or discard them to continue."}))]}))]})):null]}))}))})),null===(w=null===(O=null==_?void 0:_.tierOptions)||void 0===O?void 0:O.filter(function(i){var n,e;return null===(e=null===(n=V.scopeData)||void 0===n?void 0:n.tiers)||void 0===e?void 0:e.includes(i)}))||void 0===w?void 0:w.map(function(t,o,l){var c,v,p,f,g=t.toLowerCase().replace(/ /g,"_"),h=(null===(c=V.variantsByTier)||void 0===c?void 0:c[g])||[],m=h.length,x=!1;if(1===m){var T=h[0],D=!(null===(v=null==T?void 0:T.ruleDescription)||void 0===v?void 0:v.trim()),S=(null===(p=null==T?void 0:T.whenToApplyConditions)||void 0===p?void 0:p.some(function(i){return(null==i?void 0:i.text)&&""!==i.text.trim()}))||!1,C=(null===(f=null==T?void 0:T.whenNotToApplyConditions)||void 0===f?void 0:f.some(function(i){return(null==i?void 0:i.text)&&""!==i.text.trim()}))||!1;D&&!S&&!C&&(x=!0)}var A=x?void 0:"".concat(m," ").concat(1===m?"variant":"variants"," configured for this tier"),I=!((null==_?void 0:_.defaultTierOpen)>=0)||o===_.defaultTierOpen;return console.log("Rendering tier : ",t),e(s,i({variant:"tier-header",title:{type:"other",label:t},subtitle:A,defaultOpen:I,footerData:{description:"Variants for ".concat(t)}},{children:e(y,i({onAddVariant:function(){var i;return null===(i=R.addNewVariant)||void 0===i?void 0:i.call(R,g)},isDisabled:null==_?void 0:_.isAiStreaming,showAddVariantBtn:"Edit"!==(null==_?void 0:_.usedFor)},{children:h.map(function(t,o){var l,c,v,p,f,h,y,m,x,T,D,S=t.variantType||"default",C="".concat(g,"-variant-").concat(o),A=!0===t.is_variant,I="default"===S||"default_variant"===S;(null==_?void 0:_.defaultVariantOpen)>=0&&_.defaultVariantOpen;var b="".concat(g,"_").concat(o),E=N.get(b)||{},O=(null===(c=null===(l=_.separationItemsByTier)||void 0===l?void 0:l[g])||void 0===c?void 0:c.get(o))||[],w=(null===(p=null===(v=_.togglesByTier)||void 0===v?void 0:v[g])||void 0===p?void 0:p.get(o))||[];(null==_?void 0:_.autoScrollVariantIndex)===o||t.is_variant,console.log("Rendering ".concat(g," variant ").concat(o,":"),t),console.log("Rendering Variant : ",t),console.log("Open Accordion ID:",k,"Current Variant ID:",C);var W=null===(f=null==_?void 0:_.activeEditId)||void 0===f?void 0:f.startsWith("condition-wta-".concat(g,"-").concat(o)),F=null===(h=null==_?void 0:_.activeEditId)||void 0===h?void 0:h.startsWith("condition-wnta-".concat(g,"-").concat(o));return e("div",i({ref:function(i){i?q.current.set(C,i):q.current.delete(C)},style:{width:"100%"}},{children:e(s,i({title:{type:I?"default":"variant",label:si(S),number:o+1,isNewVariant:A,isDefault:t.isDefault,isModified:t.isModified},defaultOpen:!0,expanded:k===C,onToggle:function(){var i,n=k===C;console.log("is closing:",n),L(n?null:C),null===(i=null==_?void 0:_.setActiveVariantAccordionIndex)||void 0===i||i.call(_,n?null:o)},variant:"rule-behavior",footerData:{ruleTitle:S,description:t.ruleDescription||""}},{children:n("div",i({style:{display:"flex",flexDirection:"column",gap:"12px"}},{children:[e(u,i({id:"rule-description-".concat(g,"-").concat(o),title:_.ruleDescriptionTitle||"Rule Description",rows:2,placeholder:"Explain the learning behaviour",required:!0,readOnly:t.isReadOnly||(null==_?void 0:_.isAiStreaming)||vi&&(null==_?void 0:_.activeEditId)!=="rule-description-".concat(g,"-").concat(o),value:t.ruleDescription||"",onChange:function(i){return R.setRuleDescription(g,o,i)},isOpen:M["ruleDescription-".concat(g)],onToggle:function(){return di("ruleDescription-".concat(g))},isHighlighted:E.ruleDescription||!1,showCognitiveIcon:null===(y=V.citation)||void 0===y?void 0:y["ruleDescription_".concat(g)],tooltipDescription:"Why this Description?",errorMessage:null===(m=_.validationErrors)||void 0===m?void 0:m["ruleDescription-".concat(g,"-").concat(o)],enableInlineEdit:!0,setSendMessageInChat:null==_?void 0:_.setSendMessageInChat,isAiStreaming:null==_?void 0:_.isAiStreaming,fieldName:"Rule Description"},_)),(null===(x=V.citation)||void 0===x?void 0:x["ruleDescription_".concat(g)])&&e("div",i({style:ui},{children:e(r,{isVisible:M["ruleDescription-".concat(g)],citation:V.citation["ruleDescription_".concat(g)],citations:ci("ruleDescription_".concat(g,"_").concat(o)),fieldName:"Rule Description",fieldValue:t.ruleDescription})})),e(a,i({id:"when-to-apply-".concat(g,"-").concat(o),idPrefix:"condition-wta",title:_.whenToApplyTitle||"When to apply",required:!0,dividerRequired:!0,readOnly:t.isReadOnly||(null==_?void 0:_.isAiStreaming)||vi&&!W,conditions:t.whenToApplyConditions||[],onAdd:function(){return R.addWhenToApply(g,o)},onRemove:function(i,n,e){return R.removeWhenToApply(i,n,e)},onEdit:function(i,n,e,t){return R.editWhenToApply(i,n,e,t)},index:o,tierKey:g,isHighlighted:E.wta||!1,highlightedIds:null==_?void 0:_.highlightedIds,tooltipDescription:"Why this Condition?",citations:ci("whenToApply_".concat(g,"_").concat(o)),bordered:!0,addLabel:"Add When to apply",isAiStreaming:_.isAiStreaming,errorMessage:(null===(T=_.validationErrors)||void 0===T?void 0:T["whenToApply-".concat(g,"-").concat(o)])||(null==_?void 0:_.conflictReason)},_)),e(a,i({id:"when-not-to-apply-".concat(g,"-").concat(o),idPrefix:"condition-wnta",title:_.whenNotToApplyTitle||"When NOT to apply",required:!1,dividerRequired:!0,readOnly:t.isReadOnly||(null==_?void 0:_.isAiStreaming)||vi&&!F,conditions:t.whenNotToApplyConditions||[],onAdd:function(){return R.addWhenNotToApply(g,o)},onRemove:function(i,n,e){return R.removeWhenNotToApply(i,n,e)},onEdit:function(i,n,e,t){return R.editWhenNotToApply(i,n,e,t)},index:o,tierKey:g,isHighlighted:E.wnta||!1,highlightedIds:null==_?void 0:_.highlightedIds,tooltipDescription:"Why this Condition?",citations:ci("whenNotToApply_".concat(g,"_").concat(o)),bordered:!0,addLabel:"Add When NOT to apply",isAiStreaming:_.isAiStreaming},_)),e(d,i({id:"config-".concat(g,"-").concat(o),title:_.configTitle||"Configuration",required:!1,highlights:E,bordered:!0,readOnly:t.isReadOnly||(null==_?void 0:_.isAiStreaming)||vi&&(null==_?void 0:_.activeEditId)!=="config-".concat(g,"-").concat(o),onConfigChange:function(i,n){return R.onConfigChange(g,o,i,n)},separationItems:O,toggles:w,index:o},_)),(null===(D=t.reasoning)||void 0===D?void 0:D.configData)&&e("div",i({style:ui},{children:e(r,{citation:t.reasoning.configData,citations:ci("configData_".concat(g,"_").concat(o)),fieldName:"Configuration",fieldValue:"Proposed Configuration"})}))]}))}),C)}),"".concat(g,"-variant-").concat(o))})}))}),"tier-".concat(o))})]}))};export{m as CreateRule};
|
|
2
2
|
//# sourceMappingURL=CreateRule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccordianSection.d.ts","sourceRoot":"","sources":["../../../../../../src/features/IL-OTJ/_components/AccordianSection.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AccordianSection.d.ts","sourceRoot":"","sources":["../../../../../../src/features/IL-OTJ/_components/AccordianSection.tsx"],"names":[],"mappings":"AAIA,KAAK,UAAU,GACT;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GACrG;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GACrH;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAE1G,UAAU,UAAU;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,QAAA,MAAM,gBAAgB;WAcX,UAAU;;cAEP,MAAM,SAAS;;;;;;sBAMR,IAAI;8BACI,OAAO,YAAY,MAAM,IAAI,KAAK,MAAM,SAAS;;;6CAuP7E,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatComponent.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/IL-OTJ/_components/ChatComponents/ChatComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6E,MAAM,OAAO,CAAC;AAqClG,UAAU,kBAAkB;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACnE,yBAAyB,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3C,iBAAiB,EAAE,OAAO,CAAC;IAC3B,qBAAqB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACrE,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IACpE,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC,qBAAqB,EAAE,GAAG,CAAC;IAC3B,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,aAAa,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IAC9D,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAC9D,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IACnE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oDAAoD;IACpD,sBAAsB,CAAC,EAAE,CAAC,WAAW,EAAE,OAAO,KAAK,IAAI,CAAC;IACxD,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,qBAAqB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACvE,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,WAAW,CAAC,EAAE;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;KACf,CAAA;IACD,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AACD,eAAO,MAAM,kBAAkB,aAAc,MAAM,cAAc,MAAM,iBAsBtE,CAAC;AAEF,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"ChatComponent.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/IL-OTJ/_components/ChatComponents/ChatComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6E,MAAM,OAAO,CAAC;AAqClG,UAAU,kBAAkB;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACnE,yBAAyB,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3C,iBAAiB,EAAE,OAAO,CAAC;IAC3B,qBAAqB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACrE,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IACpE,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC,qBAAqB,EAAE,GAAG,CAAC;IAC3B,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,aAAa,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IAC9D,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAC9D,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IACnE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oDAAoD;IACpD,sBAAsB,CAAC,EAAE,CAAC,WAAW,EAAE,OAAO,KAAK,IAAI,CAAC;IACxD,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,qBAAqB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACvE,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,WAAW,CAAC,EAAE;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;KACf,CAAA;IACD,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AACD,eAAO,MAAM,kBAAkB,aAAc,MAAM,cAAc,MAAM,iBAsBtE,CAAC;AAEF,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA+iD/C,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
package/dist/types/src/features/IL-OTJ/_components/templates/TrafficManager/CreateRule.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateRule.d.ts","sourceRoot":"","sources":["../../../../../../../../src/features/IL-OTJ/_components/templates/TrafficManager/CreateRule.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CreateRule.d.ts","sourceRoot":"","sources":["../../../../../../../../src/features/IL-OTJ/_components/templates/TrafficManager/CreateRule.tsx"],"names":[],"mappings":"AA6DA,eAAO,MAAM,UAAU,iCAAkC,GAAG,4CAqpB3D,CAAC"}
|