@e-llm-studio/instant-learning 0.0.259 → 0.0.261

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/cjs/features/DocumentLearning/InstantLearning.module.css.js +1 -1
  2. package/dist/cjs/features/IL-OTJ/InstantLearning.module.css.js +1 -1
  3. package/dist/cjs/features/IL-OTJ/_components/AccordianSection.js +1 -1
  4. package/dist/cjs/features/IL-OTJ/_components/ChatComponents/ChatComponent.js +1 -1
  5. package/dist/cjs/features/IL-OTJ/_components/ChatComponents/ChatComponent.module.css.js +1 -1
  6. package/dist/cjs/features/IL-OTJ/_components/ChatComponents/ChatHeader.module.css.js +1 -1
  7. package/dist/cjs/features/IL-OTJ/_components/CriticalGaps.js +1 -1
  8. package/dist/cjs/features/IL-OTJ/_components/MessageRendering/MessageRendering.js +1 -1
  9. package/dist/cjs/features/IL-OTJ/_components/atoms/SkeletonLoader/SkeletonLoader.module.css.js +1 -1
  10. package/dist/cjs/features/IL-OTJ/_components/molecules/Condition/ConditionList.js +1 -1
  11. package/dist/cjs/features/IL-OTJ/_components/organisms/ConditionSection/ConditionSection.js +1 -1
  12. package/dist/cjs/features/IL-OTJ/_components/templates/RuleComparison/RuleComparison.js +1 -1
  13. package/dist/cjs/features/IL-OTJ/_components/templates/TrafficManager/CreateRule.js +1 -1
  14. package/dist/cjs/features/IL-OTJ/helpers/message-rendering-utils.js +1 -1
  15. package/dist/cjs/features/InstantLearning/InstantLearning.module.css.js +1 -1
  16. package/dist/cjs/features/WtaWnta/WtaWnta.module.css.js +1 -1
  17. package/dist/cjs/node_modules/style-inject/dist/style-inject.es.js +2 -0
  18. package/dist/cjs/node_modules/style-inject/dist/style-inject.es.js.map +1 -0
  19. package/dist/features/DocumentLearning/InstantLearning.module.css.js +1 -1
  20. package/dist/features/IL-OTJ/InstantLearning.module.css.js +1 -1
  21. package/dist/features/IL-OTJ/_components/AccordianSection.js +1 -1
  22. package/dist/features/IL-OTJ/_components/ChatComponents/ChatComponent.js +1 -1
  23. package/dist/features/IL-OTJ/_components/ChatComponents/ChatComponent.module.css.js +1 -1
  24. package/dist/features/IL-OTJ/_components/ChatComponents/ChatHeader.module.css.js +1 -1
  25. package/dist/features/IL-OTJ/_components/CriticalGaps.js +1 -1
  26. package/dist/features/IL-OTJ/_components/MessageRendering/MessageRendering.js +1 -1
  27. package/dist/features/IL-OTJ/_components/atoms/SkeletonLoader/SkeletonLoader.module.css.js +1 -1
  28. package/dist/features/IL-OTJ/_components/molecules/Condition/ConditionList.js +1 -1
  29. package/dist/features/IL-OTJ/_components/organisms/ConditionSection/ConditionSection.js +1 -1
  30. package/dist/features/IL-OTJ/_components/templates/RuleComparison/RuleComparison.js +1 -1
  31. package/dist/features/IL-OTJ/_components/templates/TrafficManager/CreateRule.js +1 -1
  32. package/dist/features/IL-OTJ/helpers/message-rendering-utils.js +1 -1
  33. package/dist/features/InstantLearning/InstantLearning.module.css.js +1 -1
  34. package/dist/features/WtaWnta/WtaWnta.module.css.js +1 -1
  35. package/dist/node_modules/style-inject/dist/style-inject.es.js +2 -0
  36. package/dist/node_modules/style-inject/dist/style-inject.es.js.map +1 -0
  37. package/dist/types/src/features/IL-OTJ/_components/AccordianSection.d.ts +2 -1
  38. package/dist/types/src/features/IL-OTJ/_components/AccordianSection.d.ts.map +1 -1
  39. package/dist/types/src/features/IL-OTJ/_components/ChatComponents/ChatComponent.d.ts.map +1 -1
  40. package/dist/types/src/features/IL-OTJ/_components/CriticalGaps.d.ts.map +1 -1
  41. package/dist/types/src/features/IL-OTJ/_components/MessageRendering/MessageRendering.d.ts.map +1 -1
  42. package/dist/types/src/features/IL-OTJ/_components/NewMinimizedThinkingSteps.d.ts.map +1 -1
  43. package/dist/types/src/features/IL-OTJ/_components/WatchMeWork/Usethinkingsteps.d.ts +1 -1
  44. package/dist/types/src/features/IL-OTJ/_components/WatchMeWork/Usethinkingsteps.d.ts.map +1 -1
  45. package/dist/types/src/features/IL-OTJ/_components/molecules/Condition/ConditionList.d.ts +2 -1
  46. package/dist/types/src/features/IL-OTJ/_components/molecules/Condition/ConditionList.d.ts.map +1 -1
  47. package/dist/types/src/features/IL-OTJ/_components/organisms/ConditionSection/ConditionSection.d.ts +1 -1
  48. package/dist/types/src/features/IL-OTJ/_components/organisms/ConditionSection/ConditionSection.d.ts.map +1 -1
  49. package/dist/types/src/features/IL-OTJ/_components/templates/RuleComparison/RuleComparison.d.ts.map +1 -1
  50. package/dist/types/src/features/IL-OTJ/_components/templates/TrafficManager/CreateRule.d.ts.map +1 -1
  51. package/dist/types/src/features/IL-OTJ/helpers/message-rendering-utils.d.ts.map +1 -1
  52. package/package.json +2 -2
@@ -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"),i=require("@mui/material"),r=require("lucide-react"),o=require("../../_svg/SparkleIcon.js"),s=require("@e-llm-studio/citation"),l=require("../../_svg/ButtonCognitiveIcon.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=function(e,n){if(!n)return null;var t=new RegExp("<".concat(e,"[^>]*>([\\s\\S]*?)<\\/").concat(e,">"),"i"),i=n.match(t);return i?i[1].replace(/\\n/g,"\n"):null},d=function(e,n,t){var i=100*e;if(!t)return{bg:"#FFFFFF",border:"#E2E8F0",badgeBg:"#F1F5F9",badgeBorder:"#CBD5E1",badgeText:"#64748B",highlightBg:"transparent",label:"Not Defined"};var r=function(e){return e&&"null"!==e.toLowerCase()?e.split("_").map(function(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}).join(" "):"Different"}(n);return i>=70?{bg:"#FEF2F2",border:"#FEE2E2",badgeBg:"#FEF2F2",badgeBorder:"#FECACA",badgeText:"#B91C1C",highlightBg:"#FECACA",label:r}:i>=40?{bg:"#FFFCF6",border:"#FFDD80",badgeBg:"#FEF9C3",badgeBorder:"#FEF08A",badgeText:"#A16207",highlightBg:"#FDDEB3",label:r}:{bg:"#FFFFFF",border:"#E2E8F0",badgeBg:"#F1F5F9",badgeBorder:"#CBD5E1",badgeText:"#64748B",highlightBg:"transparent",label:r}},p=a(t).default.forwardRef(function(t,r){var o=t.label,s=t.content,l=t.highlights,a=void 0===l?[]:l,c=t.styleVariant,d=t.isHighlighted,p=void 0!==d&&d,x=Array.isArray(s)?s.join("\n"):s||"",g="#B91C1C"===c.badgeText?{borderColor:"#EF4444",shadow:"rgba(239, 68, 68, 0.25)"}:"#A16207"===c.badgeText?{borderColor:"#F59E0B",shadow:"rgba(245, 158, 11, 0.25)"}:{borderColor:"#6366F1",shadow:"rgba(99, 102, 241, 0.25)"};return n.jsxs(i.Box,e.__assign({sx:{mb:1.5}},{children:[n.jsx(i.Typography,e.__assign({sx:{fontSize:"12px",color:"#19213D",mb:.5,fontWeight:500,lineHeight:"130%"}},{children:o})),n.jsx(i.Box,e.__assign({ref:r,sx:{p:"4px 12px",borderRadius:"6px",border:p?"1.5px solid ".concat(g.borderColor):"1px solid ".concat(c.border),boxShadow:p?"0px 0px 0px 2px ".concat(g.shadow):"none",bgcolor:c.bg,fontSize:"13px",color:"#0B0E1A",lineHeight:1.4,minHeight:"24px",display:"flex",alignItems:"center",whiteSpace:"pre-line",wordBreak:"break-word"}},{children:n.jsx(i.Box,{children:function(){if(!x)return n.jsx(i.Typography,e.__assign({sx:{color:"#94A3B8",fontSize:"12px",fontStyle:"italic"}},{children:"Not Defined"}));if(!a||0===a.length)return x;var t=a.filter(function(e){return e&&e.length>0}).map(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});if(0===t.length)return x;var r=new RegExp("(".concat(t.join("|"),")"),"gi");return x.split(r).map(function(t,r){return a.some(function(e){return e&&e.toLowerCase()===t.toLowerCase()})?n.jsx(i.Box,e.__assign({component:"span",sx:{bgcolor:c.highlightBg,borderRadius:"2px",px:"2px"}},{children:t}),r):t})}()})}))]}))}),x=function(t){var r=t.data,o=t.isSelected,s=t.isCognitiveOpen,a=t.onToggleCognitive,c=t.onClick,d=r.summaryText||r.description||"",p=d.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),x=p?d.replace(p[0],"").trim():d,g=!!p;return n.jsxs(i.Box,e.__assign({id:"variant-card-".concat(r.id),onClick:c,sx:{minWidth:"280px",maxWidth:"280px",p:2,m:.5,bgcolor:o?"#EFF6FF99":"#FFFFFF",borderRadius:"8px",cursor:"pointer",transition:"all 0.2s",display:"flex",flexDirection:"column",gap:1,flexShrink:0,opacity:r.isLoading?.7:1,border:o?"1.4px solid #2563EB":null,boxShadow:o?"none":"0px 2px 4px 0px #19213D14","&:hover":{borderColor:o?"#2563EB":"#CBD5E1",boxShadow:o?"none":"0px 4px 8px 0px #19213D1F"}}},{children:[n.jsx(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1.5}},{children:r.isLoading?n.jsx(i.Skeleton,{variant:"rounded",width:80,height:20}):n.jsxs(i.Box,e.__assign({sx:{bgcolor:"#FEF2F2",color:"#B91C1C",fontSize:"11px",fontWeight:600,px:1,py:.5,borderRadius:"100px",border:"1px solid #FFE1E1"}},{children:[void 0!==r.similarity?r.similarity:0,"% Similarity"]}))})),n.jsxs(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:1}},{children:[n.jsxs(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"nowrap"}},{children:[n.jsx(i.Typography,e.__assign({title:r.title,sx:{fontWeight:500,fontSize:"14px",color:"#19213D",lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block"}},{children:r.title})),r.scope&&n.jsx(i.Box,e.__assign({sx:{flexShrink:0,fontSize:"10px",fontWeight:600,color:"#19213D",bgcolor:"#FFF",border:"1px solid #EDEFF2",px:.75,py:.25,borderRadius:"6px",lineHeight:1.4,whiteSpace:"nowrap"}},{children:r.scope}))]})),r.isLoading?n.jsxs(i.Box,{children:[n.jsx(i.Skeleton,{width:"90%"}),n.jsx(i.Skeleton,{width:"60%"})]}):n.jsxs(i.Box,e.__assign({title:x,sx:{display:"flex",flexDirection:"column",gap:.5}},{children:[n.jsx(i.Typography,e.__assign({sx:{fontWeight:400,fontSize:"13px",color:"#666F8D",lineHeight:1.4,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis"}},{children:x})),g&&n.jsxs(i.Box,e.__assign({onClick:function(e){e.stopPropagation(),o||c(),a()},sx:{display:"inline-flex",alignItems:"center",alignSelf:"flex-start",gap:"4px",padding:"2px 6px",borderRadius:"4px",cursor:"pointer",transition:"all 0.2s ease",marginLeft:"-4px","&:hover":{backgroundColor:"#F1F5F9"}}},{children:[n.jsx("div",e.__assign({style:{width:"13px",height:"13px",display:"flex",alignItems:"center"}},{children:n.jsx(l.ButtonCognitiveIcon,{})})),n.jsx("svg",e.__assign({width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#4B5563",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:o&&s?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease"}},{children:n.jsx("path",{d:"M6 9l6 6 6-6"})}))]}))]}))]}))]}))};exports.default=function(a){var g,h,u=a.proposedRule,f=a.variants,_=void 0===f?[]:f,y=a.onSelectVariant;a.onAddAsVariant;var b=a.onSkip,m=a.onBack,v=a.targetVariantId,w=a.highlightedField,F=t.useState(v||null),B=F[0],j=F[1],C=t.useState(!1),E=C[0],S=C[1],k=t.useState(null),A=k[0],R=k[1],T=t.useRef(null),D=t.useRef(null);t.useEffect(function(){if(v&&j(v),R(null!=w?w:null),w){var e=setTimeout(function(){return R(null)},6e3);return function(){return clearTimeout(e)}}},[v,w]);var I=function(e){T.current&&T.current.scrollBy({left:"left"===e?-300:300,behavior:"smooth"})},L=t.useMemo(function(){return e.__spreadArray([],_,!0).sort(function(e,n){return(n.similarity||0)-(e.similarity||0)})},[_]),W=t.useMemo(function(){if(B){var e=String(B).trim();return _.find(function(n){return n.id&&String(n.id).trim()===e})||L[0]}return L.length>0?L[0]:null},[B,_,L]);t.useEffect(function(){if(B&&T.current){var e=B.trim();setTimeout(function(){var n=document.getElementById("variant-card-".concat(e)),t=T.current;if(n&&t){var i=n.offsetLeft-t.offsetLeft-t.clientWidth/2+n.clientWidth/2;t.scrollTo({left:i,behavior:"smooth"})}},150)}},[B,L]);var z=W||{title:"",scope:"",description:"",wta:"",wnta:"",variantType:"Default"},H=null==W?void 0:W.analysis,M=(null===(h=null===(g=null==H?void 0:H.rule_difference_comparison)||void 0===g?void 0:g.summary)||void 0===h?void 0:h.overall_summary)||"",O=M.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),q=!!O,V=O?O[1]:"",N=c("reason",V)||"",P=c("gap",V)||"",U=c("relevance_score",V)||"",Y=t.useMemo(function(){return{ul:function(t){t.node;var i=e.__rest(t,["node"]);return n.jsx("ol",e.__assign({},i,{style:{paddingLeft:"1.25rem",listStyleType:"decimal",margin:0}}))},li:function(t){t.node;var i=e.__rest(t,["node"]);return n.jsx("li",e.__assign({},i,{style:{marginBottom:"4px",listStyleType:"decimal"}},{children:i.children}))},ol:function(t){t.node;var i=e.__rest(t,["node"]);return n.jsx("li",e.__assign({},i,{style:{marginBottom:"4px",listStyleType:"decimal"}},{children:i.children}))},a:function(t){var i=t.href,r=t.children,o=e.__rest(t,["href","children"]);if(!i)return n.jsx("a",e.__assign({},o,{children:r}));var s=i||"";try{s=decodeURIComponent(i)}catch(e){console.error("Error decoding href",e)}if(s.includes("variant_id=")){var l="",a="",c=s.match(/variant_id=([^?&]+)/);c&&(l=c[1]);var d=s.match(/field_name=([^&]+)/);return d&&(a=d[1]),n.jsxs("button",e.__assign({type:"button",onClick:function(e){e.preventDefault(),e.stopPropagation(),j(l),R(a),setTimeout(function(){return R(null)},6e3)},style:{background:"none",border:"none",outline:"none",borderRadius:"6px",padding:"1px 4px",color:"#0F172A",cursor:"pointer",fontSize:"13px",fontWeight:500,display:"inline-flex",alignItems:"center",gap:"2px",margin:"0 1px",verticalAlign:"baseline",textDecoration:"none",boxShadow:"none",WebkitAppearance:"none",MozAppearance:"none"},title:"View Comparison"},{children:[r,n.jsx("svg",e.__assign({width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:n.jsx("path",{d:"M10.2082 8.67708H2.0415M2.0415 8.67708L4.08317 6.63542M2.0415 8.67708L4.08317 10.7188M2.0415 3.57292H10.2082M10.2082 3.57292L8.1665 1.53125M10.2082 3.57292L8.1665 5.61458",stroke:"#0F172A",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}))]}))}return n.jsx("a",e.__assign({href:i,target:"_blank",rel:"noopener noreferrer",style:{color:"#7C3AED"}},o,{children:r}))}}},[]);t.useEffect(function(){!B&&!v&&L.length>0&&!L[0].isLoading&&j(L[0].id)},[L,B,v]);var $=t.useRef(null),J=t.useState([]),X=J[0],G=J[1],K=t.useState(!1),Q=K[0],Z=K[1],ee=t.useState(!1),ne=ee[0],te=ee[1];t.useEffect(function(){var e=T.current;if(e){var n=function(){Z(e.scrollLeft>0),te(e.scrollLeft+e.clientWidth<e.scrollWidth-1)};return n(),e.addEventListener("scroll",n),window.addEventListener("resize",n),function(){e.removeEventListener("scroll",n),window.removeEventListener("resize",n)}}},[L]);var ie={title:t.useRef(null),scope:t.useRef(null),description:t.useRef(null),wta:t.useRef(null),wnta:t.useRef(null)},re={title:t.useRef(null),scope:t.useRef(null),description:t.useRef(null),wta:t.useRef(null),wnta:t.useRef(null)};t.useEffect(function(){if(A){var e="when_to_apply"===A?"wta":"when_not_to_apply"===A?"wnta":A,n=ie[e]||re[e];n&&n.current&&setTimeout(function(){n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}},[A]);var oe=function(e){var n,t,i,r,o,s=null===(n=null==H?void 0:H.rule_difference_comparison)||void 0===n?void 0:n.fields,l="when_to_apply"===e?"wta":"when_not_to_apply"===e?"wnta":e,a=!(!u[l]&&!z[l]);if(!s||!s[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var c=s[e];if(c.mappings){var d=c.mappings[0]||{};return{score:c.score,relation:d.relation||"",highlightsA:(null===(t=d.highlights)||void 0===t?void 0:t.ruleA_spans)||[],highlightsB:(null===(i=d.highlights)||void 0===i?void 0:i.ruleB_spans)||[],hasContent:a}}return{score:c.score,relation:c.relation||"",highlightsA:(null===(r=c.highlights)||void 0===r?void 0:r.ruleA_spans)||[],highlightsB:(null===(o=c.highlights)||void 0===o?void 0:o.ruleB_spans)||[],hasContent:a}},se=["title","scope","description","when_to_apply","when_not_to_apply"],le=function(){if($.current){var e=$.current.getBoundingClientRect(),n=[];se.forEach(function(t){var i="when_to_apply"===t?ie.wta:"when_not_to_apply"===t?ie.wnta:ie[t],r="when_to_apply"===t?re.wta:"when_not_to_apply"===t?re.wnta:re[t];if(i.current&&r.current){i.current.style.height="auto",r.current.style.height="auto";var o=i.current.getBoundingClientRect(),s=r.current.getBoundingClientRect(),l=Math.max(o.height,s.height);i.current.style.height="".concat(l,"px"),r.current.style.height="".concat(l,"px");var a=i.current.getBoundingClientRect(),c=r.current.getBoundingClientRect(),p=oe(t),x=d(p.score,p.relation,p.hasContent),g=a.top+a.height/2-e.top;n.push({x1:a.right-e.left,y1:g,x2:c.left-e.left,y2:g,style:x})}}),G(n)}};return t.useEffect(function(){var e=setTimeout(le,250);window.addEventListener("resize",le);var n=null;return $.current&&(n=new ResizeObserver(function(){window.requestAnimationFrame(function(){le()})})).observe($.current),function(){clearTimeout(e),window.removeEventListener("resize",le),n&&n.disconnect()}},[u,z,H,E]),n.jsxs(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"hidden"}},{children:[n.jsxs(i.Box,e.__assign({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF",border:"1.5px solid #EEF0F4"}},{children:[n.jsxs(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1}},{children:[n.jsx(i.IconButton,e.__assign({onClick:m,size:"small"},{children:n.jsx(r.ArrowLeft,{})})),n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:450,color:"#0F172A"}},{children:"Rule Comparison"}))]})),n.jsx(i.IconButton,e.__assign({onClick:b,size:"small"},{children:n.jsx(i.Box,e.__assign({sx:{fontSize:24,lineHeight:.5}},{children:"×"}))}))]})),L.length>1&&n.jsxs(i.Box,e.__assign({sx:{px:3,pb:.25}},{children:[n.jsxs(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",justifyContent:"space-between",py:1}},{children:[n.jsx(i.Typography,e.__assign({sx:{fontSize:"13px",color:"#475569"}},{children:"Choose the Learning you want to compare with the rule you are creating."})),n.jsxs(i.Box,e.__assign({sx:{display:"flex",gap:.5,flexShrink:0,ml:1}},{children:[n.jsx(i.IconButton,e.__assign({onClick:function(){return I("left")},size:"small",disabled:!Q},{children:n.jsx(r.ArrowLeft,{size:18})})),n.jsx(i.IconButton,e.__assign({onClick:function(){return I("right")},size:"small",disabled:!ne},{children:n.jsx(r.ArrowRight,{size:18})}))]}))]})),n.jsx(i.Box,e.__assign({ref:T,sx:{display:"flex",gap:1,overflowX:"auto",pb:.05,"&::-webkit-scrollbar":{height:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"transparent",borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:"transparent"}}},{children:L.map(function(e){return n.jsx(x,{data:e,isSelected:(null==W?void 0:W.id)===e.id,isCognitiveOpen:E,onToggleCognitive:function(){S(function(e){var n=!e;return n&&D.current&&D.current.scrollTo({top:0,behavior:"smooth"}),n})},onClick:function(){return j((n=e).id),y(n),void S(!1);var n}},e.id)})}))]})),n.jsx(i.Box,e.__assign({ref:D,sx:{flex:1,overflowY:"auto",py:1.5,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",borderTop:M&&q&&E?"none":"1.5px solid #EEF0F4"}},{children:n.jsxs(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"}},{children:[M&&q&&E&&n.jsx(i.Box,e.__assign({sx:{width:"100%",pb:1,animation:"fadeIn 0.2s ease-out","& > div > button":{display:"none !important"},"& > div > div":{marginTop:"0px"}}},{children:n.jsx(s.CognitiveDecisioningCard,{headerIcon:n.jsx(l.ButtonCognitiveIcon,{}),reasoning:N,gap:P,score:U,mdComponents:Y,isOpen:!0,onToggle:function(){return S(!1)}})})),n.jsxs(i.Box,e.__assign({ref:$,sx:{display:"grid",gridTemplateColumns:"1fr auto 1fr",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative"}},{children:[n.jsx("svg",e.__assign({style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",zIndex:10}},{children:X.map(function(t,r){var o=(t.x1+t.x2)/2,s=t.y1;return n.jsxs("g",{children:[n.jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.badgeBorder,strokeWidth:"1"}),n.jsx("foreignObject",e.__assign({x:o-125,y:s-16,width:"250",height:"32"},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n.jsx(i.Box,e.__assign({sx:{fontSize:"11px",bgcolor:t.style.badgeBg,color:t.style.badgeText,border:"1px solid ".concat(t.style.badgeBorder),borderRadius:"12px",px:1.5,py:.25,fontWeight:500,textAlign:"center",whiteSpace:"nowrap"}},{children:t.style.label}))}))}))]},r)})})),n.jsxs(i.Box,e.__assign({sx:{border:"1px dashed #B0B0B0",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)",minWidth:0}},{children:[n.jsx(i.Box,e.__assign({sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px dashed #B0B0B0",borderRadius:"8px 8px 0 0",display:"flex",minHeight:"24px",alignItems:"center"}},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#19213D"}},{children:"Rule You’re Creating"}))})),n.jsx(i.Box,e.__assign({sx:{p:"12px",display:"flex",flexDirection:"column"}},{children:se.map(function(e){var t=oe(e),i=d(t.score,t.relation,t.hasContent),r="when_to_apply"===e?ie.wta:"when_not_to_apply"===e?ie.wnta:ie[e],o=u["when_to_apply"===e?"wta":"when_not_to_apply"===e?"wnta":e];return n.jsx(p,{ref:r,label:"when_to_apply"===e?"When to apply":"when_not_to_apply"===e?"When NOT to Apply":e.charAt(0).toUpperCase()+e.slice(1).replace("_"," "),content:o,highlights:t.highlightsA,styleVariant:i,isHighlighted:A===e},"left-".concat(e))})}))]})),n.jsx(i.Box,{sx:{width:"1px"}}),n.jsxs(i.Box,e.__assign({sx:{border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0}},{children:[n.jsx(i.Box,e.__assign({sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"24px",display:"flex",alignItems:"center"}},{children:n.jsxs(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",display:"flex",alignItems:"center",gap:1}},{children:[n.jsx("div",e.__assign({style:{width:"18px",height:"18px",display:"flex",alignItems:"center",justifyContent:"center"}},{children:n.jsx(o.default,{})})),"Existing Rule"]}))})),n.jsx(i.Box,e.__assign({sx:{p:"12px",display:"flex",flexDirection:"column"}},{children:se.map(function(e){var t=oe(e),i=d(t.score,t.relation,t.hasContent),r="when_to_apply"===e?re.wta:"when_not_to_apply"===e?re.wnta:re[e],o=z["when_to_apply"===e?"wta":"when_not_to_apply"===e?"wnta":e];return n.jsx(p,{ref:r,label:"when_to_apply"===e?"When to apply":"when_not_to_apply"===e?"When NOT to Apply":e.charAt(0).toUpperCase()+e.slice(1).replace("_"," "),content:o,highlights:t.highlightsB,styleVariant:i,isHighlighted:A===e},"right-".concat(e))})}))]}))]}))]}))}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("@mui/material"),r=require("lucide-react"),o=require("../../_svg/SparkleIcon.js"),s=require("@e-llm-studio/citation"),l=require("../../_svg/ButtonCognitiveIcon.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=function(e,n){if(!n)return null;var t=new RegExp("<".concat(e,"[^>]*>([\\s\\S]*?)<\\/").concat(e,">"),"i"),i=n.match(t);return i?i[1].replace(/\\n/g,"\n"):null},d=function(e,n,t){var i=100*e;if(!t)return{bg:"#FFFFFF",border:"#E2E8F0",badgeBg:"#F1F5F9",badgeBorder:"#CBD5E1",badgeText:"#64748B",highlightBg:"transparent",label:"Not Defined"};var r=function(e){return e.split("_").map(function(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}).join(" ")}(n);return i>=70?{bg:"#FEF2F2",border:"#FEE2E2",badgeBg:"#FEF2F2",badgeBorder:"#FECACA",badgeText:"#B91C1C",highlightBg:"#FECACA",label:r}:i>=40?{bg:"#FFFCF6",border:"#FFDD80",badgeBg:"#FEF9C3",badgeBorder:"#FEF08A",badgeText:"#A16207",highlightBg:"#FDDEB3",label:r}:{bg:"#FFFFFF",border:"#E2E8F0",badgeBg:"#F1F5F9",badgeBorder:"#CBD5E1",badgeText:"#64748B",highlightBg:"transparent",label:r}},p=a(t).default.forwardRef(function(t,r){var o=t.label,s=t.content,l=t.highlights,a=void 0===l?[]:l,c=t.styleVariant,d=t.isHighlighted,p=void 0!==d&&d,x=Array.isArray(s)?s.join("\n"):s||"",g="#B91C1C"===c.badgeText?{borderColor:"#EF4444",shadow:"rgba(239, 68, 68, 0.25)"}:"#A16207"===c.badgeText?{borderColor:"#F59E0B",shadow:"rgba(245, 158, 11, 0.25)"}:{borderColor:"#6366F1",shadow:"rgba(99, 102, 241, 0.25)"};return n.jsxs(i.Box,e.__assign({sx:{mb:1.5}},{children:[n.jsx(i.Typography,e.__assign({sx:{fontSize:"12px",color:"#19213D",mb:.5,fontWeight:500,lineHeight:"130%"}},{children:o})),n.jsx(i.Box,e.__assign({ref:r,sx:{p:"4px 12px",borderRadius:"6px",border:p?"1.5px solid ".concat(g.borderColor):"1px solid ".concat(c.border),boxShadow:p?"0px 0px 0px 2px ".concat(g.shadow):"none",bgcolor:c.bg,fontSize:"13px",color:"#0B0E1A",lineHeight:1.4,minHeight:"24px",display:"flex",alignItems:"center",whiteSpace:"pre-line",wordBreak:"break-word"}},{children:n.jsx(i.Box,{children:function(){if(!x)return n.jsx(i.Typography,e.__assign({sx:{color:"#94A3B8",fontSize:"12px",fontStyle:"italic"}},{children:"Not Defined"}));if(!a||0===a.length)return x;var t=a.filter(function(e){return e&&e.length>0}).map(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});if(0===t.length)return x;var r=new RegExp("(".concat(t.join("|"),")"),"gi");return x.split(r).map(function(t,r){return a.some(function(e){return e&&e.toLowerCase()===t.toLowerCase()})?n.jsx(i.Box,e.__assign({component:"span",sx:{bgcolor:c.highlightBg,borderRadius:"2px",px:"2px"}},{children:t}),r):t})}()})}))]}))}),x=function(t){var r=t.data,o=t.isSelected,s=t.isCognitiveOpen,a=t.onToggleCognitive,c=t.onClick,d=r.summaryText||r.description||"",p=d.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),x=p?d.replace(p[0],"").trim():d,g=!!p;return n.jsxs(i.Box,e.__assign({id:"variant-card-".concat(r.id),onClick:c,sx:{minWidth:"280px",maxWidth:"280px",p:2,m:.5,bgcolor:o?"#EFF6FF99":"#FFFFFF",borderRadius:"8px",cursor:"pointer",transition:"all 0.2s",display:"flex",flexDirection:"column",gap:1,flexShrink:0,opacity:r.isLoading?.7:1,border:o?"1.4px solid #2563EB":null,boxShadow:o?"none":"0px 2px 4px 0px #19213D14","&:hover":{borderColor:o?"#2563EB":"#CBD5E1",boxShadow:o?"none":"0px 4px 8px 0px #19213D1F"}}},{children:[n.jsx(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1.5}},{children:r.isLoading?n.jsx(i.Skeleton,{variant:"rounded",width:80,height:20}):n.jsxs(i.Box,e.__assign({sx:{bgcolor:"#FEF2F2",color:"#B91C1C",fontSize:"11px",fontWeight:600,px:1,py:.5,borderRadius:"100px",border:"1px solid #FFE1E1"}},{children:[void 0!==r.similarity?r.similarity:0,"% Similarity"]}))})),n.jsxs(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:1}},{children:[n.jsxs(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"nowrap"}},{children:[n.jsx(i.Typography,e.__assign({title:r.title,sx:{fontWeight:500,fontSize:"14px",color:"#19213D",lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block"}},{children:r.title})),r.scope&&n.jsx(i.Box,e.__assign({sx:{flexShrink:0,fontSize:"10px",fontWeight:600,color:"#19213D",bgcolor:"#FFF",border:"1px solid #EDEFF2",px:.75,py:.25,borderRadius:"6px",lineHeight:1.4,whiteSpace:"nowrap"}},{children:r.scope}))]})),r.isLoading?n.jsxs(i.Box,{children:[n.jsx(i.Skeleton,{width:"90%"}),n.jsx(i.Skeleton,{width:"60%"})]}):n.jsxs(i.Box,e.__assign({title:x,sx:{display:"flex",flexDirection:"column",gap:.5}},{children:[n.jsx(i.Typography,e.__assign({sx:{fontWeight:400,fontSize:"13px",color:"#666F8D",lineHeight:1.4,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis"}},{children:x})),g&&n.jsxs(i.Box,e.__assign({onClick:function(e){e.stopPropagation(),o||c(),a()},sx:{display:"inline-flex",alignItems:"center",alignSelf:"flex-start",gap:"4px",padding:"2px 6px",borderRadius:"4px",cursor:"pointer",transition:"all 0.2s ease",marginLeft:"-4px","&:hover":{backgroundColor:"#F1F5F9"}}},{children:[n.jsx("div",e.__assign({style:{width:"13px",height:"13px",display:"flex",alignItems:"center"}},{children:n.jsx(l.ButtonCognitiveIcon,{})})),n.jsx("svg",e.__assign({width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#4B5563",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:o&&s?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease"}},{children:n.jsx("path",{d:"M6 9l6 6 6-6"})}))]}))]}))]}))]}))};exports.default=function(a){var g,h,u=a.proposedRule,f=a.variants,_=void 0===f?[]:f,y=a.onSelectVariant;a.onAddAsVariant;var b=a.onSkip,m=a.onBack,v=a.targetVariantId,w=a.highlightedField,F=t.useState(v||null),B=F[0],j=F[1],C=t.useState(!1),E=C[0],S=C[1],k=t.useState(null),A=k[0],R=k[1],T=t.useRef(null),L=t.useRef(null);t.useEffect(function(){if(v&&j(v),R(null!=w?w:null),w){var e=setTimeout(function(){return R(null)},6e3);return function(){return clearTimeout(e)}}},[v,w]);var D=function(e){T.current&&T.current.scrollBy({left:"left"===e?-300:300,behavior:"smooth"})},I=t.useMemo(function(){return e.__spreadArray([],_,!0).sort(function(e,n){return(n.similarity||0)-(e.similarity||0)})},[_]),W=t.useMemo(function(){if(B){var e=String(B).trim();return _.find(function(n){return n.id&&String(n.id).trim()===e})||I[0]}return I.length>0?I[0]:null},[B,_,I]);t.useEffect(function(){if(B&&T.current){var e=B.trim();setTimeout(function(){var n=document.getElementById("variant-card-".concat(e)),t=T.current;if(n&&t){var i=n.offsetLeft-t.offsetLeft-t.clientWidth/2+n.clientWidth/2;t.scrollTo({left:i,behavior:"smooth"})}},150)}},[B,I]);var z=W||{title:"",scope:"",description:"",wta:"",wnta:"",variantType:"Default"},H=null==W?void 0:W.analysis,M=(null===(h=null===(g=null==H?void 0:H.rule_difference_comparison)||void 0===g?void 0:g.summary)||void 0===h?void 0:h.overall_summary)||"",O=M.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),q=!!O,V=O?O[1]:"",N=c("reason",V)||"",P=c("gap",V)||"",U=c("relevance_score",V)||"",Y=t.useMemo(function(){return{ul:function(t){t.node;var i=e.__rest(t,["node"]);return n.jsx("ol",e.__assign({},i,{style:{paddingLeft:"1.25rem",listStyleType:"decimal",margin:0}}))},li:function(t){t.node;var i=e.__rest(t,["node"]);return n.jsx("li",e.__assign({},i,{style:{marginBottom:"4px",listStyleType:"decimal"}},{children:i.children}))},ol:function(t){t.node;var i=e.__rest(t,["node"]);return n.jsx("li",e.__assign({},i,{style:{marginBottom:"4px",listStyleType:"decimal"}},{children:i.children}))},a:function(t){var i=t.href,r=t.children,o=e.__rest(t,["href","children"]);if(!i)return n.jsx("a",e.__assign({},o,{children:r}));var s=i||"";try{s=decodeURIComponent(i)}catch(e){console.error("Error decoding href",e)}if(s.includes("variant_id=")){var l="",a="",c=s.match(/variant_id=([^?&]+)/);c&&(l=c[1]);var d=s.match(/field_name=([^&]+)/);return d&&(a=d[1]),n.jsxs("button",e.__assign({type:"button",onClick:function(e){e.preventDefault(),e.stopPropagation(),j(l),R(a),setTimeout(function(){return R(null)},6e3)},style:{background:"none",border:"none",outline:"none",borderRadius:"6px",padding:"1px 4px",color:"#0F172A",cursor:"pointer",fontSize:"13px",fontWeight:500,display:"inline-flex",alignItems:"center",gap:"2px",margin:"0 1px",verticalAlign:"baseline",textDecoration:"none",boxShadow:"none",WebkitAppearance:"none",MozAppearance:"none"},title:"View Comparison"},{children:[r,n.jsx("svg",e.__assign({width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:n.jsx("path",{d:"M10.2082 8.67708H2.0415M2.0415 8.67708L4.08317 6.63542M2.0415 8.67708L4.08317 10.7188M2.0415 3.57292H10.2082M10.2082 3.57292L8.1665 1.53125M10.2082 3.57292L8.1665 5.61458",stroke:"#0F172A",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}))]}))}return n.jsx("a",e.__assign({href:i,target:"_blank",rel:"noopener noreferrer",style:{color:"#7C3AED"}},o,{children:r}))}}},[]);t.useEffect(function(){!B&&!v&&I.length>0&&!I[0].isLoading&&j(I[0].id)},[I,B,v]);var $=t.useRef(null),J=t.useState([]),X=J[0],G=J[1],K=t.useState(!1),Q=K[0],Z=K[1],ee=t.useState(!1),ne=ee[0],te=ee[1];t.useEffect(function(){var e=T.current;if(e){var n=function(){Z(e.scrollLeft>0),te(e.scrollLeft+e.clientWidth<e.scrollWidth-1)};return n(),e.addEventListener("scroll",n),window.addEventListener("resize",n),function(){e.removeEventListener("scroll",n),window.removeEventListener("resize",n)}}},[I]);var ie={title:t.useRef(null),scope:t.useRef(null),description:t.useRef(null),wta:t.useRef(null),wnta:t.useRef(null)},re={title:t.useRef(null),scope:t.useRef(null),description:t.useRef(null),wta:t.useRef(null),wnta:t.useRef(null)};t.useEffect(function(){if(A){var e="when_to_apply"===A?"wta":"when_not_to_apply"===A?"wnta":A,n=ie[e]||re[e];n&&n.current&&setTimeout(function(){n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}},[A]);var oe=function(e){var n,t,i,r,o,s=null===(n=null==H?void 0:H.rule_difference_comparison)||void 0===n?void 0:n.fields,l="when_to_apply"===e?"wta":"when_not_to_apply"===e?"wnta":e,a=!(!u[l]&&!z[l]);if(!s||!s[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var c=s[e];if(c.mappings){var d=c.mappings[0]||{};return{score:c.score,relation:d.relation||"",highlightsA:(null===(t=d.highlights)||void 0===t?void 0:t.ruleA_spans)||[],highlightsB:(null===(i=d.highlights)||void 0===i?void 0:i.ruleB_spans)||[],hasContent:a}}return{score:c.score,relation:c.relation||"",highlightsA:(null===(r=c.highlights)||void 0===r?void 0:r.ruleA_spans)||[],highlightsB:(null===(o=c.highlights)||void 0===o?void 0:o.ruleB_spans)||[],hasContent:a}},se=["title","scope","description","when_to_apply","when_not_to_apply"],le=function(){if($.current){var e=$.current.getBoundingClientRect(),n=[];se.forEach(function(t){var i="when_to_apply"===t?ie.wta:"when_not_to_apply"===t?ie.wnta:ie[t],r="when_to_apply"===t?re.wta:"when_not_to_apply"===t?re.wnta:re[t];if(i.current&&r.current){i.current.style.height="auto",r.current.style.height="auto";var o=i.current.getBoundingClientRect(),s=r.current.getBoundingClientRect(),l=Math.max(o.height,s.height);i.current.style.height="".concat(l,"px"),r.current.style.height="".concat(l,"px");var a=i.current.getBoundingClientRect(),c=r.current.getBoundingClientRect(),p=oe(t),x=d(p.score,p.relation,p.hasContent),g=a.top+a.height/2-e.top;n.push({x1:a.right-e.left,y1:g,x2:c.left-e.left,y2:g,style:x})}}),G(n)}};return t.useEffect(function(){var e=setTimeout(le,250);window.addEventListener("resize",le);var n=null;return $.current&&(n=new ResizeObserver(function(){window.requestAnimationFrame(function(){le()})})).observe($.current),function(){clearTimeout(e),window.removeEventListener("resize",le),n&&n.disconnect()}},[u,z,H,E]),n.jsxs(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"hidden"}},{children:[n.jsxs(i.Box,e.__assign({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF",border:"1.5px solid #EEF0F4"}},{children:[n.jsxs(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1}},{children:[n.jsx(i.IconButton,e.__assign({onClick:m,size:"small"},{children:n.jsx(r.ArrowLeft,{})})),n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:450,color:"#0F172A"}},{children:"Learning Comparison"}))]})),n.jsx(i.IconButton,e.__assign({onClick:b,size:"small"},{children:n.jsx(i.Box,e.__assign({sx:{fontSize:24,lineHeight:.5}},{children:"×"}))}))]})),I.length>1&&n.jsxs(i.Box,e.__assign({sx:{px:3,pb:.25}},{children:[n.jsxs(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",justifyContent:"space-between",py:1}},{children:[n.jsx(i.Typography,e.__assign({sx:{fontSize:"13px",color:"#475569"}},{children:"Choose the Learning you want to compare with the rule you are creating."})),n.jsxs(i.Box,e.__assign({sx:{display:"flex",gap:.5,flexShrink:0,ml:1}},{children:[n.jsx(i.IconButton,e.__assign({onClick:function(){return D("left")},size:"small",disabled:!Q},{children:n.jsx(r.ArrowLeft,{size:18})})),n.jsx(i.IconButton,e.__assign({onClick:function(){return D("right")},size:"small",disabled:!ne},{children:n.jsx(r.ArrowRight,{size:18})}))]}))]})),n.jsx(i.Box,e.__assign({ref:T,sx:{display:"flex",gap:1,overflowX:"auto",pb:.05,"&::-webkit-scrollbar":{height:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"transparent",borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:"transparent"}}},{children:I.map(function(e){return n.jsx(x,{data:e,isSelected:(null==W?void 0:W.id)===e.id,isCognitiveOpen:E,onToggleCognitive:function(){S(function(e){var n=!e;return n&&L.current&&L.current.scrollTo({top:0,behavior:"smooth"}),n})},onClick:function(){return j((n=e).id),y(n),void S(!1);var n}},e.id)})}))]})),n.jsx(i.Box,e.__assign({ref:L,sx:{flex:1,overflowY:"auto",py:1.5,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",borderTop:M&&q&&E?"none":"1.5px solid #EEF0F4"}},{children:n.jsxs(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"}},{children:[M&&q&&E&&n.jsx(i.Box,e.__assign({sx:{width:"100%",pb:1,animation:"fadeIn 0.2s ease-out","& > div > button":{display:"none !important"},"& > div > div":{marginTop:"0px"}}},{children:n.jsx(s.CognitiveDecisioningCard,{headerIcon:n.jsx(l.ButtonCognitiveIcon,{}),reasoning:N,gap:P,score:U,mdComponents:Y,isOpen:!0,onToggle:function(){return S(!1)}})})),n.jsxs(i.Box,e.__assign({ref:$,sx:{display:"grid",gridTemplateColumns:"1fr auto 1fr",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative"}},{children:[n.jsx("svg",e.__assign({style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",zIndex:10}},{children:X.map(function(t,r){var o=(t.x1+t.x2)/2,s=t.y1;return n.jsxs("g",{children:[n.jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.badgeBorder,strokeWidth:"1"}),n.jsx("foreignObject",e.__assign({x:o-125,y:s-16,width:"250",height:"32"},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n.jsx(i.Box,e.__assign({sx:{fontSize:"11px",bgcolor:t.style.badgeBg,color:t.style.badgeText,border:"1px solid ".concat(t.style.badgeBorder),borderRadius:"12px",px:1.5,py:.25,fontWeight:500,textAlign:"center",whiteSpace:"nowrap"}},{children:t.style.label}))}))}))]},r)})})),n.jsxs(i.Box,e.__assign({sx:{border:"1px dashed #B0B0B0",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)",minWidth:0}},{children:[n.jsx(i.Box,e.__assign({sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px dashed #B0B0B0",borderRadius:"8px 8px 0 0",display:"flex",minHeight:"24px",alignItems:"center"}},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#19213D"}},{children:"Learning You’re Creating"}))})),n.jsx(i.Box,e.__assign({sx:{p:"12px",display:"flex",flexDirection:"column"}},{children:se.map(function(e){var t=oe(e),i=d(t.score,t.relation,t.hasContent),r="when_to_apply"===e?ie.wta:"when_not_to_apply"===e?ie.wnta:ie[e],o=u["when_to_apply"===e?"wta":"when_not_to_apply"===e?"wnta":e];return n.jsx(p,{ref:r,label:"when_to_apply"===e?"When to apply":"when_not_to_apply"===e?"When NOT to Apply":e.charAt(0).toUpperCase()+e.slice(1).replace("_"," "),content:o,highlights:t.highlightsA,styleVariant:i,isHighlighted:A===e},"left-".concat(e))})}))]})),n.jsx(i.Box,{sx:{width:"1px"}}),n.jsxs(i.Box,e.__assign({sx:{border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0}},{children:[n.jsx(i.Box,e.__assign({sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"24px",display:"flex",alignItems:"center"}},{children:n.jsxs(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",display:"flex",alignItems:"center",gap:1}},{children:[n.jsx("div",e.__assign({style:{width:"18px",height:"18px",display:"flex",alignItems:"center",justifyContent:"center"}},{children:n.jsx(o.default,{})})),"Existing Learning"]}))})),n.jsx(i.Box,e.__assign({sx:{p:"12px",display:"flex",flexDirection:"column"}},{children:se.map(function(e){var t=oe(e),i=d(t.score,t.relation,t.hasContent),r="when_to_apply"===e?re.wta:"when_not_to_apply"===e?re.wnta:re[e],o=z["when_to_apply"===e?"wta":"when_not_to_apply"===e?"wnta":e];return n.jsx(p,{ref:r,label:"when_to_apply"===e?"When to apply":"when_not_to_apply"===e?"When NOT to Apply":e.charAt(0).toUpperCase()+e.slice(1).replace("_"," "),content:o,highlights:t.highlightsB,styleVariant:i,isHighlighted:A===e},"right-".concat(e))})}))]}))]}))]}))}))]}))};
2
2
  //# sourceMappingURL=RuleComparison.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("tslib"),e=require("react/jsx-runtime"),t=require("react"),n=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"),s=require("../../AccordianSection.js"),d=require("../../_svg/ButtonCognitiveIcon.js"),c=require("lucide-react");function u(i){return i&&"object"==typeof i&&"default"in i?i:{default:i}}var p=u(t),v=function(t){var n=t.children,o=t.onAddVariant,l=t.isDisabled,a=p.default.Children.toArray(n);return e.jsxs("div",i.__assign({style:{display:"flex",flexDirection:"column",alignItems:"flex-start"}},{children:[a.map(function(i,t){return e.jsxs(p.default.Fragment,{children:[i,e.jsx("div",{style:{width:"2px",height:"20px",backgroundColor:"#E2E8F0",marginLeft:"30px"}})]},t)}),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,_,S,D,T,C,m,j=u.state,I=u.handlers,A=u.uiState,b=(null==A?void 0:A.highlights)||new Map,E=b.get("global_0")||{},O=t.useState({}),R=O[0],w=O[1],V=t.useState(null),N=V[0],W=V[1],q="rule-setup"===(null==A?void 0:A.activeEditId),M=t.useState({title:"",scope:{}}),k=M[0],B=M[1],F=t.useState(!1),L=F[0],z=F[1],P=p.default.useRef(null==A?void 0:A.isAiStreaming);t.useEffect(function(){q||L||B({title:j.ruleTitle,scope:j.scopeData})},[j.ruleTitle,j.scopeData,q,L]),t.useEffect(function(){var i;if(P.current&&!(null==A?void 0:A.isAiStreaming)&&L&&(z(!1),null===(i=null==A?void 0:A.setActiveEditId)||void 0===i||i.call(A,null),null==A?void 0:A.setSendMessageInChat)){var e=j.ruleTitle!==k.title,t=JSON.stringify(j.scopeData)!==JSON.stringify(k.scope),n=[];if(e&&n.push("Title with ".concat(j.ruleTitle)),t){var o=[];j.scopeData.station&&o.push(j.scopeData.station),j.scopeData.tiers&&j.scopeData.tiers.length>0&&o.push(j.scopeData.tiers.join(", ")),n.push("Scope with ".concat(o.join(", ")))}var l=n.join(" and ");A.setSendMessageInChat("__SKELETON_END__::Update Rule Setup using ".concat(l))}P.current=null==A?void 0:A.isAiStreaming},[null==A?void 0:A.isAiStreaming,L,j,k]);var J=function(){var i;I.setRuleTitle(k.title),k.scope.station!==j.scopeData.station&&I.onScopeChange("station",k.scope.station),JSON.stringify(k.scope.tiers)!==JSON.stringify(j.scopeData.tiers)&&I.onScopeChange("tiers",k.scope.tiers),null===(i=null==A?void 0:A.setActiveEditId)||void 0===i||i.call(A,null)},H=function(){var i,e,t=j.ruleTitle!==k.title,n=JSON.stringify(j.scopeData)!==JSON.stringify(k.scope);if(t||n){if(z(!0),null==A?void 0:A.setSendMessageInChat){var o="sk-".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2,8)),l=[];if(t){var a=(null===(e=j.ruleTitle)||void 0===e?void 0:e.trim())?"Title with ".concat(j.ruleTitle):"No Title";l.push(a)}if(n){var r=[];j.scopeData.station&&r.push("station: ".concat(j.scopeData.station)),j.scopeData.tiers&&j.scopeData.tiers.length>0&&r.push("tiers: ".concat(j.scopeData.tiers.join(", ")));var s=r.length>0?"with ".concat(r.join(" and ")):"No Tier Selected";l.push(s)}var d=l.join(" and ");A.setSendMessageInChat("__SKELETON__:".concat(o,":Update Rule Setup ").concat(d))}}else null===(i=null==A?void 0:A.setActiveEditId)||void 0===i||i.call(A,null)},K=p.default.useRef(null==A?void 0:A.defaultVariantOpen),U=p.default.useRef(j.variantsByTier);p.default.useEffect(function(){var i,e,t,n,o=null,l=!1;if(K.current!==(null==A?void 0:A.defaultVariantOpen)&&(l=!0,K.current=null==A?void 0:A.defaultVariantOpen),j.variantsByTier,U.current,l){if(null==(null==A?void 0:A.defaultVariantOpen)||(null==A?void 0:A.defaultVariantOpen)<0)return W(null),void(U.current=j.variantsByTier);null===(e=null===(i=null==A?void 0:A.tierOptions)||void 0===i?void 0:i.filter(function(i){var e,t;return null===(t=null===(e=j.scopeData)||void 0===e?void 0:e.tiers)||void 0===t?void 0:t.includes(i)}))||void 0===e||e.forEach(function(i){var e,t=i.toLowerCase().replace(/ /g,"_");((null===(e=j.variantsByTier)||void 0===e?void 0:e[t])||[]).forEach(function(i,e){(null==A?void 0:A.defaultVariantOpen)===e&&(o="".concat(t,"-variant-").concat(e)),(null==A?void 0:A.autoScrollVariantIndex)===e&&(o="".concat(t,"-variant-").concat(e))})}),o&&W(o)}null===N&&(null==A?void 0:A.defaultVariantOpen)>=0&&(null===(n=null===(t=null==A?void 0:A.tierOptions)||void 0===t?void 0:t.filter(function(i){var e,t;return null===(t=null===(e=j.scopeData)||void 0===e?void 0:e.tiers)||void 0===t?void 0:t.includes(i)}))||void 0===n||n.forEach(function(i){var e,t=i.toLowerCase().replace(/ /g,"_");((null===(e=j.variantsByTier)||void 0===e?void 0:e[t])||[])[A.defaultVariantOpen]&&W("".concat(t,"-variant-").concat(A.defaultVariantOpen))})),U.current=j.variantsByTier},[j.variantsByTier,null==A?void 0:A.defaultVariantOpen,null===(g=j.scopeData)||void 0===g?void 0:g.tiers,null==A?void 0:A.tierOptions,null==A?void 0:A.autoScrollVariantIndex]);var $=function(e){w(function(t){var n;return i.__assign(i.__assign({},t),((n={})[e]=!t[e],n))})},Z=function(i){var e,t=null===(e=j.fieldCitations)||void 0===e?void 0:e[i];return Array.isArray(t)&&t.length>0?t:j.citations},G={marginTop:"-17px",position:"relative",zIndex:1},Q=function(i){i&&i.scrollIntoView({behavior:"smooth",block:"center"})};console.log("CreateRule state:",j),console.log("CreateRule uiState:",A);var X=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"},Y=!!(null==A?void 0:A.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(s.default,i.__assign({title:{type:"other",label:(null==A?void 0:A.setupLabel)||"Rule Setup"},actionButtons:function(t,n){if(q)return null;var o=!!(null==A?void 0:A.activeEditId)&&"rule-setup"!==A.activeEditId;return e.jsx("div",i.__assign({style:{position:"relative",display:"flex",flexDirection:"column"}},{children:e.jsxs("button",i.__assign({title:o?"Save active edits first":"Edit",onClick:function(i){i.stopPropagation(),o?(null==A?void 0:A.setPendingEditId)&&A.setPendingEditId(A.activeEditId||null):(!function(){var i;(null==A?void 0:A.activeEditId)&&"rule-setup"!==A.activeEditId||(null===(i=null==A?void 0:A.setActiveEditId)||void 0===i||i.call(A,"rule-setup"),B({title:j.ruleTitle,scope:j.scopeData}))}(),(null==A?void 0:A.setPendingEditId)&&A.setPendingEditId(null),t||n())},disabled:L,style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",padding:"6px 8px",border:"1px solid #e5e7eb",borderRadius:"8px",cursor:L?"not-allowed":"pointer",backgroundColor:"#ffffff",color:"#6b7280",opacity:L?.5:1}},{children:[e.jsx(c.Pencil,{size:14})," Edit"]}))}))},footerData:{ruleTitle:j.ruleTitle,stations:[j.scopeData.station],tiers:null===(f=j.scopeData)||void 0===f?void 0:f.tiers},defaultOpen:"Create"===(null==A?void 0:A.usedFor),readOnly:"Create"!==(null==A?void 0:A.usedFor),isAiStreaming:null==A?void 0:A.isAiStreaming},{children:e.jsxs("div",i.__assign({style:{display:"flex",flexDirection:"column",gap:"12px"}},{children:[L&&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:A.ruleTitle||"Rule Title",rows:1,placeholder:"Enter a short, descriptive title for the learning",required:!0,value:j.ruleTitle,onChange:I.setRuleTitle,readOnly:"Create"!==(null==A?void 0:A.usedFor)||(null==A?void 0:A.isAiStreaming)||!q,isOpen:R.ruleTitle,onToggle:function(){return $("ruleTitle")},isHighlighted:E.ruleTitle||!1,showCognitiveIcon:j.citation.ruleTitle,tooltipDescription:"Why this Title?",errorMessage:null===(h=A.validationErrors)||void 0===h?void 0:h.ruleTitle},A)),j.citation.ruleTitle&&e.jsx("div",i.__assign({style:G},{children:e.jsx(n.InputDataReasoningCard,{isVisible:R.ruleTitle,citation:j.citation.ruleTitle,citations:Z("ruleTitle"),fieldName:"Rule Title",fieldValue:j.ruleTitle})})),e.jsx(a.ScopeSection,i.__assign({id:"scope",title:"",required:!1,scopeData:j.scopeData,onScopeChange:I.onScopeChange,tierLabel:"Which tiers should this learning apply to?",stationLabel:"Which scope should this learning belong to?",highlights:E,isOpen:R.scopeData,onToggle:function(){return $("scopeData")},showCognitiveIcon:j.citation.scopeData,cognitiveIcon:e.jsx(d.ButtonCognitiveIcon,{}),tooltipDescription:"Why this Scope?",errorMessage:(null===(x=A.validationErrors)||void 0===x?void 0:x.station)||(null===(y=A.validationErrors)||void 0===y?void 0:y.tiers),stationErrorMessage:null===(_=A.validationErrors)||void 0===_?void 0:_.station,tierErrorMessage:null===(S=A.validationErrors)||void 0===S?void 0:S.tiers,readOnly:"Create"!==(null==A?void 0:A.usedFor)||(null==A?void 0:A.isAiStreaming)||!q},A)),j.citation.scopeData&&e.jsx("div",i.__assign({style:G},{children:e.jsx(n.InputDataReasoningCard,{isVisible:R.scopeData,citation:j.citation.scopeData,citations:Z("scopeData"),fieldName:"Scope",fieldValue:null===(T=null===(D=j.scopeData)||void 0===D?void 0:D.tiers)||void 0===T?void 0:T.join(", ")})})),!q||L?null: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:J,style:{background:"none",border:"none",color:"#6b7280",fontSize:"14px",fontWeight:"500",cursor:"pointer",padding:"0"}},{children:"Discard Changes"})),e.jsxs("button",i.__assign({onClick:H,style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",borderRadius:"12px",border:"none",backgroundColor:"#2563eb",color:"#ffffff",fontSize:"14px",fontWeight:"500",cursor:"pointer",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.05)"}},{children:[e.jsx(c.Check,{size:18,strokeWidth:2.5,color:"#ffffff"}),"Save Changes"]}))]})),"rule-setup"===(null==A?void 0:A.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===(m=null===(C=null==A?void 0:A.tierOptions)||void 0===C?void 0:C.filter(function(i){var e,t;return null===(t=null===(e=j.scopeData)||void 0===e?void 0:e.tiers)||void 0===t?void 0:t.includes(i)}))||void 0===m?void 0:m.map(function(t,a,d){var c,u,p,g,f=t.toLowerCase().replace(/ /g,"_"),h=(null===(c=j.variantsByTier)||void 0===c?void 0:c[f])||[],x=h.length,y=!1;if(1===x){var _=h[0],S=!(null===(u=null==_?void 0:_.ruleDescription)||void 0===u?void 0:u.trim()),D=(null===(p=null==_?void 0:_.whenToApplyConditions)||void 0===p?void 0:p.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;S&&!D&&!T&&(y=!0)}var C=y?void 0:"".concat(x," ").concat(1===x?"variant":"variants"," configured for this tier"),m=!((null==A?void 0:A.defaultTierOpen)>=0)||a===A.defaultTierOpen;return console.log("Rendering tier : ",t),e.jsx(s.default,i.__assign({variant:"tier-header",title:{type:"other",label:t},subtitle:C,defaultOpen:m,footerData:{description:"Variants for ".concat(t)}},{children:e.jsx(v,i.__assign({onAddVariant:function(){var i;return null===(i=I.addNewVariant)||void 0===i?void 0:i.call(I,f)},isDisabled:null==A?void 0:A.isAiStreaming},{children:h.map(function(t,a){var d,c,u,p,v,g,h,x,y,_,S,D=t.variantType||"default",T="".concat(f,"-variant-").concat(a),C=!0===t.is_variant,m="default"===D||"default_variant"===D;(null==A?void 0:A.defaultVariantOpen)>=0&&A.defaultVariantOpen;var j="".concat(f,"_").concat(a),E=b.get(j)||{},O=(null===(c=null===(d=A.separationItemsByTier)||void 0===d?void 0:d[f])||void 0===c?void 0:c.get(a))||[],w=(null===(p=null===(u=A.togglesByTier)||void 0===u?void 0:u[f])||void 0===p?void 0:p.get(a))||[],V=(null==A?void 0:A.autoScrollVariantIndex)===a||!0===t.is_variant;return console.log("Rendering ".concat(f," variant ").concat(a,":"),t),console.log("Rendering Variant : ",t),console.log("Open Accordion ID:",N,"Current Variant ID:",T),e.jsx("div",i.__assign({ref:V?Q:null,style:{width:"100%"}},{children:e.jsx(s.default,i.__assign({title:{type:m?"default":"variant",label:X(D),number:a+1,isNewVariant:C,isDefault:t.isDefault,isModified:t.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==A?void 0:A.setActiveVariantAccordionIndex)||void 0===i||i.call(A,e?null:a)},variant:"rule-behavior",footerData:{ruleTitle:D,description:t.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:A.ruleDescriptionTitle||"Rule Description",rows:2,placeholder:"Explain the learning behaviour",required:!0,readOnly:t.isReadOnly||(null==A?void 0:A.isAiStreaming)||Y&&(null==A?void 0:A.activeEditId)!=="rule-description-".concat(f,"-").concat(a),value:t.ruleDescription||"",onChange:function(i){return I.setRuleDescription(f,a,i)},isOpen:R["ruleDescription-".concat(f,"-").concat(a)],onToggle:function(){return $("ruleDescription-".concat(f,"-").concat(a))},isHighlighted:E.ruleDescription||!1,showCognitiveIcon:null===(v=t.reasoning)||void 0===v?void 0:v.ruleDescription,tooltipDescription:"Why this Description?",errorMessage:null===(g=A.validationErrors)||void 0===g?void 0:g["ruleDescription-".concat(f,"-").concat(a)],enableInlineEdit:!0,setSendMessageInChat:null==A?void 0:A.setSendMessageInChat,isAiStreaming:null==A?void 0:A.isAiStreaming,fieldName:"Rule Description"},A)),(null===(h=t.reasoning)||void 0===h?void 0:h.ruleDescription)&&e.jsx("div",i.__assign({style:G},{children:e.jsx(n.InputDataReasoningCard,{isVisible:R["ruleDescription-".concat(f,"-").concat(a)],citation:t.reasoning.ruleDescription,citations:Z("ruleDescription_".concat(f,"_").concat(a)),fieldName:"Rule Description",fieldValue:t.ruleDescription})})),e.jsx(o.ConditionSection,i.__assign({id:"when-to-apply-".concat(f,"-").concat(a),title:A.whenToApplyTitle||"When to apply",required:!0,dividerRequired:!0,readOnly:t.isReadOnly||(null==A?void 0:A.isAiStreaming)||Y&&!(null===(x=t.whenToApplyConditions)||void 0===x?void 0:x.some(function(i){return"condition-".concat(f,"-").concat(a,"-").concat(i.id)===(null==A?void 0:A.activeEditId)})),conditions:t.whenToApplyConditions||[],onAdd:function(){return I.addWhenToApply(f,a)},onRemove:function(i,e,t){return I.removeWhenToApply(i,e,t)},onEdit:function(i,e,t,n){return I.editWhenToApply(i,e,t,n)},index:a,tierKey:f,isHighlighted:E.wta||!1,highlightedIds:null==A?void 0:A.highlightedIds,tooltipDescription:"Why this Condition?",citations:Z("whenToApply_".concat(f,"_").concat(a)),bordered:!0,addLabel:"Add When to apply",isAiStreaming:A.isAiStreaming,errorMessage:(null===(y=A.validationErrors)||void 0===y?void 0:y["whenToApply-".concat(f,"-").concat(a)])||(null==A?void 0:A.conflictReason)},A)),e.jsx(o.ConditionSection,i.__assign({id:"when-not-to-apply-".concat(f,"-").concat(a),title:A.whenNotToApplyTitle||"When NOT to apply",required:!1,dividerRequired:!0,readOnly:t.isReadOnly||(null==A?void 0:A.isAiStreaming)||Y&&!(null===(_=t.whenNotToApplyConditions)||void 0===_?void 0:_.some(function(i){return"condition-".concat(f,"-").concat(a,"-").concat(i.id)===(null==A?void 0:A.activeEditId)})),conditions:t.whenNotToApplyConditions||[],onAdd:function(){return I.addWhenNotToApply(f,a)},onRemove:function(i,e,t){return I.removeWhenNotToApply(i,e,t)},onEdit:function(i,e,t,n){return I.editWhenNotToApply(i,e,t,n)},index:a,tierKey:f,isHighlighted:E.wnta||!1,highlightedIds:null==A?void 0:A.highlightedIds,tooltipDescription:"Why this Condition?",citations:Z("whenNotToApply_".concat(f,"_").concat(a)),bordered:!0,addLabel:"Add When NOT to apply",isAiStreaming:A.isAiStreaming},A)),e.jsx(l.ConfigSection,i.__assign({id:"config-".concat(f,"-").concat(a),title:A.configTitle||"Configuration",required:!1,highlights:E,bordered:!0,readOnly:t.isReadOnly||(null==A?void 0:A.isAiStreaming)||Y,onConfigChange:function(i,e){return I.onConfigChange(f,a,i,e)},separationItems:O,toggles:w,index:a},A)),(null===(S=t.reasoning)||void 0===S?void 0:S.configData)&&e.jsx("div",i.__assign({style:G},{children:e.jsx(n.InputDataReasoningCard,{citation:t.reasoning.configData,citations:Z("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"),t=require("react"),n=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"),s=require("../../AccordianSection.js"),d=require("../../_svg/ButtonCognitiveIcon.js"),c=require("lucide-react");function u(i){return i&&"object"==typeof i&&"default"in i?i:{default:i}}var p=u(t),v=function(t){var n=t.children,o=t.onAddVariant,l=t.isDisabled,a=p.default.Children.toArray(n);return e.jsxs("div",i.__assign({style:{display:"flex",flexDirection:"column",alignItems:"flex-start"}},{children:[a.map(function(i,t){return e.jsxs(p.default.Fragment,{children:[i,e.jsx("div",{style:{width:"2px",height:"20px",backgroundColor:"#E2E8F0",marginLeft:"30px"}})]},t)}),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,_,S,D,T,C,m,j=u.state,I=u.handlers,A=u.uiState,b=(null==A?void 0:A.highlights)||new Map,E=b.get("global_0")||{},O=t.useState({}),w=O[0],R=O[1],V=t.useState(null),N=V[0],W=V[1],q="rule-setup"===(null==A?void 0:A.activeEditId),M=t.useState({title:"",scope:{}}),F=M[0],k=M[1],B=t.useState(!1),L=B[0],P=B[1],z=p.default.useRef(null==A?void 0:A.isAiStreaming);t.useEffect(function(){q||L||k({title:j.ruleTitle,scope:j.scopeData})},[j.ruleTitle,j.scopeData,q,L]),t.useEffect(function(){var i;if(z.current&&!(null==A?void 0:A.isAiStreaming)&&L&&(P(!1),null===(i=null==A?void 0:A.setActiveEditId)||void 0===i||i.call(A,null),null==A?void 0:A.setSendMessageInChat)){var e=j.ruleTitle!==F.title,t=JSON.stringify(j.scopeData)!==JSON.stringify(F.scope),n=[];if(e&&n.push("Title with ".concat(j.ruleTitle)),t){var o=[];j.scopeData.station&&o.push(j.scopeData.station),j.scopeData.tiers&&j.scopeData.tiers.length>0&&o.push(j.scopeData.tiers.join(", ")),n.push("Scope with ".concat(o.join(", ")))}var l=n.join(" and ");A.setSendMessageInChat("__SKELETON_END__::Update Rule Setup using ".concat(l))}z.current=null==A?void 0:A.isAiStreaming},[null==A?void 0:A.isAiStreaming,L,j,F]);var J=function(){var i;I.setRuleTitle(F.title),F.scope.station!==j.scopeData.station&&I.onScopeChange("station",F.scope.station),JSON.stringify(F.scope.tiers)!==JSON.stringify(j.scopeData.tiers)&&I.onScopeChange("tiers",F.scope.tiers),null===(i=null==A?void 0:A.setActiveEditId)||void 0===i||i.call(A,null)},H=function(){var i,e,t=j.ruleTitle!==F.title,n=JSON.stringify(j.scopeData)!==JSON.stringify(F.scope);if(t||n){if(P(!0),null==A?void 0:A.setSendMessageInChat){var o="sk-".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2,8)),l=[];if(t){var a=(null===(e=j.ruleTitle)||void 0===e?void 0:e.trim())?"Title with ".concat(j.ruleTitle):"No Title";l.push(a)}if(n){var r=[];j.scopeData.station&&r.push("station: ".concat(j.scopeData.station)),j.scopeData.tiers&&j.scopeData.tiers.length>0&&r.push("tiers: ".concat(j.scopeData.tiers.join(", ")));var s=r.length>0?"with ".concat(r.join(" and ")):"No Tier Selected";l.push(s)}var d=l.join(" and ");A.setSendMessageInChat("__SKELETON__:".concat(o,":Update Rule Setup ").concat(d))}}else null===(i=null==A?void 0:A.setActiveEditId)||void 0===i||i.call(A,null)},K=p.default.useRef(null==A?void 0:A.defaultVariantOpen),U=p.default.useRef(j.variantsByTier);p.default.useEffect(function(){var i,e,t,n,o=null,l=!1;if(K.current!==(null==A?void 0:A.defaultVariantOpen)&&(l=!0,K.current=null==A?void 0:A.defaultVariantOpen),j.variantsByTier,U.current,l){if(null==(null==A?void 0:A.defaultVariantOpen)||(null==A?void 0:A.defaultVariantOpen)<0)return W(null),void(U.current=j.variantsByTier);null===(e=null===(i=null==A?void 0:A.tierOptions)||void 0===i?void 0:i.filter(function(i){var e,t;return null===(t=null===(e=j.scopeData)||void 0===e?void 0:e.tiers)||void 0===t?void 0:t.includes(i)}))||void 0===e||e.forEach(function(i){var e,t=i.toLowerCase().replace(/ /g,"_");((null===(e=j.variantsByTier)||void 0===e?void 0:e[t])||[]).forEach(function(i,e){(null==A?void 0:A.defaultVariantOpen)===e&&(o="".concat(t,"-variant-").concat(e)),(null==A?void 0:A.autoScrollVariantIndex)===e&&(o="".concat(t,"-variant-").concat(e))})}),o&&W(o)}null===N&&(null==A?void 0:A.defaultVariantOpen)>=0&&(null===(n=null===(t=null==A?void 0:A.tierOptions)||void 0===t?void 0:t.filter(function(i){var e,t;return null===(t=null===(e=j.scopeData)||void 0===e?void 0:e.tiers)||void 0===t?void 0:t.includes(i)}))||void 0===n||n.forEach(function(i){var e,t=i.toLowerCase().replace(/ /g,"_");((null===(e=j.variantsByTier)||void 0===e?void 0:e[t])||[])[A.defaultVariantOpen]&&W("".concat(t,"-variant-").concat(A.defaultVariantOpen))})),U.current=j.variantsByTier},[j.variantsByTier,null==A?void 0:A.defaultVariantOpen,null===(g=j.scopeData)||void 0===g?void 0:g.tiers,null==A?void 0:A.tierOptions,null==A?void 0:A.autoScrollVariantIndex]);var $=function(e){R(function(t){var n;return i.__assign(i.__assign({},t),((n={})[e]=!t[e],n))})},Z=function(i){var e,t=null===(e=j.fieldCitations)||void 0===e?void 0:e[i];return Array.isArray(t)&&t.length>0?t:j.citations},G={marginTop:"-17px",position:"relative",zIndex:1},Q=function(i){i&&i.scrollIntoView({behavior:"smooth",block:"center"})};console.log("CreateRule state:",j),console.log("CreateRule uiState:",A);var X=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"},Y=!!(null==A?void 0:A.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(s.default,i.__assign({title:{type:"other",label:(null==A?void 0:A.setupLabel)||"Rule Setup"},actionButtons:function(t,n){if(q)return null;var o=!!(null==A?void 0:A.activeEditId)&&"rule-setup"!==A.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(i){i.stopPropagation(),o?(null==A?void 0:A.setPendingEditId)&&A.setPendingEditId(A.activeEditId||null):(!function(){var i;(null==A?void 0:A.activeEditId)&&"rule-setup"!==A.activeEditId||(null===(i=null==A?void 0:A.setActiveEditId)||void 0===i||i.call(A,"rule-setup"),k({title:j.ruleTitle,scope:j.scopeData}))}(),(null==A?void 0:A.setPendingEditId)&&A.setPendingEditId(null),t||n())},disabled:L,style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",padding:"6px 8px",border:"1px solid #e5e7eb",borderRadius:"8px",cursor:L?"not-allowed":"pointer",backgroundColor:"#ffffff",color:"#6b7280",opacity:L?.5:1}},{children:e.jsx(c.Pencil,{size:14})}))}))},footerData:{ruleTitle:j.ruleTitle,stations:[j.scopeData.station],tiers:null===(f=j.scopeData)||void 0===f?void 0:f.tiers},defaultOpen:"Create"===(null==A?void 0:A.usedFor),readOnly:"Create"!==(null==A?void 0:A.usedFor),isAiStreaming:null==A?void 0:A.isAiStreaming,editFlow:"Edit"===(null==A?void 0:A.usedFor)},{children:e.jsxs("div",i.__assign({style:{display:"flex",flexDirection:"column",gap:"12px"}},{children:[L&&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:A.ruleTitle||"Rule Title",rows:1,placeholder:"Enter a short, descriptive title for the learning",required:!0,value:j.ruleTitle,onChange:I.setRuleTitle,readOnly:"Create"!==(null==A?void 0:A.usedFor)||(null==A?void 0:A.isAiStreaming)||!q,isOpen:w.ruleTitle,onToggle:function(){return $("ruleTitle")},isHighlighted:E.ruleTitle||!1,showCognitiveIcon:j.citation.ruleTitle,tooltipDescription:"Why this Title?",errorMessage:null===(h=A.validationErrors)||void 0===h?void 0:h.ruleTitle},A)),j.citation.ruleTitle&&e.jsx("div",i.__assign({style:G},{children:e.jsx(n.InputDataReasoningCard,{isVisible:w.ruleTitle,citation:j.citation.ruleTitle,citations:Z("ruleTitle"),fieldName:"Rule Title",fieldValue:j.ruleTitle})})),e.jsx(a.ScopeSection,i.__assign({id:"scope",title:"",required:!1,scopeData:j.scopeData,onScopeChange:I.onScopeChange,tierLabel:"Which tiers should this learning apply to?",stationLabel:"Which scope should this learning belong to?",highlights:E,isOpen:w.scopeData,onToggle:function(){return $("scopeData")},showCognitiveIcon:j.citation.scopeData,cognitiveIcon:e.jsx(d.ButtonCognitiveIcon,{}),tooltipDescription:"Why this Scope?",errorMessage:(null===(x=A.validationErrors)||void 0===x?void 0:x.station)||(null===(y=A.validationErrors)||void 0===y?void 0:y.tiers),stationErrorMessage:null===(_=A.validationErrors)||void 0===_?void 0:_.station,tierErrorMessage:null===(S=A.validationErrors)||void 0===S?void 0:S.tiers,readOnly:"Create"!==(null==A?void 0:A.usedFor)||(null==A?void 0:A.isAiStreaming)||!q},A)),j.citation.scopeData&&e.jsx("div",i.__assign({style:G},{children:e.jsx(n.InputDataReasoningCard,{isVisible:w.scopeData,citation:j.citation.scopeData,citations:Z("scopeData"),fieldName:"Scope",fieldValue:null===(T=null===(D=j.scopeData)||void 0===D?void 0:D.tiers)||void 0===T?void 0:T.join(", ")})})),!q||L?null: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:J,style:{background:"none",border:"none",color:"#6b7280",fontSize:"14px",fontWeight:"500",cursor:"pointer",padding:"0"}},{children:"Discard Changes"})),e.jsxs("button",i.__assign({onClick:H,style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 16px",borderRadius:"12px",border:"none",backgroundColor:"#2563eb",color:"#ffffff",fontSize:"14px",fontWeight:"500",cursor:"pointer",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.05)"}},{children:[e.jsx(c.Check,{size:18,strokeWidth:2.5,color:"#ffffff"}),"Save Changes"]}))]})),"rule-setup"===(null==A?void 0:A.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===(m=null===(C=null==A?void 0:A.tierOptions)||void 0===C?void 0:C.filter(function(i){var e,t;return null===(t=null===(e=j.scopeData)||void 0===e?void 0:e.tiers)||void 0===t?void 0:t.includes(i)}))||void 0===m?void 0:m.map(function(t,a,d){var c,u,p,g,f=t.toLowerCase().replace(/ /g,"_"),h=(null===(c=j.variantsByTier)||void 0===c?void 0:c[f])||[],x=h.length,y=!1;if(1===x){var _=h[0],S=!(null===(u=null==_?void 0:_.ruleDescription)||void 0===u?void 0:u.trim()),D=(null===(p=null==_?void 0:_.whenToApplyConditions)||void 0===p?void 0:p.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;S&&!D&&!T&&(y=!0)}var C=y?void 0:"".concat(x," ").concat(1===x?"variant":"variants"," configured for this tier"),m=!((null==A?void 0:A.defaultTierOpen)>=0)||a===A.defaultTierOpen;return console.log("Rendering tier : ",t),e.jsx(s.default,i.__assign({variant:"tier-header",title:{type:"other",label:t},subtitle:C,defaultOpen:m,footerData:{description:"Variants for ".concat(t)}},{children:e.jsx(v,i.__assign({onAddVariant:function(){var i;return null===(i=I.addNewVariant)||void 0===i?void 0:i.call(I,f)},isDisabled:null==A?void 0:A.isAiStreaming},{children:h.map(function(t,a){var d,c,u,p,v,g,h,x,y,_,S,D=t.variantType||"default",T="".concat(f,"-variant-").concat(a),C=!0===t.is_variant,m="default"===D||"default_variant"===D;(null==A?void 0:A.defaultVariantOpen)>=0&&A.defaultVariantOpen;var j="".concat(f,"_").concat(a),E=b.get(j)||{},O=(null===(c=null===(d=A.separationItemsByTier)||void 0===d?void 0:d[f])||void 0===c?void 0:c.get(a))||[],R=(null===(p=null===(u=A.togglesByTier)||void 0===u?void 0:u[f])||void 0===p?void 0:p.get(a))||[],V=(null==A?void 0:A.autoScrollVariantIndex)===a||!0===t.is_variant;console.log("Rendering ".concat(f," variant ").concat(a,":"),t),console.log("Rendering Variant : ",t),console.log("Open Accordion ID:",N,"Current Variant ID:",T);var q=null===(v=null==A?void 0:A.activeEditId)||void 0===v?void 0:v.startsWith("condition-wta-".concat(f,"-").concat(a)),M=null===(g=null==A?void 0:A.activeEditId)||void 0===g?void 0:g.startsWith("condition-wnta-".concat(f,"-").concat(a));return e.jsx("div",i.__assign({ref:V?Q:null,style:{width:"100%"}},{children:e.jsx(s.default,i.__assign({title:{type:m?"default":"variant",label:X(D),number:a+1,isNewVariant:C,isDefault:t.isDefault,isModified:t.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==A?void 0:A.setActiveVariantAccordionIndex)||void 0===i||i.call(A,e?null:a)},variant:"rule-behavior",footerData:{ruleTitle:D,description:t.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:A.ruleDescriptionTitle||"Rule Description",rows:2,placeholder:"Explain the learning behaviour",required:!0,readOnly:t.isReadOnly||(null==A?void 0:A.isAiStreaming)||Y&&(null==A?void 0:A.activeEditId)!=="rule-description-".concat(f,"-").concat(a),value:t.ruleDescription||"",onChange:function(i){return I.setRuleDescription(f,a,i)},isOpen:w["ruleDescription-".concat(f,"-").concat(a)],onToggle:function(){return $("ruleDescription-".concat(f,"-").concat(a))},isHighlighted:E.ruleDescription||!1,showCognitiveIcon:null===(h=t.reasoning)||void 0===h?void 0:h.ruleDescription,tooltipDescription:"Why this Description?",errorMessage:null===(x=A.validationErrors)||void 0===x?void 0:x["ruleDescription-".concat(f,"-").concat(a)],enableInlineEdit:!0,setSendMessageInChat:null==A?void 0:A.setSendMessageInChat,isAiStreaming:null==A?void 0:A.isAiStreaming,fieldName:"Rule Description"},A)),(null===(y=t.reasoning)||void 0===y?void 0:y.ruleDescription)&&e.jsx("div",i.__assign({style:G},{children:e.jsx(n.InputDataReasoningCard,{isVisible:w["ruleDescription-".concat(f,"-").concat(a)],citation:t.reasoning.ruleDescription,citations:Z("ruleDescription_".concat(f,"_").concat(a)),fieldName:"Rule Description",fieldValue:t.ruleDescription})})),e.jsx(o.ConditionSection,i.__assign({id:"when-to-apply-".concat(f,"-").concat(a),idPrefix:"condition-wta",title:A.whenToApplyTitle||"When to apply",required:!0,dividerRequired:!0,readOnly:t.isReadOnly||(null==A?void 0:A.isAiStreaming)||Y&&!q,conditions:t.whenToApplyConditions||[],onAdd:function(){return I.addWhenToApply(f,a)},onRemove:function(i,e,t){return I.removeWhenToApply(i,e,t)},onEdit:function(i,e,t,n){return I.editWhenToApply(i,e,t,n)},index:a,tierKey:f,isHighlighted:E.wta||!1,highlightedIds:null==A?void 0:A.highlightedIds,tooltipDescription:"Why this Condition?",citations:Z("whenToApply_".concat(f,"_").concat(a)),bordered:!0,addLabel:"Add When to apply",isAiStreaming:A.isAiStreaming,errorMessage:(null===(_=A.validationErrors)||void 0===_?void 0:_["whenToApply-".concat(f,"-").concat(a)])||(null==A?void 0:A.conflictReason)},A)),e.jsx(o.ConditionSection,i.__assign({id:"when-not-to-apply-".concat(f,"-").concat(a),idPrefix:"condition-wnta",title:A.whenNotToApplyTitle||"When NOT to apply",required:!1,dividerRequired:!0,readOnly:t.isReadOnly||(null==A?void 0:A.isAiStreaming)||Y&&!M,conditions:t.whenNotToApplyConditions||[],onAdd:function(){return I.addWhenNotToApply(f,a)},onRemove:function(i,e,t){return I.removeWhenNotToApply(i,e,t)},onEdit:function(i,e,t,n){return I.editWhenNotToApply(i,e,t,n)},index:a,tierKey:f,isHighlighted:E.wnta||!1,highlightedIds:null==A?void 0:A.highlightedIds,tooltipDescription:"Why this Condition?",citations:Z("whenNotToApply_".concat(f,"_").concat(a)),bordered:!0,addLabel:"Add When NOT to apply",isAiStreaming:A.isAiStreaming},A)),e.jsx(l.ConfigSection,i.__assign({id:"config-".concat(f,"-").concat(a),title:A.configTitle||"Configuration",required:!1,highlights:E,bordered:!0,readOnly:t.isReadOnly||(null==A?void 0:A.isAiStreaming)||Y,onConfigChange:function(i,e){return I.onConfigChange(f,a,i,e)},separationItems:O,toggles:R,index:a},A)),(null===(S=t.reasoning)||void 0===S?void 0:S.configData)&&e.jsx("div",i.__assign({style:G},{children:e.jsx(n.InputDataReasoningCard,{citation:t.reasoning.configData,citations:Z("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
- "use strict";function r(r){return r.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}function e(e){try{return JSON.parse(e)}catch(a){var n=e;return n=(n=(n=n.replace(/,\s*([}\]])/g,"$1")).replace(/<ai_reasoning>[\s\S]*?<\/ai_reasoning>/g,function(e){return r(e)})).replace(/<explaination[\s\S]*?<\/explaination>/g,function(e){return r(e)}),JSON.parse(n)}}Object.defineProperty(exports,"__esModule",{value:!0});exports.buildAiReasoning=function(r){if(!r)return null;var e={id:null==r?void 0:r.id,reason:null==r?void 0:r.reason,gap:null==r?void 0:r.gap,score:(null==r?void 0:r.relevance_score)||(null==r?void 0:r.score)};return!(e.id||e.reason||e.gap||null!=e.score&&""!==e.score)?null:e},exports.extractReasoningFromText=function(r){if(null==r)return{text:"",aiReasoning:null};var e="",n=(e="string"==typeof r?r:Array.isArray(r)?r.join(", "):"object"==typeof r?JSON.stringify(r):String(r)).match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),a=null,o=e;if(n){var t=n[1],i=function(r){var e=t.match(new RegExp("<".concat(r,">([\\s\\S]*?)<\\/").concat(r,">"),"i"));return e?e[1].replace(/\\n/g,"\n").trim():""};a={id:i("id"),reason:i("reason"),gap:i("gap"),score:i("relevance_score")||i("score")},o=e.replace(/<ai_reasoning>[\s\S]*?<\/ai_reasoning>/gi,"").trim()}return{text:o,aiReasoning:a}},exports.parseJsonBlocks=function(r){for(var n,a=/<!--\s*```json\s+property="([^"]+)"\s*([\s\S]*?)```\s*-->/gi,o=[];null!==(n=a.exec(r));){var t=n[0],i=n[1],s=n[2].trim();try{var c=e(s);o.push({property:i,data:c,rawMatch:t})}catch(r){var l="".concat(i,"::").concat(s.slice(0,40));console.warn('Failed to parse JSON for property="'.concat(i,'" warnId="').concat(l,'":'),r),console.warn("👉 Raw JSON string:",s),console.warn("👉 Error:"),console.warn(r),o.push({property:i,data:null,rawMatch:t})}}return o},exports.safeParse=e,exports.sanitizeBlock=r;
1
+ "use strict";function r(r){return r.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}function e(e){try{return JSON.parse(e)}catch(a){var n=e.replace(/`/g,"\\`");return n=(n=(n=function(r){return r.replace(/,\s*([}\]])/g,"$1")}(n=n.replace(/"([^"\\]*(\\.[^"\\]*)*)"/g,function(r){return r.replace(/\n/g,"\\n")}))).replace(/<ai_reasoning>[\s\S]*?<\/ai_reasoning>/g,function(e){return r(e)})).replace(/<explaination[\s\S]*?<\/explaination>/g,function(e){return r(e)}),JSON.parse(n)}}Object.defineProperty(exports,"__esModule",{value:!0});exports.buildAiReasoning=function(r){if(!r)return null;var e={id:null==r?void 0:r.id,reason:null==r?void 0:r.reason,gap:null==r?void 0:r.gap,score:(null==r?void 0:r.relevance_score)||(null==r?void 0:r.score)};return!(e.id||e.reason||e.gap||null!=e.score&&""!==e.score)?null:e},exports.extractReasoningFromText=function(r){if(null==r)return{text:"",aiReasoning:null};var e="",n=(e="string"==typeof r?r:Array.isArray(r)?r.join(", "):"object"==typeof r?JSON.stringify(r):String(r)).match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),a=null,o=e;if(n){var t=n[1],i=function(r){var e=t.match(new RegExp("<".concat(r,">([\\s\\S]*?)<\\/").concat(r,">"),"i"));return e?e[1].replace(/\\n/g,"\n").trim():""};a={id:i("id"),reason:i("reason"),gap:i("gap"),score:i("relevance_score")||i("score")},o=e.replace(/<ai_reasoning>[\s\S]*?<\/ai_reasoning>/gi,"").trim()}return{text:o,aiReasoning:a}},exports.parseJsonBlocks=function(r){for(var n,a=/<!--\s*```json\s+property="([^"]+)"\s*([\s\S]*?)```\s*-->/gi,o=[];null!==(n=a.exec(r));){var t=n[0],i=n[1],c=n[2].trim();try{var s=e(c);o.push({property:i,data:s,rawMatch:t})}catch(r){var l="".concat(i,"::").concat(c.slice(0,40));console.warn('Failed to parse JSON for property="'.concat(i,'" warnId="').concat(l,'":'),r),console.warn("👉 Raw JSON string:",c),console.warn("👉 Error:"),console.warn(r),o.push({property:i,data:null,rawMatch:t})}}return o},exports.safeParse=e,exports.sanitizeBlock=r;
2
2
  //# sourceMappingURL=message-rendering-utils.js.map
@@ -1,2 +1,2 @@
1
- "use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}Object.defineProperty(exports,"__esModule",{value:!0});t(require("style-inject")).default('@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;700&display=swap");.InstantLearning-module_customFont__kxKC-{font-family:Plus Jakarta Sans,sans-serif}'),exports.default={customFont:"InstantLearning-module_customFont__kxKC-"};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});require("../../node_modules/style-inject/dist/style-inject.es.js").default('@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;700&display=swap");.InstantLearning-module_customFont__kxKC-{font-family:Plus Jakarta Sans,sans-serif}'),exports.default={customFont:"InstantLearning-module_customFont__kxKC-"};
2
2
  //# sourceMappingURL=InstantLearning.module.css.js.map
@@ -1,2 +1,2 @@
1
- "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});e(require("style-inject")).default('@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400..900&display=swap");body{font-family:Inter,sans-serif}.WtaWnta-module_parentContainer__-2Txc{align-items:center;display:flex;flex-direction:column;gap:24px;width:100%}'),exports.default={parentContainer:"WtaWnta-module_parentContainer__-2Txc"};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});require("../../node_modules/style-inject/dist/style-inject.es.js").default('@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400..900&display=swap");body{font-family:Inter,sans-serif}.WtaWnta-module_parentContainer__-2Txc{align-items:center;display:flex;flex-direction:column;gap:24px;width:100%}'),exports.default={parentContainer:"WtaWnta-module_parentContainer__-2Txc"};
2
2
  //# sourceMappingURL=WtaWnta.module.css.js.map
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(e,t){void 0===t&&(t={});var d=t.insertAt;if(e&&"undefined"!=typeof document){var s=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===d&&s.firstChild?s.insertBefore(n,s.firstChild):s.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}};
2
+ //# sourceMappingURL=style-inject.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style-inject.es.js","sources":["../../../../../node_modules/style-inject/dist/style-inject.es.js"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n"],"names":["css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode"],"mappings":"oFAAA,SAAqBA,EAAKC,QACN,IAAbA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAKF,GAA2B,oBAAbG,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,GAnBY,CAqB1D"}
@@ -1,2 +1,2 @@
1
- import t from"style-inject";var a={customFont:"InstantLearning-module_customFont__v-AvE"};t('@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;700&display=swap");.InstantLearning-module_customFont__v-AvE{font-family:Plus Jakarta Sans,sans-serif}');export{a as default};
1
+ import s from"../../node_modules/style-inject/dist/style-inject.es.js";var t={customFont:"InstantLearning-module_customFont__v-AvE"};s('@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;700&display=swap");.InstantLearning-module_customFont__v-AvE{font-family:Plus Jakarta Sans,sans-serif}');export{t as default};
2
2
  //# sourceMappingURL=InstantLearning.module.css.js.map
@@ -1,2 +1,2 @@
1
- import t from"style-inject";var a={customFont:"InstantLearning-module_customFont__ien5h"};t('@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;700&display=swap");.InstantLearning-module_customFont__ien5h{font-family:Plus Jakarta Sans,sans-serif}');export{a as default};
1
+ import s from"../../node_modules/style-inject/dist/style-inject.es.js";var t={customFont:"InstantLearning-module_customFont__ien5h"};s('@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;700&display=swap");.InstantLearning-module_customFont__ien5h{font-family:Plus Jakarta Sans,sans-serif}');export{t as default};
2
2
  //# sourceMappingURL=InstantLearning.module.css.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"tslib";import{jsxs as i,jsx as r,Fragment as t}from"react/jsx-runtime";import{useState as o,useEffect as n}from"react";import{ChevronUp as d,ChevronDown as l}from"lucide-react";var a=function(a){var p,s,c=a.title,x=a.subtitle,f=a.children,g=a.defaultOpen,h=void 0===g||g,u=a.footerData,v=a.readOnly,b=void 0!==v&&v,y=a.variant,m=void 0===y?"default":y,F=a.expanded,w=a.onToggle,D=a.actionButtons,C=a.isAiStreaming,E=o(h),z=E[0],S=E[1];n(function(){S(h)},[h]);var I=void 0!==F,k=I?F:z,B=function(){I?null==w||w():S(!k)},R="variant"===c.type,A="other"===c.type,T="tier-header"===m,W="rule-behavior"===m,L={padding:"12px 14px 0px 14px",display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",borderRadius:T?"0px":"8px",borderBottom:T?"1px solid #E2E8F0":"none"},N={alignItems:"center",gap:"8px",margin:0,fontSize:"12px",fontWeight:600,padding:A?"":"6px 10px",borderRadius:"4px",color:b?"#717b8c":T&&k?"#2563EB":"#19213D",backgroundColor:W&&!c.isNewVariant?"#F7F8FA":R?"#FDF2F8":c.isDefault?"#F7F8FA":"transparent",border:R?"1px solid #FCE7F3":c.isDefault?"1px solid #F0F2F5":"none"},j={fontSize:"12px",fontWeight:400,color:"#666F8D",paddingLeft:A?"0px":"10px"},O={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:T?"none":W&&k?"1px solid #2563EB":"1px solid #E2E8F0",borderRadius:"8px",marginBottom:"0px"}},{children:[i("div",e({onClick:B,style:L},{children:[i("div",e({style:{display:"flex",flexDirection:"column",gap:"4px",margin:0,fontSize:"12px",fontWeight:600,borderRadius:"4px"}},{children:[!c.isNewVariant&&i("div",e({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[r("div",e({style:N},{children:c.label})),c.isDefault&&r("span",e({style:O.defaultTag},{children:"Default"})),c.isModified&&r("span",e({style:O.modifiedTag},{children:"MODIFIED"}))]})),r("div",{children:c.isNewVariant&&i("div",e({style:O.badge},{children:[r("svg",e({width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor"},{children:r("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"})})),r("div",{children:"New Variant"})]}))}),x&&r("div",e({style:j},{children:x}))]})),i("div",e({style:{display:"flex",alignItems:"center",gap:"12px",paddingRight:"4px"}},{children:[D&&!C&&r("div",e({onClick:function(e){return e.stopPropagation()}},{children:D(k,B)})),r("div",e({onClick:B,style:{cursor:"pointer",display:"flex",alignItems:"center"}},{children:k?r(d,{size:18,color:T?"#2563EB":"#64748B"}):r(l,{size:18,color:"#64748B"})}))]}))]})),!k&&u&&r("div",e({style:{fontSize:"12px",color:"#475569",fontWeight:400,padding:"0 16px 12px 16px",display:"flex",alignItems:"center",gap:"8px"}},{children:A?i(t,{children:[r("span",e({style:{fontWeight:500,color:"#475569"}},{children:u.ruleTitle||"No Title"})),(null!==(s=null===(p=u.tiers)||void 0===p?void 0:p.length)&&void 0!==s?s:0)>0&&i(t,{children:[r("div",{style:{width:"4px",height:"4px",backgroundColor:"#676970",borderRadius:"50%"}}),r("span",{children:Array.isArray(u.tiers)?u.tiers.join(", "):u.tiers})]})]}):r("span",e({style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},{children:u.description}))})),k&&r("div",e({style:{padding:"12px"}},{children:f}))]}))};export{a as default};
1
+ import{__assign as e}from"tslib";import{jsxs as i,jsx as r,Fragment as t}from"react/jsx-runtime";import{useState as o,useEffect as n}from"react";import{ChevronUp as d,ChevronDown as l}from"lucide-react";var a=function(a){var p,s,c=a.title,x=a.subtitle,f=a.children,g=a.defaultOpen,h=void 0===g||g,u=a.footerData,v=a.readOnly,b=void 0!==v&&v,y=a.variant,m=void 0===y?"default":y,F=a.expanded,w=a.onToggle,D=a.actionButtons,C=a.isAiStreaming,E=a.editFlow,z=void 0!==E&&E,S=o(h),I=S[0],k=S[1];n(function(){k(h)},[h]);var B=void 0!==F,R=B?F:I,A=function(){B?null==w||w():k(!R)},T="variant"===c.type,W="other"===c.type,L="tier-header"===m,N="rule-behavior"===m,j={padding:"12px 14px 0px 14px",display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",borderRadius:L?"0px":"8px",borderBottom:L?"1px solid #E2E8F0":"none"},O={alignItems:"center",gap:"8px",margin:0,fontSize:"12px",fontWeight:600,padding:W?"":"6px 10px",borderRadius:"4px",color:b?"#717b8c":L&&R?"#2563EB":"#19213D",backgroundColor:N&&!c.isNewVariant?"#F7F8FA":T?"#FDF2F8":c.isDefault?"#F7F8FA":"transparent",border:T?"1px solid #FCE7F3":c.isDefault?"1px solid #F0F2F5":"none"},V={fontSize:"12px",fontWeight:400,color:"#666F8D",paddingLeft:W?"0px":"10px"},M={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&&R?"1px solid #2563EB":"1px solid #E2E8F0",borderRadius:"8px",marginBottom:"0px"}},{children:[i("div",e({onClick:A,style:j},{children:[i("div",e({style:{display:"flex",flexDirection:"column",gap:"4px",margin:0,fontSize:"12px",fontWeight:600,borderRadius:"4px"}},{children:[!c.isNewVariant&&i("div",e({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[r("div",e({style:O},{children:c.label})),c.isDefault&&r("span",e({style:M.defaultTag},{children:"Default"})),c.isModified&&r("span",e({style:M.modifiedTag},{children:"MODIFIED"}))]})),r("div",{children:c.isNewVariant&&i("div",e({style:M.badge},{children:[r("svg",e({width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor"},{children:r("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"})})),r("div",{children:"New Variant"})]}))}),x&&r("div",e({style:V},{children:x}))]})),i("div",e({style:{display:"flex",alignItems:"center",gap:"12px",paddingRight:"4px"}},{children:[D&&!C&&!z&&r("div",e({onClick:function(e){return e.stopPropagation()}},{children:D(R,A)})),r("div",e({onClick:A,style:{cursor:"pointer",display:"flex",alignItems:"center"}},{children:R?r(d,{size:18,color:L?"#2563EB":"#64748B"}):r(l,{size:18,color:"#64748B"})}))]}))]})),!R&&u&&r("div",e({style:{fontSize:"12px",color:"#475569",fontWeight:400,padding:"0 16px 12px 16px",display:"flex",alignItems:"center",gap:"8px"}},{children:W?i(t,{children:[r("span",e({style:{fontWeight:500,color:"#475569"}},{children:u.ruleTitle||"No Title"})),(null!==(s=null===(p=u.tiers)||void 0===p?void 0:p.length)&&void 0!==s?s:0)>0&&i(t,{children:[r("div",{style:{width:"4px",height:"4px",backgroundColor:"#676970",borderRadius:"50%"}}),r("span",{children:Array.isArray(u.tiers)?u.tiers.join(", "):u.tiers})]})]}):r("span",e({style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},{children:u.description}))})),R&&r("div",e({style:{padding:"12px"}},{children:f}))]}))};export{a 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{startChatStream 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 F from"../_svg/SparkleIcon.js";import{UserIcon as A}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})},j=function(q){var j=q.chatAssistantName,z=q.organizationName,P=q.baseUrl,B=q.baseWebsocketUrl,H=q.setIsNewChatClicked;q.ThinkingBulbIconComponent;var G=q.isFormSaveClicked,Z=q.setIsFormSavedClicked,K=q.onResetLearningData,U=q.sendMessageInChat,O=q.setSendMessageInChat,V=q.isFormValidating,Q=q.chatTitle,J=q.customMetaData,$=q.headerMessageHandlers;q.aiResponse;var X=q.setAIResponse,Y=q.onResetChat,ee=q.initialChatMessage,ne=void 0===ee?"":ee,te=q.onSave,ie=q.chatSize,oe=q.setChatSize,ae=q.movingTowards,re=q.setCitations,se=q.textareaPlaceholder,le=void 0===se?"Tell me more about this learning...":se,de=q.setCurrentRequestId,ce=q.showSavedMessage,ue=void 0!==ce&&ce,ve=q.savedMessage,me=q.isError,he=void 0!==me&&me,pe=q.errorMessage,ge=void 0===pe?"There was an error saving your changes.":pe;q.isSaving;var fe=q.isHighlighted,Ce=void 0!==fe&&fe,ye=q.onStreamingStateChange,be=q.onViewComparison;q.isCopyEnabled;var we=q.onComparisonLinkClick,Se=q.onSubmitFeedback,xe=q.userDetails,ke=q.isGlobalEditActive,_e=j,Ee=d("".concat(_e,"-").concat(z,"-").concat(b())),Te=d("".concat(b())),Me=P,Ie=d(null),Ne=d(!0),De=d(null),Re=d(null),Le=c(""),Fe=Le[0],Ae=Le[1],We=c([]),qe=We[0],je=We[1],ze=c(!1),Pe=ze[0],Be=ze[1],He=c(!1);He[0];var Ge=He[1],Ze=c(!0),Ke=Ze[0],Ue=Ze[1],Oe=c(!0);Oe[0];var Ve=Oe[1],Qe=c("");Qe[0];var Je=Qe[1],$e=c(""),Xe=$e[0],Ye=$e[1],en=c(!1),nn=en[0],tn=en[1],on=c(!1),an=on[0],rn=on[1],sn=c(!0),ln=sn[0],dn=sn[1],cn=c("100%");cn[0];var un=cn[1],vn=c(null),mn=vn[0],hn=vn[1],pn=c(!1);pn[0];var gn=pn[1],fn=c(!1),Cn=fn[0],yn=fn[1],bn=d(null),wn=d(new Set),Sn=c(null),xn=Sn[0],kn=Sn[1],_n=c(!1),En=_n[0],Tn=_n[1],Mn=c(!1);Mn[0],Mn[1];var In=c(null);In[0],In[1],d(null),d(null);var Nn=d(new Map),Dn=d(""),Rn=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 Ln=u(function(){return""===(null==Fe?void 0:Fe.trim())||nn},[Fe,nn]),Fn=u(function(){return V},[V]),An=u(function(){return Ln||nn||V||!!ke},[Ln,nn,V,ke]);v(function(){null==ye||ye(nn)},[nn,ye]),v(function(){var e=Ie.current,n=function(){if(e){var n=e.scrollTop,t=e.scrollHeight,i=e.clientHeight;dn(t-n-i<=20)}};return e&&(e.addEventListener("scroll",n),n()),function(){e&&e.removeEventListener("scroll",n)}},[qe]);var Wn=D({handlers:$,setResult:X}).processHeaderMessage;v(function(){ue&&yn(!0)},[ue]),v(function(){if(En){var e=setTimeout(function(){Tn(!1)},3e3);return function(){return clearTimeout(e)}}},[En]),v(function(){G&&(Hn(new KeyboardEvent("keydown",{key:"Enter"}),!1,"Save this Learning"),Z(!1))},[G]),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 je(function(e){return n(n([],e,!0),[a],!1)}),Hn(new KeyboardEvent("keydown",{key:"Enter"}),!1,o,!1,i),kn(i),O&&O(""),void setTimeout(function(){kn(null)},2e3)}if(U.startsWith("__SKELETON_END__::")){var r=U.split("::")[1]||"";return je(function(e){return e.map(function(e){return e.isSkeleton?t(t({},e),{isSkeleton:!1,content:e.skeletonContent||r}):e})}),void(O&&O(""))}var s=b();Hn(new KeyboardEvent("keydown",{key:"Enter"}),!1,U,!1,s),kn(s),O&&O(""),setTimeout(function(){return kn(null)},2e3)}catch(e){console.error("Error handling sendMessageInChat signal",e)}},[U]),v(function(){jn(),zn();var e=function(){var e,n=(null===(e=null==bn?void 0:bn.current)||void 0===e?void 0:e.clientHeight)||0,t="calc(100% - ".concat(n,"px - 10px)");un(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";De.current&&De.current.scrollIntoView({behavior:n,block:"end"}),Ne.current&&setTimeout(function(){De.current&&Ne.current&&De.current.scrollIntoView({behavior:n,block:"end"})},100)},[]);v(function(){if(!nn){var e="";if(Cn?e=ve||"Thank you teacher for teaching me, your rule has been saved successfully.":he&&(e=ge||"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};je(function(e){return n(n([],e,!0),[t],!1)}),yn(!1),setTimeout(function(){return qn("smooth")},100)}}},[Cn,he,nn,ve,ge,qn]),v(function(){Ne.current&&qn("smooth")},[qn]);var jn=function(){var e={method:"get",maxBodyLength:1/0,url:"".concat(Me,"/api/chatbot/getChatSettings?name=").concat(_e,"&organizationName=").concat(z),headers:{}};y.request(e).then(function(e){var n,t,i;(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.chatSettings)&&""!==(null===(i=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.chatSettings)||void 0===i?void 0:i.chatInitialMessage)&&Ve(!0)}).catch(function(e){console.error(e)})},zn=function(){return i(void 0,void 0,void 0,function(){var e,n;return o(this,function(t){e="".concat(Me,"/api/chat/history?name=").concat(_e,"&organizationName=").concat(z);try{n={method:"GET",params:{guestSessionId:Ee.current},withCredentials:!0},y.get(e,n).then(function(e){var n=e.data;n.length>0?(je(n),qn()):Ve(!0)}).catch(function(e){console.error(e)})}catch(e){Be(!1),console.error(e)}return[2]})})};function Pn(e){return null==e?void 0:e.replace(/<a [^>]*>.*?<\/a>/g,function(e){return null==e?void 0:e.replace(/\*/g,"&ast;")})}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,F,A,W,q,j,z;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 P={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(P)}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&&re&&re(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: "))Ge(!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&&(Be(!1),je(n(n([],qe,!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{Ge(!1);var K=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 K&&K&&de&&de(K);var U=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=Pn(_),!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,Rn);U.time=new Date,U.citations=G,U.isEnd=null===(I=null===(M=null==e?void 0:e.chatStream)||void 0===M?void 0:M.continueChatResult)||void 0===I?void 0:I.isEnd,U.requestId=null===(D=null===(N=null==e?void 0:e.chatStream)||void 0===N?void 0:N.continueChatResult)||void 0===D?void 0:D.requestId,U.sessionId=Ee.current,null===(R=U.orchestratorAndAgentsMessages)||void 0===R||R.forEach(function(e){e&&e.header_message&&Wn(e)}),(""!==(null==U?void 0:U.content)||(null==U?void 0:U.orchestratorAndAgentsMessages)&&(null==U?void 0:U.orchestratorAndAgentsMessages.length)>0)&&(Be(!1),je(n(n([],qe,!0),[{role:"user",content:r||"",time:a,isFirstQuestionSent:s||!1,id:l||(null===(F=null===(L=null==e?void 0:e.chatStream)||void 0===L?void 0:L.continueChatResult)||void 0===F?void 0:F.requestId)||"",requestId:null!==(q=null===(W=null===(A=null==e?void 0:e.chatStream)||void 0===A?void 0:A.continueChatResult)||void 0===W?void 0:W.requestId)&&void 0!==q?q:""},U],!1))),Ue(null===(z=null===(j=null==e?void 0:e.chatStream)||void 0===j?void 0:j.continueChatResult)||void 0===z?void 0:z.isEnd)}},Hn=function(e,i,o,a,r,s){var l,d,c,u,v,m=(void 0!==o?o:Fe||"").trim(),h="Enter"===(null==e?void 0:e.key)&&!(null==e?void 0:e.shiftKey);if(h&&(null===(l=null==e?void 0:e.preventDefault)||void 0===l||l.call(e)),!(!m||nn&&!o||(null==e?void 0:e.key)&&!h)){if("I want to add a rule description"===m){Ue(!1),Ne.current=!0,tn(!0),!mn&&m&&hn(o||"manual_entry");var p=new Date;return je(function(e){return n(n([],e.map(function(e,n){var i;return t(t({},e),{content:null===(i=Pn(e.content))||void 0===i?void 0:i.replace("WaitMessage: ","")})}),!0),[{role:"user",content:m,time:p,isFirstQuestionSent:!1,id:r||b()}],!1)}),qn("smooth"),void setTimeout(function(){je(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(){tn(!1),Ue(!0)},500)},500)}Ue(!1),Ne.current=!0,tn(!0),!mn&&m&&hn(o||"manual_entry");var g=new Date;je(function(e){var i=e.map(function(e){var n;return t(t({},e),{content:null===(n=Pn(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)}),qn("smooth");var f=new Map,C=[],y={WEBSOCKET_URL:B,organizationName:z,chatAssistantName:_e,selectedAIModel:"gpt-4",replyMessage:"",userName:null!==(d=null==xe?void 0:xe.name)&&void 0!==d?d:"Guest User",userEmailId:null!==(c=null==xe?void 0:xe.email)&&void 0!==c?c:"guestUser@example.com",userId:null!==(u=null==xe?void 0:xe.id)&&void 0!==u?u:"Guest User",query:m,requestId:"requestId-".concat(b()),customPrompt:"",enableForBackend:!1,guestSessionId:Ee.current,chatPreviewId:Te.current,customMetaData:J,aiModel:"",onStreamEvent:function(e){return Bn(e,f,C,g,m,i,r)},onStreamEnd:function(e){Ue(!0),tn(!1),gn(!1);var i=Date.now(),o=Nn.current.get(Dn.current);if(o){var a=Math.round((i-o)/1e3).toFixed(1);je(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),tn(!1),gn(!1)}};if(m)Be(!0),null===(v=Re.current)||void 0===v||v.blur(),Ae(""),qn(),Ye(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."),Nn.current.set(y.requestId,Date.now()),Dn.current=y.requestId,w(y);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))},[]),Kn=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:Ke,disabled:!!mn||!!ke,isLastMessage:!0,style:{margin:0},isTesterGenie:c,"data-selected":mn===l||mn===d?"true":mn?"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,Ke,mn,ke]),Un=u(function(){return qe.some(function(e){return e.isSkeleton})},[qe]),On=function(e){return i(void 0,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return Se?[4,Se(e)]:[3,2];case 1:t.sent(),je(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 console.log(qe,"rendering messages"),s("div",t({className:"".concat(I.customFont," ").concat(M.chatContainer),style:{transition:"box-shadow 0.3s ease-in-out",boxShadow:Ce&&!Un?"0 0 20px 5px rgba(37, 99, 235, 0.5)":"none"}},{children:[s("div",t({ref:Ie,className:M.scrollWrapper},{children:[r("div",t({ref:bn,className:M.stickyHeader},{children:r(x,{resetChatHistory:function(){var e="".concat(Me,"/api/chat/resetHistory?name=").concat(_e,"&organizationName=").concat(z);try{var n={method:"GET",params:{guestSessionId:Ee.current},withCredentials:!0};y.get(e,n).then(function(){H(!0),Je(""),hn(null),wn.current.clear(),Rn.current.clear(),Te.current="".concat(b()),je([]),Ve(!0),null==Y||Y(),K&&K()}).catch(function(e){console.error(e)}).finally(function(){Ee.current="".concat(_e,"-").concat(z,"-").concat(b())})}catch(e){Be(!1),console.error(e)}},isStreamEnd:Ke,chatTitle:Q,onResize:oe,chatSize:ie,movingTowards:ae})})),s("div",t({className:M.messagesList},{children:[s("div",t({className:M.initialMessageRow},{children:[r("div",t({className:M.iconWrapper},{children:r(F,{})})),r("div",t({className:M.welcomeTextWrapper},{children:r("div",t({className:M.welcomeMarkdownWrapper},{children:r("span",{children:r(f,t({rehypePlugins:[C],components:Kn},{children:ne}))})}))}))]})),qe.length>0&&qe.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(F,{})})):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:Ke,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:qe,handleStream:Hn,isLastMessage:n===qe.length-1,onSave:te,citations:null==e?void 0:e.citations,setChatSize:oe,chatSize:ie,isStreamEnd:Ke,messageIsEnd:null==e?void 0:e.isEnd,onViewComparison:be,onTypeResponseClick:function(){var e;Tn(!0),null===(e=Re.current)||void 0===e||e.focus()},onComparisonLinkClick:we,baseURL:Me,onFeedbackSubmit:On,isGlobalEditActive:ke}),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!==xn?"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:qe,handleStream:Hn,isLastMessage:n===qe.length-1,onSave:te,citations:null==e?void 0:e.citations,isStreamEnd:Ke,isGlobalEditActive:ke,messageIsEnd:null==e?void 0:e.isEnd,onViewComparison:be,onComparisonLinkClick:we,baseURL:Me,onFeedbackSubmit:On}),r("div",t({style:{marginTop:"0.5rem"}},{children:r(A,{})}))]})),r("div",t({className:M.userTimestamp},{children:new Date(e.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}))}))]}),e.id)}),Pe&&s("div",t({className:M.loadingRow},{children:[r("div",t({className:M.iconWrapper,style:{marginTop:"0.2rem"}},{children:r(F,{})})),r("div",t({className:M.loadingTextWrapper},{children:r("span",{children:Xe})}))]})),r("div",{ref:De,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(Fn?M.disabled:""),style:En?{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:[qe.length>0&&!ln&&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:Re,placeholder:le,value:Fe||"",onChange:function(e){Ae(e.target.value)},onFocus:function(){return rn(!0)},onBlur:function(){return rn(!1)},onKeyDown:function(e){return Hn(e)},disabled:Fn,className:"no-scrollbar ".concat(M.chatTextarea),style:{minHeight:an?"120px":"50px",height:an?"120px":"50px",maxHeight:"120px"}}),r("span",t({className:M.sendButtonWrapper},{children:r("button",t({onClick:function(e){Hn(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,j 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{startChatStream 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 F from"../_svg/SparkleIcon.js";import{UserIcon as A}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})},j=function(q){var j=q.chatAssistantName,z=q.organizationName,P=q.baseUrl,B=q.baseWebsocketUrl,H=q.setIsNewChatClicked;q.ThinkingBulbIconComponent;var G=q.isFormSaveClicked,Z=q.setIsFormSavedClicked,K=q.onResetLearningData,U=q.sendMessageInChat,O=q.setSendMessageInChat,V=q.isFormValidating,Q=q.chatTitle,J=q.customMetaData,$=q.headerMessageHandlers;q.aiResponse;var X=q.setAIResponse,Y=q.onResetChat,ee=q.initialChatMessage,ne=void 0===ee?"":ee,te=q.onSave,ie=q.chatSize,oe=q.setChatSize,ae=q.movingTowards,re=q.setCitations,se=q.textareaPlaceholder,le=void 0===se?"Tell me more about this learning...":se,de=q.setCurrentRequestId,ce=q.showSavedMessage,ue=void 0!==ce&&ce,ve=q.savedMessage,me=q.isError,he=void 0!==me&&me,pe=q.errorMessage,ge=void 0===pe?"There was an error saving your changes.":pe;q.isSaving;var fe=q.isHighlighted,Ce=void 0!==fe&&fe,ye=q.onStreamingStateChange,be=q.onViewComparison;q.isCopyEnabled;var we=q.onComparisonLinkClick,Se=q.onSubmitFeedback,xe=q.userDetails,ke=q.isGlobalEditActive,_e=j,Ee=d("".concat(_e,"-").concat(z,"-").concat(b())),Te=d("".concat(b())),Me=P,Ie=d(null),Ne=d(!0),De=d(null),Re=d(null),Le=c(""),Fe=Le[0],Ae=Le[1],We=c([]),qe=We[0],je=We[1],ze=c(!1),Pe=ze[0],Be=ze[1],He=c(!1);He[0];var Ge=He[1],Ze=c(!0),Ke=Ze[0],Ue=Ze[1],Oe=c(!0);Oe[0];var Ve=Oe[1],Qe=c("");Qe[0];var Je=Qe[1],$e=c(""),Xe=$e[0],Ye=$e[1],en=c(!1),nn=en[0],tn=en[1],on=c(!1),an=on[0],rn=on[1],sn=c(!0),ln=sn[0],dn=sn[1],cn=c("100%");cn[0];var un=cn[1],vn=c(null),mn=vn[0],hn=vn[1],pn=c(!1);pn[0];var gn=pn[1],fn=c(!1),Cn=fn[0],yn=fn[1],bn=d(null),wn=d(new Set),Sn=c(null),xn=Sn[0],kn=Sn[1],_n=c(!1),En=_n[0],Tn=_n[1],Mn=c(!1);Mn[0],Mn[1];var In=c(null);In[0],In[1],d(null),d(null);var Nn=d(new Map),Dn=d(""),Rn=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 Ln=u(function(){return""===(null==Fe?void 0:Fe.trim())||nn},[Fe,nn]),Fn=u(function(){return V},[V]),An=u(function(){return Ln||nn||V||!!ke},[Ln,nn,V,ke]);v(function(){null==ye||ye(nn)},[nn,ye]),v(function(){var e=Ie.current,n=function(){if(e){var n=e.scrollTop,t=e.scrollHeight,i=e.clientHeight;dn(t-n-i<=20)}};return e&&(e.addEventListener("scroll",n),n()),function(){e&&e.removeEventListener("scroll",n)}},[qe]);var Wn=D({handlers:$,setResult:X}).processHeaderMessage;v(function(){ue&&yn(!0)},[ue]),v(function(){if(En){var e=setTimeout(function(){Tn(!1)},3e3);return function(){return clearTimeout(e)}}},[En]),v(function(){G&&(Hn(new KeyboardEvent("keydown",{key:"Enter"}),!1,"Save this Learning"),Z(!1))},[G]),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 je(function(e){return n(n([],e,!0),[a],!1)}),Hn(new KeyboardEvent("keydown",{key:"Enter"}),!1,o,!1,i),kn(i),O&&O(""),void setTimeout(function(){kn(null)},2e3)}if(U.startsWith("__SKELETON_END__::")){var r=U.split("::")[1]||"";return je(function(e){return e.map(function(e){return e.isSkeleton?t(t({},e),{isSkeleton:!1,content:e.skeletonContent||r}):e})}),void(O&&O(""))}var s=b();Hn(new KeyboardEvent("keydown",{key:"Enter"}),!1,U,!1,s),kn(s),O&&O(""),setTimeout(function(){return kn(null)},2e3)}catch(e){console.error("Error handling sendMessageInChat signal",e)}},[U]),v(function(){jn(),zn();var e=function(){var e,n=(null===(e=null==bn?void 0:bn.current)||void 0===e?void 0:e.clientHeight)||0,t="calc(100% - ".concat(n,"px - 10px)");un(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";De.current&&De.current.scrollIntoView({behavior:n,block:"end"}),Ne.current&&setTimeout(function(){De.current&&Ne.current&&De.current.scrollIntoView({behavior:n,block:"end"})},100)},[]);v(function(){if(!nn){var e="";if(Cn?e=ve||"Thank you teacher for teaching me, your rule has been saved successfully.":he&&(e=ge||"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};je(function(e){return n(n([],e,!0),[t],!1)}),yn(!1),setTimeout(function(){return qn("smooth")},100)}}},[Cn,he,nn,ve,ge,qn]),v(function(){Ne.current&&qn("smooth")},[qn]);var jn=function(){var e={method:"get",maxBodyLength:1/0,url:"".concat(Me,"/api/chatbot/getChatSettings?name=").concat(_e,"&organizationName=").concat(z),headers:{}};y.request(e).then(function(e){var n,t,i;(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.chatSettings)&&""!==(null===(i=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.chatSettings)||void 0===i?void 0:i.chatInitialMessage)&&Ve(!0)}).catch(function(e){console.error(e)})},zn=function(){return i(void 0,void 0,void 0,function(){var e,n;return o(this,function(t){e="".concat(Me,"/api/chat/history?name=").concat(_e,"&organizationName=").concat(z);try{n={method:"GET",params:{guestSessionId:Ee.current},withCredentials:!0},y.get(e,n).then(function(e){var n=e.data;n.length>0?(je(n),qn()):Ve(!0)}).catch(function(e){console.error(e)})}catch(e){Be(!1),console.error(e)}return[2]})})};function Pn(e){return null==e?void 0:e.replace(/<a [^>]*>.*?<\/a>/g,function(e){return null==e?void 0:e.replace(/\*/g,"&ast;")})}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,F,A,W,q,j,z;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 P={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(P)}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&&re&&re(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: "))Ge(!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&&(Be(!1),je(n(n([],qe,!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{Ge(!1);var K=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 K&&K&&de&&de(K);var U=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=Pn(_),!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,Rn);U.time=new Date,U.citations=G,U.isEnd=null===(I=null===(M=null==e?void 0:e.chatStream)||void 0===M?void 0:M.continueChatResult)||void 0===I?void 0:I.isEnd,U.requestId=null===(D=null===(N=null==e?void 0:e.chatStream)||void 0===N?void 0:N.continueChatResult)||void 0===D?void 0:D.requestId,U.sessionId=Ee.current,null===(R=U.orchestratorAndAgentsMessages)||void 0===R||R.forEach(function(e){e&&e.header_message&&Wn(e)}),(""!==(null==U?void 0:U.content)||(null==U?void 0:U.orchestratorAndAgentsMessages)&&(null==U?void 0:U.orchestratorAndAgentsMessages.length)>0)&&(Be(!1),je(n(n([],qe,!0),[{role:"user",content:r||"",time:a,isFirstQuestionSent:s||!1,id:l||(null===(F=null===(L=null==e?void 0:e.chatStream)||void 0===L?void 0:L.continueChatResult)||void 0===F?void 0:F.requestId)||"",requestId:null!==(q=null===(W=null===(A=null==e?void 0:e.chatStream)||void 0===A?void 0:A.continueChatResult)||void 0===W?void 0:W.requestId)&&void 0!==q?q:""},U],!1))),Ue(null===(z=null===(j=null==e?void 0:e.chatStream)||void 0===j?void 0:j.continueChatResult)||void 0===z?void 0:z.isEnd)}},Hn=function(e,i,o,a,r,s){var l,d,c,u,v,m=(void 0!==o?o:Fe||"").trim(),h="Enter"===(null==e?void 0:e.key)&&!(null==e?void 0:e.shiftKey);if(h&&(null===(l=null==e?void 0:e.preventDefault)||void 0===l||l.call(e)),!(!m||nn&&!o||(null==e?void 0:e.key)&&!h)){if("I want to add a rule description"===m){Ue(!1),Ne.current=!0,tn(!0),!mn&&m&&hn(o||"manual_entry");var p=new Date;return je(function(e){return n(n([],e.map(function(e,n){var i;return t(t({},e),{content:null===(i=Pn(e.content))||void 0===i?void 0:i.replace("WaitMessage: ","")})}),!0),[{role:"user",content:m,time:p,isFirstQuestionSent:!1,id:r||b()}],!1)}),qn("smooth"),void setTimeout(function(){je(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(){tn(!1),Ue(!0)},500)},500)}Ue(!1),Ne.current=!0,tn(!0),!mn&&m&&hn(o||"manual_entry");var g=new Date;je(function(e){var i=e.map(function(e){var n;return t(t({},e),{content:null===(n=Pn(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)}),qn("smooth");var f=new Map,C=[],y={WEBSOCKET_URL:B,organizationName:z,chatAssistantName:_e,selectedAIModel:"gpt-4",replyMessage:"",userName:null!==(d=null==xe?void 0:xe.name)&&void 0!==d?d:"Guest User",userEmailId:null!==(c=null==xe?void 0:xe.email)&&void 0!==c?c:"guestUser@example.com",userId:null!==(u=null==xe?void 0:xe.id)&&void 0!==u?u:"Guest User",query:m,requestId:"requestId-".concat(b()),customPrompt:"",enableForBackend:!1,guestSessionId:Ee.current,chatPreviewId:Te.current,customMetaData:J,aiModel:"",onStreamEvent:function(e){return Bn(e,f,C,g,m,i,r)},onStreamEnd:function(e){Ue(!0),tn(!1),gn(!1);var i=Date.now(),o=Nn.current.get(Dn.current);if(o){var a=Math.round((i-o)/1e3).toFixed(1);je(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),tn(!1),gn(!1)}};if(m)Be(!0),null===(v=Re.current)||void 0===v||v.blur(),Ae(""),qn(),Ye(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."),Nn.current.set(y.requestId,Date.now()),Dn.current=y.requestId,w(y);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))},[]),Kn=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:Ke,disabled:!!mn||!!ke,isLastMessage:!0,style:{margin:0},isTesterGenie:c,"data-selected":mn===l||mn===d?"true":mn?"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,Ke,mn,ke]),Un=u(function(){return qe.some(function(e){return e.isSkeleton})},[qe]),On=function(e){return i(void 0,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return Se?[4,Se(e)]:[3,2];case 1:t.sent(),je(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:Ce&&!Un?"0 0 20px 5px rgba(37, 99, 235, 0.5)":"none"}},{children:[s("div",t({ref:Ie,className:M.scrollWrapper},{children:[r("div",t({ref:bn,className:M.stickyHeader},{children:r(x,{resetChatHistory:function(){var e="".concat(Me,"/api/chat/resetHistory?name=").concat(_e,"&organizationName=").concat(z);try{var n={method:"GET",params:{guestSessionId:Ee.current},withCredentials:!0};y.get(e,n).then(function(){H(!0),Je(""),hn(null),wn.current.clear(),Rn.current.clear(),Te.current="".concat(b()),je([]),Ve(!0),null==Y||Y(),K&&K()}).catch(function(e){console.error(e)}).finally(function(){Ee.current="".concat(_e,"-").concat(z,"-").concat(b())})}catch(e){Be(!1),console.error(e)}},isStreamEnd:Ke,chatTitle:Q,onResize:oe,chatSize:ie,movingTowards:ae})})),s("div",t({className:M.messagesList},{children:[s("div",t({className:M.initialMessageRow},{children:[r("div",t({className:M.iconWrapper},{children:r(F,{})})),r("div",t({className:M.welcomeTextWrapper},{children:r("div",t({className:M.welcomeMarkdownWrapper},{children:r("span",{children:r(f,t({rehypePlugins:[C],components:Kn},{children:ne}))})}))}))]})),qe.length>0&&qe.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(F,{})})):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:Ke,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:qe,handleStream:Hn,isLastMessage:n===qe.length-1,onSave:te,citations:null==e?void 0:e.citations,setChatSize:oe,chatSize:ie,isStreamEnd:Ke,messageIsEnd:null==e?void 0:e.isEnd,onViewComparison:be,onTypeResponseClick:function(){var e;Tn(!0),null===(e=Re.current)||void 0===e||e.focus()},onComparisonLinkClick:we,baseURL:Me,onFeedbackSubmit:On,isGlobalEditActive:ke}),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!==xn?"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:qe,handleStream:Hn,isLastMessage:n===qe.length-1,onSave:te,citations:null==e?void 0:e.citations,isStreamEnd:Ke,isGlobalEditActive:ke,messageIsEnd:null==e?void 0:e.isEnd,onViewComparison:be,onComparisonLinkClick:we,baseURL:Me,onFeedbackSubmit:On}),r("div",t({style:{marginTop:"0.5rem"}},{children:r(A,{})}))]})),r("div",t({className:M.userTimestamp},{children:new Date(e.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}))]}))}))]}),e.id)}),Pe&&s("div",t({className:M.loadingRow},{children:[r("div",t({className:M.iconWrapper,style:{marginTop:"0.2rem"}},{children:r(F,{})})),r("div",t({className:M.loadingTextWrapper},{children:r("span",{children:Xe})}))]})),r("div",{ref:De,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(Fn?M.disabled:""),style:En?{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:[qe.length>0&&!ln&&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:Re,placeholder:le,value:Fe||"",onChange:function(e){Ae(e.target.value)},onFocus:function(){return rn(!0)},onBlur:function(){return rn(!1)},onKeyDown:function(e){return Hn(e)},disabled:Fn,className:"no-scrollbar ".concat(M.chatTextarea),style:{minHeight:an?"120px":"50px",height:an?"120px":"50px",maxHeight:"120px"}}),r("span",t({className:M.sendButtonWrapper},{children:r("button",t({onClick:function(e){Hn(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,j as default};
2
2
  //# sourceMappingURL=ChatComponent.js.map
@@ -1,2 +1,2 @@
1
- import e from"style-inject";var o={"welcome-message":"ChatComponent-module_welcome-message__kz4PW",fadeSlideIn:"ChatComponent-module_fadeSlideIn__Pwh2n",thinkingIndicatorContainer:"ChatComponent-module_thinkingIndicatorContainer__bNun2",thinkingText:"ChatComponent-module_thinkingText__CZiAb",thinkingDot:"ChatComponent-module_thinkingDot__Mll-g",thinkingBounce:"ChatComponent-module_thinkingBounce__UVgEW",chatContainer:"ChatComponent-module_chatContainer__FSndl",scrollWrapper:"ChatComponent-module_scrollWrapper__jL4ly",stickyHeader:"ChatComponent-module_stickyHeader__F-aue",messagesList:"ChatComponent-module_messagesList__dIXEK",initialMessageRow:"ChatComponent-module_initialMessageRow__9KdTo",iconWrapper:"ChatComponent-module_iconWrapper__rKr69",welcomeTextWrapper:"ChatComponent-module_welcomeTextWrapper__9r3fC",welcomeMarkdownWrapper:"ChatComponent-module_welcomeMarkdownWrapper__YjUVT",messageRow:"ChatComponent-module_messageRow__CyYZ5",assistantIconContainer:"ChatComponent-module_assistantIconContainer__psZwV",userSpacer:"ChatComponent-module_userSpacer__A8RYb",messageContent:"ChatComponent-module_messageContent__gweOv",timestamp:"ChatComponent-module_timestamp__fUZvx",userMessageWrapper:"ChatComponent-module_userMessageWrapper__j49oJ",userMessageBubble:"ChatComponent-module_userMessageBubble__TMud8",userTimestamp:"ChatComponent-module_userTimestamp__Ul2GB",loadingRow:"ChatComponent-module_loadingRow__V01ST",loadingTextWrapper:"ChatComponent-module_loadingTextWrapper__ZTM3p",inputAreaWrapper:"ChatComponent-module_inputAreaWrapper__PHGMo",inputBoxContainer:"ChatComponent-module_inputBoxContainer__btCTo",disabled:"ChatComponent-module_disabled__Qdyhz",scrollToBottomBtn:"ChatComponent-module_scrollToBottomBtn__5OCWS",chatTextarea:"ChatComponent-module_chatTextarea__YS4KS",sendButtonWrapper:"ChatComponent-module_sendButtonWrapper__L-Kze",sendButton:"ChatComponent-module_sendButton__18iHG",active:"ChatComponent-module_active__1REPW",footerTools:"ChatComponent-module_footerTools__-2FAb",footerToolItem:"ChatComponent-module_footerToolItem__2a9SR"};e(".ChatComponent-module_welcome-message__kz4PW{align-items:flex-start;animation:ChatComponent-module_fadeSlideIn__Pwh2n 1.2s ease-out forwards;border-radius:.5rem;color:#333;display:fixed;font-size:1rem;line-height:1.75rem;max-width:100%;opacity:0;overflow-wrap:break-word;padding:1rem;transform:translateY(10px);white-space:pre-wrap;word-break:break-word}@keyframes ChatComponent-module_fadeSlideIn__Pwh2n{to{opacity:1;transform:translateY(0)}}.ChatComponent-module_thinkingIndicatorContainer__bNun2{align-items:center;background-color:initial;border-radius:4px;color:#6b7280;display:flex;font-family:Plus Jakarta Sans,sans-serif;font-size:.875rem;gap:8px;padding:8px 12px;position:relative;width:100%}.ChatComponent-module_thinkingText__CZiAb{color:#6b7280;font-size:.875rem;font-weight:500;white-space:nowrap}.ChatComponent-module_thinkingDot__Mll-g{animation:ChatComponent-module_thinkingBounce__UVgEW 1.4s ease-in-out infinite;animation-fill-mode:both;background-color:#6b7280;border-radius:50%;display:inline-block;height:5px;width:5px}.ChatComponent-module_thinkingDot__Mll-g:nth-child(2){animation-delay:-.32s}.ChatComponent-module_thinkingDot__Mll-g:nth-child(3){animation-delay:-.16s}.ChatComponent-module_thinkingDot__Mll-g:nth-child(4){animation-delay:0s}@keyframes ChatComponent-module_thinkingBounce__UVgEW{0%,80%,to{transform:scale(0)}40%{transform:scale(1)}}.ChatComponent-module_chatContainer__FSndl{align-items:center;background-color:#fbfaff;border:1px solid #d1d5db;display:flex;flex-direction:column;font-family:Plus Jakarta Sans,sans-serif;height:100%;justify-content:center;overflow:hidden;width:100%}.ChatComponent-module_scrollWrapper__jL4ly{background-color:#fbfaff;height:100%;max-width:100%;overflow:auto;width:100%}.ChatComponent-module_stickyHeader__F-aue{background-color:#fbfaff;position:sticky;top:0;z-index:99}.ChatComponent-module_messagesList__dIXEK{background-color:#fbfaff;display:flex;flex:1;flex-direction:column;overflow-x:hidden;overflow-y:auto}.ChatComponent-module_initialMessageRow__9KdTo{display:flex;flex-direction:row;font-family:inherit;padding:16px 10px 0 16px}.ChatComponent-module_iconWrapper__rKr69{margin-top:.3rem;max-height:32px;max-width:32px}.ChatComponent-module_welcomeTextWrapper__9r3fC{color:#000;display:flex;flex-direction:column;font-weight:400}.ChatComponent-module_welcomeMarkdownWrapper__YjUVT{align-items:flex-start;border-radius:.5rem;color:#333;display:inline-flex;flex-direction:column;font-size:1rem;line-height:1.75rem;margin-bottom:1rem;max-width:100%;overflow-wrap:break-word;padding-left:1rem;padding-right:1rem;white-space:pre-wrap;width:100%;word-break:break-word}.ChatComponent-module_messageRow__CyYZ5{box-sizing:border-box;display:flex;padding:.5rem 1.25rem .5rem 1.15rem;width:100%}.ChatComponent-module_assistantIconContainer__psZwV{margin-right:.7rem;margin-top:.5rem;max-width:32px;min-width:32px}.ChatComponent-module_userSpacer__A8RYb{margin-right:1rem;min-width:32px}.ChatComponent-module_messageContent__gweOv{flex:1;min-width:0}.ChatComponent-module_timestamp__fUZvx{color:#bfbfbf;font-size:.75rem;margin-top:4px}.ChatComponent-module_userMessageWrapper__j49oJ{align-items:flex-end;display:flex;flex-direction:column}.ChatComponent-module_userMessageBubble__TMud8{align-items:center;background-color:#8694a10d;border-radius:8px;display:flex;gap:3px;justify-content:center;max-width:80%;padding:0 1rem .5rem}.ChatComponent-module_userTimestamp__Ul2GB{color:#bfbfbf;font-size:.75rem;margin-top:8px;padding-right:16px}.ChatComponent-module_loadingRow__V01ST{display:flex;padding:16px 16px 0}.ChatComponent-module_loadingTextWrapper__ZTM3p{align-items:flex-start;border-radius:.5rem;color:#333;display:inline-flex;font-size:1rem;line-height:1.75rem;margin-bottom:1rem;max-width:100%;overflow-wrap:break-word;padding-bottom:1rem;padding-left:1rem;padding-right:1rem;white-space:pre-wrap;width:100%;word-break:break-word}.ChatComponent-module_inputAreaWrapper__PHGMo{align-items:center;background-color:#fbfaff;display:flex;flex-direction:column;height:fit-content;justify-content:flex-end;position:relative;width:95%}.ChatComponent-module_inputBoxContainer__btCTo{align-items:flex-end;background-color:#fff;border:1px solid #e5e7eb;border-radius:8px;display:flex;gap:.5rem;position:relative;width:100%}.ChatComponent-module_inputBoxContainer__btCTo.ChatComponent-module_disabled__Qdyhz{cursor:not-allowed}.ChatComponent-module_scrollToBottomBtn__5OCWS{align-items:center;background-color:#fff;border-radius:50%;box-shadow:0 2px 5px #0000001a;cursor:pointer;display:flex;height:24px;justify-content:center;left:50%;position:absolute;top:-34px;width:24px;z-index:10}.ChatComponent-module_chatTextarea__YS4KS{background-color:#fff;border:none;border-radius:.5rem;box-sizing:border-box;color:inherit;flex-grow:1;font-family:inherit;font-size:1rem;line-height:1.5rem;outline:none;overflow-y:auto;padding:12px;resize:none;transition:min-height .3s ease,background-color .3s ease}.ChatComponent-module_chatTextarea__YS4KS:disabled{cursor:not-allowed}.ChatComponent-module_sendButtonWrapper__L-Kze{align-items:flex-end;display:flex;flex-direction:column;justify-content:flex-end}.ChatComponent-module_sendButton__18iHG{background-color:#fff;border:none;border-radius:.475rem;font-size:1rem;font-weight:700;height:50px;padding:.5rem .75rem;transition:background-color .3s,color .3s}.ChatComponent-module_sendButton__18iHG.ChatComponent-module_active__1REPW{color:#5928ed;cursor:pointer}.ChatComponent-module_sendButton__18iHG.ChatComponent-module_disabled__Qdyhz{color:#d1d5db;cursor:not-allowed}.ChatComponent-module_footerTools__-2FAb{display:flex;flex-direction:row;gap:.25rem;width:95%}.ChatComponent-module_footerToolItem__2a9SR{width:50%}");export{o as default};
1
+ import e from"../../../../node_modules/style-inject/dist/style-inject.es.js";var o={"welcome-message":"ChatComponent-module_welcome-message__kz4PW",fadeSlideIn:"ChatComponent-module_fadeSlideIn__Pwh2n",thinkingIndicatorContainer:"ChatComponent-module_thinkingIndicatorContainer__bNun2",thinkingText:"ChatComponent-module_thinkingText__CZiAb",thinkingDot:"ChatComponent-module_thinkingDot__Mll-g",thinkingBounce:"ChatComponent-module_thinkingBounce__UVgEW",chatContainer:"ChatComponent-module_chatContainer__FSndl",scrollWrapper:"ChatComponent-module_scrollWrapper__jL4ly",stickyHeader:"ChatComponent-module_stickyHeader__F-aue",messagesList:"ChatComponent-module_messagesList__dIXEK",initialMessageRow:"ChatComponent-module_initialMessageRow__9KdTo",iconWrapper:"ChatComponent-module_iconWrapper__rKr69",welcomeTextWrapper:"ChatComponent-module_welcomeTextWrapper__9r3fC",welcomeMarkdownWrapper:"ChatComponent-module_welcomeMarkdownWrapper__YjUVT",messageRow:"ChatComponent-module_messageRow__CyYZ5",assistantIconContainer:"ChatComponent-module_assistantIconContainer__psZwV",userSpacer:"ChatComponent-module_userSpacer__A8RYb",messageContent:"ChatComponent-module_messageContent__gweOv",timestamp:"ChatComponent-module_timestamp__fUZvx",userMessageWrapper:"ChatComponent-module_userMessageWrapper__j49oJ",userMessageBubble:"ChatComponent-module_userMessageBubble__TMud8",userTimestamp:"ChatComponent-module_userTimestamp__Ul2GB",loadingRow:"ChatComponent-module_loadingRow__V01ST",loadingTextWrapper:"ChatComponent-module_loadingTextWrapper__ZTM3p",inputAreaWrapper:"ChatComponent-module_inputAreaWrapper__PHGMo",inputBoxContainer:"ChatComponent-module_inputBoxContainer__btCTo",disabled:"ChatComponent-module_disabled__Qdyhz",scrollToBottomBtn:"ChatComponent-module_scrollToBottomBtn__5OCWS",chatTextarea:"ChatComponent-module_chatTextarea__YS4KS",sendButtonWrapper:"ChatComponent-module_sendButtonWrapper__L-Kze",sendButton:"ChatComponent-module_sendButton__18iHG",active:"ChatComponent-module_active__1REPW",footerTools:"ChatComponent-module_footerTools__-2FAb",footerToolItem:"ChatComponent-module_footerToolItem__2a9SR"};e(".ChatComponent-module_welcome-message__kz4PW{align-items:flex-start;animation:ChatComponent-module_fadeSlideIn__Pwh2n 1.2s ease-out forwards;border-radius:.5rem;color:#333;display:fixed;font-size:1rem;line-height:1.75rem;max-width:100%;opacity:0;overflow-wrap:break-word;padding:1rem;transform:translateY(10px);white-space:pre-wrap;word-break:break-word}@keyframes ChatComponent-module_fadeSlideIn__Pwh2n{to{opacity:1;transform:translateY(0)}}.ChatComponent-module_thinkingIndicatorContainer__bNun2{align-items:center;background-color:initial;border-radius:4px;color:#6b7280;display:flex;font-family:Plus Jakarta Sans,sans-serif;font-size:.875rem;gap:8px;padding:8px 12px;position:relative;width:100%}.ChatComponent-module_thinkingText__CZiAb{color:#6b7280;font-size:.875rem;font-weight:500;white-space:nowrap}.ChatComponent-module_thinkingDot__Mll-g{animation:ChatComponent-module_thinkingBounce__UVgEW 1.4s ease-in-out infinite;animation-fill-mode:both;background-color:#6b7280;border-radius:50%;display:inline-block;height:5px;width:5px}.ChatComponent-module_thinkingDot__Mll-g:nth-child(2){animation-delay:-.32s}.ChatComponent-module_thinkingDot__Mll-g:nth-child(3){animation-delay:-.16s}.ChatComponent-module_thinkingDot__Mll-g:nth-child(4){animation-delay:0s}@keyframes ChatComponent-module_thinkingBounce__UVgEW{0%,80%,to{transform:scale(0)}40%{transform:scale(1)}}.ChatComponent-module_chatContainer__FSndl{align-items:center;background-color:#fbfaff;border:1px solid #d1d5db;display:flex;flex-direction:column;font-family:Plus Jakarta Sans,sans-serif;height:100%;justify-content:center;overflow:hidden;width:100%}.ChatComponent-module_scrollWrapper__jL4ly{background-color:#fbfaff;height:100%;max-width:100%;overflow:auto;width:100%}.ChatComponent-module_stickyHeader__F-aue{background-color:#fbfaff;position:sticky;top:0;z-index:99}.ChatComponent-module_messagesList__dIXEK{background-color:#fbfaff;display:flex;flex:1;flex-direction:column;overflow-x:hidden;overflow-y:auto}.ChatComponent-module_initialMessageRow__9KdTo{display:flex;flex-direction:row;font-family:inherit;padding:16px 10px 0 16px}.ChatComponent-module_iconWrapper__rKr69{margin-top:.3rem;max-height:32px;max-width:32px}.ChatComponent-module_welcomeTextWrapper__9r3fC{color:#000;display:flex;flex-direction:column;font-weight:400}.ChatComponent-module_welcomeMarkdownWrapper__YjUVT{align-items:flex-start;border-radius:.5rem;color:#333;display:inline-flex;flex-direction:column;font-size:1rem;line-height:1.75rem;margin-bottom:1rem;max-width:100%;overflow-wrap:break-word;padding-left:1rem;padding-right:1rem;white-space:pre-wrap;width:100%;word-break:break-word}.ChatComponent-module_messageRow__CyYZ5{box-sizing:border-box;display:flex;padding:.5rem 1.25rem .5rem 1.15rem;width:100%}.ChatComponent-module_assistantIconContainer__psZwV{margin-right:.7rem;margin-top:.5rem;max-width:32px;min-width:32px}.ChatComponent-module_userSpacer__A8RYb{margin-right:1rem;min-width:32px}.ChatComponent-module_messageContent__gweOv{flex:1;min-width:0}.ChatComponent-module_timestamp__fUZvx{color:#bfbfbf;font-size:.75rem;margin-top:4px}.ChatComponent-module_userMessageWrapper__j49oJ{align-items:flex-end;display:flex;flex-direction:column}.ChatComponent-module_userMessageBubble__TMud8{align-items:center;background-color:#8694a10d;border-radius:8px;display:flex;gap:3px;justify-content:center;max-width:80%;padding:0 1rem .5rem}.ChatComponent-module_userTimestamp__Ul2GB{color:#bfbfbf;font-size:.75rem;margin-top:8px;padding-right:16px}.ChatComponent-module_loadingRow__V01ST{display:flex;padding:16px 16px 0}.ChatComponent-module_loadingTextWrapper__ZTM3p{align-items:flex-start;border-radius:.5rem;color:#333;display:inline-flex;font-size:1rem;line-height:1.75rem;margin-bottom:1rem;max-width:100%;overflow-wrap:break-word;padding-bottom:1rem;padding-left:1rem;padding-right:1rem;white-space:pre-wrap;width:100%;word-break:break-word}.ChatComponent-module_inputAreaWrapper__PHGMo{align-items:center;background-color:#fbfaff;display:flex;flex-direction:column;height:fit-content;justify-content:flex-end;position:relative;width:95%}.ChatComponent-module_inputBoxContainer__btCTo{align-items:flex-end;background-color:#fff;border:1px solid #e5e7eb;border-radius:8px;display:flex;gap:.5rem;position:relative;width:100%}.ChatComponent-module_inputBoxContainer__btCTo.ChatComponent-module_disabled__Qdyhz{cursor:not-allowed}.ChatComponent-module_scrollToBottomBtn__5OCWS{align-items:center;background-color:#fff;border-radius:50%;box-shadow:0 2px 5px #0000001a;cursor:pointer;display:flex;height:24px;justify-content:center;left:50%;position:absolute;top:-34px;width:24px;z-index:10}.ChatComponent-module_chatTextarea__YS4KS{background-color:#fff;border:none;border-radius:.5rem;box-sizing:border-box;color:inherit;flex-grow:1;font-family:inherit;font-size:1rem;line-height:1.5rem;outline:none;overflow-y:auto;padding:12px;resize:none;transition:min-height .3s ease,background-color .3s ease}.ChatComponent-module_chatTextarea__YS4KS:disabled{cursor:not-allowed}.ChatComponent-module_sendButtonWrapper__L-Kze{align-items:flex-end;display:flex;flex-direction:column;justify-content:flex-end}.ChatComponent-module_sendButton__18iHG{background-color:#fff;border:none;border-radius:.475rem;font-size:1rem;font-weight:700;height:50px;padding:.5rem .75rem;transition:background-color .3s,color .3s}.ChatComponent-module_sendButton__18iHG.ChatComponent-module_active__1REPW{color:#5928ed;cursor:pointer}.ChatComponent-module_sendButton__18iHG.ChatComponent-module_disabled__Qdyhz{color:#d1d5db;cursor:not-allowed}.ChatComponent-module_footerTools__-2FAb{display:flex;flex-direction:row;gap:.25rem;width:95%}.ChatComponent-module_footerToolItem__2a9SR{width:50%}");export{o as default};
2
2
  //# sourceMappingURL=ChatComponent.module.css.js.map
@@ -1,2 +1,2 @@
1
- import e from"style-inject";var a={"chat-header-container":"ChatHeader-module_chat-header-container__VrneF","chat-header-title-wrapper":"ChatHeader-module_chat-header-title-wrapper__DvqBK","chat-header-icon-container":"ChatHeader-module_chat-header-icon-container__CcuZH","chat-header-title":"ChatHeader-module_chat-header-title__x-HEq","chat-header-actions":"ChatHeader-module_chat-header-actions__LE7nW","resize-container":"ChatHeader-module_resize-container__zSvfH","resize-trigger":"ChatHeader-module_resize-trigger__pSU19","resize-dropdown":"ChatHeader-module_resize-dropdown__ZBY9o","resize-option":"ChatHeader-module_resize-option__-bPiq",selected:"ChatHeader-module_selected__ClG5-","new-chat-trigger":"ChatHeader-module_new-chat-trigger__KQI1a",enabled:"ChatHeader-module_enabled__eIwJb",disabled:"ChatHeader-module_disabled__nO1aI"};e(".ChatHeader-module_chat-header-container__VrneF{align-items:center;background-color:#fff;border-bottom:1px solid #e5e7eb;box-sizing:border-box;display:flex;justify-content:space-between;padding:.65rem 1rem;position:relative;width:100%}.ChatHeader-module_chat-header-title-wrapper__DvqBK{align-items:center;display:flex;flex:1;gap:10px;min-width:0}.ChatHeader-module_chat-header-icon-container__CcuZH{align-items:center;display:flex;flex-shrink:0;justify-content:center}.ChatHeader-module_chat-header-title__x-HEq{color:#111827;font-size:1.125rem;font-weight:500;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ChatHeader-module_chat-header-actions__LE7nW{align-items:center;display:flex;gap:12px;padding-left:1rem}.ChatHeader-module_resize-container__zSvfH{align-items:center;display:flex;position:relative}.ChatHeader-module_resize-trigger__pSU19{align-items:center;cursor:pointer;display:flex;height:2rem;justify-content:center;transition:transform .3s ease;width:2rem}.ChatHeader-module_resize-dropdown__ZBY9o{background-color:#fff;border:1px solid #e5e7eb;border-radius:10px;box-shadow:0 8px 20px #0000001f;display:flex;gap:6px;padding:8px;position:absolute;right:0;top:35px;white-space:nowrap;z-index:1000}.ChatHeader-module_resize-option__-bPiq{align-items:center;background-color:initial;border:1px solid #f3f4f6;border-radius:6px;cursor:pointer;display:flex;flex-direction:column;gap:2px;padding:4px 8px;transition:all .2s ease}.ChatHeader-module_resize-option__-bPiq.ChatHeader-module_selected__ClG5-{background-color:#f0f0ff;border:1px solid #512ced}.ChatHeader-module_new-chat-trigger__KQI1a{align-items:center;display:flex;height:2rem;justify-content:center;width:2rem}.ChatHeader-module_new-chat-trigger__KQI1a.ChatHeader-module_enabled__eIwJb{cursor:pointer;opacity:1}.ChatHeader-module_new-chat-trigger__KQI1a.ChatHeader-module_disabled__nO1aI{cursor:not-allowed;opacity:.5}");export{a as default};
1
+ import e from"../../../../node_modules/style-inject/dist/style-inject.es.js";var a={"chat-header-container":"ChatHeader-module_chat-header-container__VrneF","chat-header-title-wrapper":"ChatHeader-module_chat-header-title-wrapper__DvqBK","chat-header-icon-container":"ChatHeader-module_chat-header-icon-container__CcuZH","chat-header-title":"ChatHeader-module_chat-header-title__x-HEq","chat-header-actions":"ChatHeader-module_chat-header-actions__LE7nW","resize-container":"ChatHeader-module_resize-container__zSvfH","resize-trigger":"ChatHeader-module_resize-trigger__pSU19","resize-dropdown":"ChatHeader-module_resize-dropdown__ZBY9o","resize-option":"ChatHeader-module_resize-option__-bPiq",selected:"ChatHeader-module_selected__ClG5-","new-chat-trigger":"ChatHeader-module_new-chat-trigger__KQI1a",enabled:"ChatHeader-module_enabled__eIwJb",disabled:"ChatHeader-module_disabled__nO1aI"};e(".ChatHeader-module_chat-header-container__VrneF{align-items:center;background-color:#fff;border-bottom:1px solid #e5e7eb;box-sizing:border-box;display:flex;justify-content:space-between;padding:.65rem 1rem;position:relative;width:100%}.ChatHeader-module_chat-header-title-wrapper__DvqBK{align-items:center;display:flex;flex:1;gap:10px;min-width:0}.ChatHeader-module_chat-header-icon-container__CcuZH{align-items:center;display:flex;flex-shrink:0;justify-content:center}.ChatHeader-module_chat-header-title__x-HEq{color:#111827;font-size:1.125rem;font-weight:500;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ChatHeader-module_chat-header-actions__LE7nW{align-items:center;display:flex;gap:12px;padding-left:1rem}.ChatHeader-module_resize-container__zSvfH{align-items:center;display:flex;position:relative}.ChatHeader-module_resize-trigger__pSU19{align-items:center;cursor:pointer;display:flex;height:2rem;justify-content:center;transition:transform .3s ease;width:2rem}.ChatHeader-module_resize-dropdown__ZBY9o{background-color:#fff;border:1px solid #e5e7eb;border-radius:10px;box-shadow:0 8px 20px #0000001f;display:flex;gap:6px;padding:8px;position:absolute;right:0;top:35px;white-space:nowrap;z-index:1000}.ChatHeader-module_resize-option__-bPiq{align-items:center;background-color:initial;border:1px solid #f3f4f6;border-radius:6px;cursor:pointer;display:flex;flex-direction:column;gap:2px;padding:4px 8px;transition:all .2s ease}.ChatHeader-module_resize-option__-bPiq.ChatHeader-module_selected__ClG5-{background-color:#f0f0ff;border:1px solid #512ced}.ChatHeader-module_new-chat-trigger__KQI1a{align-items:center;display:flex;height:2rem;justify-content:center;width:2rem}.ChatHeader-module_new-chat-trigger__KQI1a.ChatHeader-module_enabled__eIwJb{cursor:pointer;opacity:1}.ChatHeader-module_new-chat-trigger__KQI1a.ChatHeader-module_disabled__nO1aI{cursor:not-allowed;opacity:.5}");export{a as default};
2
2
  //# sourceMappingURL=ChatHeader.module.css.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e,__rest as n,__spreadArray as o}from"tslib";import{jsx as i,jsxs as r}from"react/jsx-runtime";import{useState as t,useCallback as l,useEffect as a,useRef as d,useMemo as c}from"react";import{Box as s,Typography as p,TextareaAutosize as u,FormGroup as x,FormControlLabel as f,Checkbox as g}from"@mui/material";import{ChevronUp as m,ChevronDown as h}from"lucide-react";import{CognitiveDecisioningCard as v}from"@e-llm-studio/citation";import{DynamicArrow as b}from"./MarkdownComponents/MarkdownSelect.js";import{ButtonCognitiveIcon as y}from"./_svg/ButtonCognitiveIcon.js";import w from"./CitationLink.js";import{GapExplanationAccordion as S}from"./GapExplanationAccordion.js";import{getSourceFromUrl as C}from"./MarkdownComponents/MarkdownElements.js";var k=function(){return r("svg",e({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"},{children:[i("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),i("polyline",{points:"12 5 19 12 12 19"})]}))},E=function(E){var F,T,R=E.gap,D=E.index,B=E.onUpdate,z=E.isEditable,A=E.citations,I=E.onTypeResponseClick,M=t(!1),j=M[0],L=M[1],W=t({}),_=W[0],P=W[1],H=d(null);a(function(){var e;0===D&&"text"===R.inputType&&z&&(null===(e=H.current)||void 0===e||e.focus())},[D,R.inputType,z]);var N=function(e){return e?e.replace(/\\n/g,"\n"):""},O=c(function(){var e;return N((null===(e=R.aiReasoning)||void 0===e?void 0:e.reason)||"")},[null===(F=R.aiReasoning)||void 0===F?void 0:F.reason]),G=c(function(){var e;return N((null===(e=R.aiReasoning)||void 0===e?void 0:e.gap)||"")},[null===(T=R.aiReasoning)||void 0===T?void 0:T.gap]),U=l(function(e,n){return A&&A.find(function(o){return o.customMetaData.citation_number&&"Cognitive Decisioning"!==o.customMetaData.citation_title&&o.customMetaData.source===n&&String(o.customMetaData.citation_number)===String(e)})||null},[A]),V=c(function(){return{img:function(o){o.node;var r=n(o,["node"]);return i("img",e({},r,{style:{height:"100%",width:"100%",objectFit:"contain"},alt:(null==r?void 0:r.alt)||"",className:"w-full sm:max-w-lg md:max-w-2xl lg:max-w-4xl mx-auto"}))},p:function(o){o.node;var r=n(o,["node"]);return i("p",e({},r,{style:{margin:0}},{children:null==r?void 0:r.children}))},code:function(o){o.node;var r=n(o,["node"]);return i("span",e({},r,{style:{maxWidth:"100%",wordWrap:"break-word",overflowWrap:"break-word",wordBreak:"break-word",whiteSpace:"normal",overflow:"hidden",display:"inline-flex",fontSize:"1rem",lineHeight:"1.625rem"}},{children:null==r?void 0:r.children}))},ol:function(o){o.node;var r=n(o,["node"]);return i("ol",e({},r,{style:{display:"flex",flexDirection:"column",gap:"1rem",listStyle:"decimal",paddingLeft:"2.5rem"}},{children:null==r?void 0:r.children}))},ul:function(o){o.node;var r=n(o,["node"]);return i("ol",e({},r,{style:{paddingLeft:"1.25rem",listStyleType:"decimal"}}))},li:function(o){o.node;var r=n(o,["node"]);return i("li",e({},r,{style:{marginBottom:"4px",listStyle:"decimal"}},{children:r.children}))},a:function(n){var o=n.href,r=n.children;if(!o)return i("a",{children:r});var t=o.match(/citationNumber=([^&]+)/);if(t&&w){var l=C(o),a=U(t[1],l);if(a)return i(w,{citation:a,linkTitle:r,fontSize:12})}return i("a",e({href:o,target:"_blank",rel:"noopener noreferrer",className:"md-link inline-flex items-center gap-1 text-purple-700 hover:underline",style:{color:"#7C3AED"}},{children:r}))}}},[U]),Y=function(e){return"string"==typeof e?{text:e,reasoning:null,explanation:null,id:null}:{text:e.text,reasoning:e.aiReasoning,explanation:e.explanation,id:e.id}},q="checkbox"===R.inputType,J=function(e,n){if(z){if("typeYourAnswer"===n||"type your response"===e.trim().toLowerCase())return B(R.id,e),void(I&&I());if(q){var i=Array.isArray(R.userSelection)?R.userSelection:[],r=i.includes(e)?i.filter(function(n){return n!==e}):o(o([],i,!0),[e],!1);B(R.id,r)}else B(R.id,e)}};return i(s,e({sx:{bgcolor:"#FFFEFE",overflow:"hidden"}},{children:r(s,e({sx:{display:"flex",flexDirection:"column",gap:"8px"}},{children:[i(s,e({sx:{display:"flex",flexDirection:"column",width:"100%"}},{children:r(p,e({component:"div",sx:{fontSize:"16px",fontWeight:400,color:"#17212B",lineHeight:1.5}},{children:[i("span",e({style:{color:"#8F2C23",paddingRight:"2px"}},{children:"*"}))," ",D+1,". ",R.value,R.aiReasoning&&i(s,e({component:"span",sx:{display:"inline",verticalAlign:"middle",ml:.5}},{children:i(v,{headerIcon:i(y,{}),reasoning:O,gap:G,score:R.aiReasoning.score,isOpen:j,onToggle:function(){return L(function(e){return!e})},mdComponents:V,styles:{pill:{gap:"2px",border:"none",backgroundColor:"transparent"}}})}))]}))})),"text"===R.inputType?i(u,{ref:H,minRows:1,maxRows:10,value:R.userSelection||"",onChange:function(e){z&&B(R.id,e.target.value)},disabled:!z,placeholder:"Enter your input...",style:{width:"100%",minHeight:"30px",padding:"8px 12px",borderRadius:"6px",border:"1px solid #CBD5E1",fontSize:"14px",resize:"none"}}):q?i(x,e({row:!0,sx:{gap:"16px",flexDirection:"column"}},{children:R.options.map(function(n,o){var t=Y(n),l=t.text,a=t.reasoning,d=t.explanation,c=t.id,u="checkbox"===R.inputType?(R.userSelection||[]).includes(l):R.userSelection===l;return r(s,e({sx:{display:"flex",flexDirection:"column",width:"100%"}},{children:[i(f,{control:i(g,{checked:(R.userSelection||[]).includes(l),onChange:function(){return J(l,c)},value:l,size:"small",disabled:!z,sx:{p:0,mr:"7px",width:"17.5px",height:"17.5px","& .MuiSvgIcon-root":{fontSize:17.5},color:"#CBD5E1","&.Mui-checked":{color:"#2563EB"},alignSelf:"flex-start",mt:"2px"}}),label:r(s,e({sx:{display:"flex",alignItems:"center",gap:"6px",width:"100%"}},{children:[i(p,e({sx:{fontSize:"14px",color:"#1E293B",fontWeight:400}},{children:l})),(a||d)&&r(s,e({onClick:function(n){n.stopPropagation(),P(function(n){var i;return e(e({},n),((i={})[o]=!n[o],i))})},sx:{display:"flex",alignItems:"center",gap:"2px",cursor:"pointer",flexShrink:0}},{children:[i(y,{}),_[o]?i(m,{size:12,color:"#667085"}):i(h,{size:12,color:"#667085"})]}))]})),sx:{mr:0,ml:0,alignItems:"flex-start",width:"100%"}}),(a||d)&&_[o]&&r(s,e({sx:{width:"100%",border:"1px solid #EAECF0",marginTop:"6px",borderRadius:"16px",overflow:"hidden",boxShadow:"0 1px 2px 0 rgba(16, 24, 40, 0.05)"}},{children:[d&&i(S,{explanation:d,isSelected:u,onProceed:function(){return J(l)},proceedIcon:i(k,{})}),a&&i(v,{headerIcon:i(y,{}),reasoning:a.reason,gap:a.gap,score:a.score,isOpen:!0,onToggle:function(){return P(function(n){var i;return e(e({},n),((i={})[o]=!1,i))})},hideTrigger:!0,mdComponents:V,styles:{container:{border:"none",borderRadius:0,marginTop:0,marginBottom:0},header:{borderBottom:"none",backgroundColor:"#E9ECFD"},pill:{gap:"2px",border:"none",backgroundColor:"transparent"},sectionButton:{padding:"16px"}}})]}))]}),o)})})):i(s,e({sx:{display:"flex",flexDirection:"column",gap:"8px"}},{children:R.options.map(function(n,o){var t=Y(n),l=t.text,a=t.reasoning,d=t.explanation,c=t.id,u=R.userSelection===l;return r(s,e({sx:{display:"flex",flexDirection:"column",width:"100%"}},{children:[r(s,e({sx:{display:"flex",alignItems:"center",gap:"8px",width:"100%"}},{children:[r(s,e({onClick:function(){return J(l,c)},sx:{display:"flex",alignItems:"center",gap:"8px",padding:"8px",borderRadius:"8px",cursor:z?"pointer":"default",bgcolor:u?"#EFF4FF":"transparent",border:"1px solid",borderColor:u?"#B2CCFF":"transparent",transition:"all 0.15s ease-in-out",flex:1,boxSizing:"border-box"}},{children:[i(b,{isSelected:u,width:24,height:24}),i(p,e({sx:{fontSize:"14px",color:u?"#1D2939":"#344054",fontWeight:500}},{children:l}))]})),(a||d)&&r(s,e({onClick:function(n){n.stopPropagation(),P(function(n){var i;return e(e({},n),((i={})[o]=!n[o],i))})},sx:{display:"flex",alignItems:"center",gap:"2px",cursor:"pointer",flexShrink:0}},{children:[i(y,{}),_[o]?i(m,{size:12,color:"#667085"}):i(h,{size:12,color:"#667085"})]}))]})),(a||d)&&_[o]&&r(s,e({sx:{width:"100%",border:"1px solid #EAECF0",marginTop:"6px",borderRadius:"16px",overflow:"hidden",boxShadow:"0 1px 2px 0 rgba(16, 24, 40, 0.05)"}},{children:[d&&i(s,e({sx:{borderBottom:a?"1px solid #EAECF0":"none"}},{children:i(S,{explanation:d,isSelected:u,onProceed:function(){return J(l)},proceedIcon:i(k,{})})})),a&&i(v,{headerIcon:i(y,{}),reasoning:a.reason,gap:a.gap,score:a.score,isOpen:!0,onToggle:function(){return P(function(n){var i;return e(e({},n),((i={})[o]=!1,i))})},hideTrigger:!0,mdComponents:V,styles:{container:{border:"none",borderRadius:0,marginTop:0,marginBottom:0},header:{borderBottom:"none",backgroundColor:"#E9ECFD"},pill:{gap:"2px",border:"none",backgroundColor:"transparent"},sectionButton:{padding:"16px"}}})]}))]}),o)})}))]}))}))},F=function(n){var o=n.data,r=n.isLastMessage,d=n.onValidationChange,c=n.isSubmitted,p=n.citations,u=n.onTypeResponseClick,x=n.isGlobalEditActive,f=t(o.gaps.map(function(n){return e(e({},n),{userSelection:"checkbox"===n.inputType?[]:null})})),g=f[0],m=f[1],h=l(function(n,o){m(function(i){return i.map(function(i){return i.id===n?e(e({},i),{userSelection:o}):i})})},[]);a(function(){if(d){var e=g.some(function(e){return"checkbox"===e.inputType?Array.isArray(e.userSelection)&&e.userSelection.length>0:"text"===e.inputType?null!==e.userSelection&&"string"==typeof e.userSelection&&""!==e.userSelection.trim():null!==e.userSelection&&""!==e.userSelection});d(e,g)}},[g,d]);var v=r&&!c&&!x;return i(s,e({sx:{width:"100%",backgroundColor:"#FFFFFF",borderRadius:"8px",border:"1px solid #E3E6EA",padding:"14px",marginTop:"12px"}},{children:i(s,e({sx:{display:"flex",flexDirection:"column",gap:"16px"}},{children:g.map(function(e,n){return i(E,{index:n,gap:e,onUpdate:h,isEditable:v,citations:p,onTypeResponseClick:u},e.id)})}))}))};export{F as CriticalGaps};
1
+ import{__assign as e,__rest as n,__spreadArray as o}from"tslib";import{jsx as i,jsxs as r}from"react/jsx-runtime";import{useState as t,useCallback as l,useEffect as a,useRef as d,useMemo as c}from"react";import{Box as s,Typography as p,TextareaAutosize as u,FormGroup as x,FormControlLabel as m,Checkbox as f}from"@mui/material";import{ChevronUp as g,ChevronDown as h}from"lucide-react";import{CognitiveDecisioningCard as b}from"@e-llm-studio/citation";import{DynamicArrow as v}from"./MarkdownComponents/MarkdownSelect.js";import{ButtonCognitiveIcon as y}from"./_svg/ButtonCognitiveIcon.js";import w from"./CitationLink.js";import{GapExplanationAccordion as S}from"./GapExplanationAccordion.js";import{getSourceFromUrl as F}from"./MarkdownComponents/MarkdownElements.js";var k=function(){return r("svg",e({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"},{children:[i("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),i("polyline",{points:"12 5 19 12 12 19"})]}))},C=function(C){var E,R,T=C.gap,D=C.index,B=C.onUpdate,z=C.isEditable,I=C.citations,A=C.onTypeResponseClick,M=t(!1),W=M[0],j=M[1],L=t({}),_=L[0],H=L[1],O=d(null);a(function(){var e;0===D&&"text"===T.inputType&&z&&(null===(e=O.current)||void 0===e||e.focus())},[D,T.inputType,z]);var P=function(e){return e?e.replace(/\\n/g,"\n"):""},N=c(function(){var e;return P((null===(e=T.aiReasoning)||void 0===e?void 0:e.reason)||"")},[null===(E=T.aiReasoning)||void 0===E?void 0:E.reason]),G=c(function(){var e;return P((null===(e=T.aiReasoning)||void 0===e?void 0:e.gap)||"")},[null===(R=T.aiReasoning)||void 0===R?void 0:R.gap]),U=l(function(e,n){return I&&I.find(function(o){return o.customMetaData.citation_number&&"Cognitive Decisioning"!==o.customMetaData.citation_title&&o.customMetaData.source===n&&String(o.customMetaData.citation_number)===String(e)})||null},[I]),V=c(function(){return{img:function(o){o.node;var r=n(o,["node"]);return i("img",e({},r,{style:{height:"100%",width:"100%",objectFit:"contain"},alt:(null==r?void 0:r.alt)||"",className:"w-full sm:max-w-lg md:max-w-2xl lg:max-w-4xl mx-auto"}))},p:function(o){o.node;var r=n(o,["node"]);return i("p",e({},r,{style:{margin:0}},{children:null==r?void 0:r.children}))},code:function(o){o.node;var r=n(o,["node"]);return i("span",e({},r,{style:{maxWidth:"100%",wordWrap:"break-word",overflowWrap:"break-word",wordBreak:"break-word",whiteSpace:"normal",overflow:"hidden",display:"inline-flex",fontSize:"1rem",lineHeight:"1.625rem"}},{children:null==r?void 0:r.children}))},ol:function(o){o.node;var r=n(o,["node"]);return i("ol",e({},r,{style:{display:"flex",flexDirection:"column",gap:"1rem",listStyle:"decimal",paddingLeft:"2.5rem"}},{children:null==r?void 0:r.children}))},ul:function(o){o.node;var r=n(o,["node"]);return i("ol",e({},r,{style:{paddingLeft:"1.25rem",listStyleType:"decimal"}}))},li:function(o){o.node;var r=n(o,["node"]);return i("li",e({},r,{style:{marginBottom:"4px",listStyle:"decimal"}},{children:r.children}))},a:function(n){var o=n.href,r=n.children;if(!o)return i("a",{children:r});var t=o.match(/citationNumber=([^&]+)/);if(t&&w){var l=F(o),a=U(t[1],l);if(a)return i(w,{citation:a,linkTitle:r,fontSize:12})}return i("a",e({href:o,target:"_blank",rel:"noopener noreferrer",className:"md-link inline-flex items-center gap-1 text-purple-700 hover:underline",style:{color:"#7C3AED"}},{children:r}))}}},[U]),Y=function(e){return"string"==typeof e?{text:e,reasoning:null,explanation:null,id:null,isRecommended:!1}:{text:e.text,reasoning:e.aiReasoning,explanation:e.explanation,id:e.id,isRecommended:e.is_recommended}},q="checkbox"===T.inputType,J=function(e,n){if(z){if("typeYourAnswer"===n||"type your response"===e.trim().toLowerCase())return B(T.id,e),void(A&&A());if(q){var i=Array.isArray(T.userSelection)?T.userSelection:[],r=i.includes(e)?i.filter(function(n){return n!==e}):o(o([],i,!0),[e],!1);B(T.id,r)}else B(T.id,e)}};return i(s,e({sx:{bgcolor:"#FFFEFE",overflow:"hidden"}},{children:r(s,e({sx:{display:"flex",flexDirection:"column",gap:"8px"}},{children:[i(s,e({sx:{display:"flex",flexDirection:"column",width:"100%"}},{children:r(p,e({component:"div",sx:{fontSize:"16px",fontWeight:400,color:"#17212B",lineHeight:1.5}},{children:[i("span",e({style:{color:"#8F2C23",paddingRight:"2px"}},{children:"*"}))," ",D+1,". ",T.value,T.aiReasoning&&i(s,e({component:"span",sx:{display:"inline",verticalAlign:"middle",ml:.5}},{children:i(b,{headerIcon:i(y,{}),reasoning:N,gap:G,score:T.aiReasoning.score,isOpen:W,onToggle:function(){return j(function(e){return!e})},mdComponents:V,styles:{pill:{gap:"2px",border:"none",backgroundColor:"transparent"}}})}))]}))})),"text"===T.inputType?i(u,{ref:O,minRows:1,maxRows:10,value:T.userSelection||"",onChange:function(e){z&&B(T.id,e.target.value)},disabled:!z,placeholder:"Enter your input...",style:{width:"100%",minHeight:"30px",padding:"8px 12px",borderRadius:"6px",border:"1px solid #CBD5E1",fontSize:"14px",resize:"none"}}):q?i(x,e({row:!0,sx:{gap:"16px",flexDirection:"column"}},{children:T.options.map(function(n,o){var t=Y(n),l=t.text,a=t.reasoning,d=t.explanation,c=t.id,u=t.isRecommended,x="checkbox"===T.inputType?(T.userSelection||[]).includes(l):T.userSelection===l;return r(s,e({sx:{display:"flex",flexDirection:"column",width:"100%"}},{children:[i(m,{control:i(f,{checked:(T.userSelection||[]).includes(l),onChange:function(){return J(l,c)},value:l,size:"small",disabled:!z,sx:{p:0,mr:"7px",width:"17.5px",height:"17.5px","& .MuiSvgIcon-root":{fontSize:17.5},color:"#CBD5E1","&.Mui-checked":{color:"#2563EB"},alignSelf:"flex-start",mt:"2px"}}),label:r(s,e({sx:{display:"flex",alignItems:"center",gap:"6px",width:"100%"}},{children:[i(p,e({sx:{fontSize:"14px",color:"#1E293B",fontWeight:400}},{children:l})),u&&i("span",e({style:{borderRadius:"100px",border:"1px solid #D1E0FF",background:"#FFF",color:"#528BFF",padding:"0px 8px",whiteSpace:"nowrap",textOverflow:"ellipsis",fontFamily:"Inter",fontSize:"12px",fontStyle:"normal",fontWeight:"500",lineHeight:"20px"}},{children:"Recommended"})),(a||d)&&r(s,e({onClick:function(n){n.stopPropagation(),H(function(n){var i;return e(e({},n),((i={})[o]=!n[o],i))})},sx:{display:"flex",alignItems:"center",gap:"2px",cursor:"pointer",flexShrink:0}},{children:[i(y,{}),_[o]?i(g,{size:12,color:"#667085"}):i(h,{size:12,color:"#667085"})]}))]})),sx:{mr:0,ml:0,alignItems:"flex-start",width:"100%"}}),(a||d)&&_[o]&&r(s,e({sx:{width:"100%",border:"1px solid #EAECF0",marginTop:"6px",borderRadius:"16px",overflow:"hidden",boxShadow:"0 1px 2px 0 rgba(16, 24, 40, 0.05)"}},{children:[d&&i(S,{explanation:d,isSelected:x,onProceed:function(){return J(l)},proceedIcon:i(k,{})}),a&&i(b,{headerIcon:i(y,{}),reasoning:a.reason,gap:a.gap,score:a.score,isOpen:!0,onToggle:function(){return H(function(n){var i;return e(e({},n),((i={})[o]=!1,i))})},hideTrigger:!0,mdComponents:V,styles:{container:{border:"none",borderRadius:0,marginTop:0,marginBottom:0},header:{borderBottom:"none",backgroundColor:"#E9ECFD"},pill:{gap:"2px",border:"none",backgroundColor:"transparent"},sectionButton:{padding:"16px"}}})]}))]}),o)})})):i(s,e({sx:{display:"flex",flexDirection:"column",gap:"8px"}},{children:T.options.map(function(n,o){var t=Y(n),l=t.text,a=t.reasoning,d=t.explanation,c=t.id,u=t.isRecommended,x=T.userSelection===l;return r(s,e({sx:{display:"flex",flexDirection:"column",width:"100%"}},{children:[r(s,e({sx:{display:"flex",alignItems:"center",gap:"8px",width:"100%"}},{children:[r(s,e({onClick:function(){return J(l,c)},sx:{display:"flex",alignItems:"center",gap:"8px",padding:"8px",borderRadius:"8px",cursor:z?"pointer":"default",bgcolor:x?"#EFF4FF":"transparent",border:"1px solid",borderColor:x?"#B2CCFF":"transparent",transition:"all 0.15s ease-in-out",flex:1,boxSizing:"border-box"}},{children:[i(v,{isSelected:x,width:24,height:24}),i(p,e({sx:{fontSize:"14px",color:x?"#1D2939":"#344054",fontWeight:500}},{children:l})),u&&i("span",e({style:{borderRadius:"100px",border:"1px solid #D1E0FF",background:"#FFF",color:"#528BFF",padding:"0px 8px",whiteSpace:"nowrap",textOverflow:"ellipsis",fontFamily:"Inter",fontSize:"12px",fontStyle:"normal",fontWeight:"500",lineHeight:"20px"}},{children:"Recommended"}))]})),(a||d)&&r(s,e({onClick:function(n){n.stopPropagation(),H(function(n){var i;return e(e({},n),((i={})[o]=!n[o],i))})},sx:{display:"flex",alignItems:"center",gap:"2px",cursor:"pointer",flexShrink:0}},{children:[i(y,{}),_[o]?i(g,{size:12,color:"#667085"}):i(h,{size:12,color:"#667085"})]}))]})),(a||d)&&_[o]&&r(s,e({sx:{width:"100%",border:"1px solid #EAECF0",marginTop:"6px",borderRadius:"16px",overflow:"hidden",boxShadow:"0 1px 2px 0 rgba(16, 24, 40, 0.05)"}},{children:[d&&i(s,e({sx:{borderBottom:a?"1px solid #EAECF0":"none"}},{children:i(S,{explanation:d,isSelected:x,onProceed:function(){return J(l)},proceedIcon:i(k,{})})})),a&&i(b,{headerIcon:i(y,{}),reasoning:a.reason,gap:a.gap,score:a.score,isOpen:!0,onToggle:function(){return H(function(n){var i;return e(e({},n),((i={})[o]=!1,i))})},hideTrigger:!0,mdComponents:V,styles:{container:{border:"none",borderRadius:0,marginTop:0,marginBottom:0},header:{borderBottom:"none",backgroundColor:"#E9ECFD"},pill:{gap:"2px",border:"none",backgroundColor:"transparent"},sectionButton:{padding:"16px"}}})]}))]}),o)})}))]}))}))},E=function(n){var o=n.data,r=n.isLastMessage,d=n.onValidationChange,c=n.isSubmitted,p=n.citations,u=n.onTypeResponseClick,x=n.isGlobalEditActive,m=t(o.gaps.map(function(n){return e(e({},n),{userSelection:"checkbox"===n.inputType?[]:null})})),f=m[0],g=m[1],h=l(function(n,o){g(function(i){return i.map(function(i){return i.id===n?e(e({},i),{userSelection:o}):i})})},[]);a(function(){if(d){var e=f.some(function(e){return"checkbox"===e.inputType?Array.isArray(e.userSelection)&&e.userSelection.length>0:"text"===e.inputType?null!==e.userSelection&&"string"==typeof e.userSelection&&""!==e.userSelection.trim():null!==e.userSelection&&""!==e.userSelection});d(e,f)}},[f,d]);var b=r&&!c&&!x;return i(s,e({sx:{width:"100%",backgroundColor:"#FFFFFF",borderRadius:"8px",border:"1px solid #E3E6EA",padding:"14px",marginTop:"12px"}},{children:i(s,e({sx:{display:"flex",flexDirection:"column",gap:"16px"}},{children:f.map(function(e,n){return i(C,{index:n,gap:e,onUpdate:h,isEditable:b,citations:p,onTypeResponseClick:u},e.id)})}))}))};export{E as CriticalGaps};
2
2
  //# sourceMappingURL=CriticalGaps.js.map