@e-llm-studio/instant-learning 0.1.1-alpha.71 → 0.1.1-alpha.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("@mui/material"),a=require("react"),o=require("./_components/ChatComponents/ChatComponent.js"),i=require("./_components/ILPopup.js"),s=require("./_components/VariantLoadingOverlay.js"),r=require("./_components/templates/RuleComparison/RuleComparison.js"),l=require("./_components/templates/RuleComparison/AgentComposerRuleComparison.js"),d=require("./_components/ChatComponents/NormalChat.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=u(a);exports.default=function(u){var g=u.open,h=u.chatAssistantName,m=u.organizationName,p=u.baseUrl,f=u.baseWebsocketUrl,C=u.closeFunction,v=u.ThinkingBulbIconComponent,x=u.customSections,S=u.customMetaData,b=u.chatTitle,k=void 0===b?"Instant Learning On-The-Job":b,w=u.formTitle,M=void 0===w?"Instant Learning On-The-Job Form":w,y=u.onSave,I=u.headerMessageHandlers,R=u.aiResponse,_=u.setAIResponse,j=u.width,T=void 0===j?"90vw":j,F=u.height,V=void 0===F?"90vh":F,A=u.sendMessageInChat,D=void 0===A?"":A,L=u.setSendMessageInChat,E=u.validateCustom,B=u.onResetChat,W=u.template,q=u.templateProps,P=u.initialChatMessage,z=u.setCitations,O=u.isLoading,N=void 0!==O&&O,U=u.isLocked,J=void 0!==U&&U,H=u.saveButtonConfig,G=void 0===H?{label:"Save Learning",loadingLabel:"Saving Learning..."}:H,X=u.saveButtonColor,Y=u.saveWithoutValBtnConfig,K=void 0===Y?{label:"Save Without Validation",loadingLabel:"Saving Without Validation..."}:Y,Q=u.textareaPlaceholder,Z=u.setCurrentRequestId,$=u.showSavedMessage,ee=void 0!==$&&$,ne=u.savedMessage,te=void 0===ne?"Thank you teacher for teaching me, your learning has been saved successfully.":ne,ae=u.isError,oe=void 0!==ae&&ae,ie=u.errorMessage,se=void 0===ie?"I'm sorry, I couldn't save your changes. Please try again.":ie,re=u.isSaving,le=void 0!==re&&re,de=u.isAiStreaming,ue=u.setIsAiStreaming,ce=u.showConfirmReset,ge=void 0!==ce&&ce,he=u.setShowConfirmReset,me=u.confirmReset,pe=u.isLoadingVariants,fe=u.isFormDirty,Ce=u.onResetRequest,ve=u.mainText,xe=void 0===ve?"Adding a variant":ve,Se=u.subText,be=void 0===Se?"This may take a moment as we update the learning with the new variant.":Se,ke=u.showComparison,we=void 0!==ke&&ke,Me=u.setShowComparison,ye=u.showAgentComposerRuleComparison,Ie=void 0!==ye&&ye,Re=u.setShowAgentComposerRuleComparison,_e=u.isFetchingComparison,je=u.handleOpenComparison,Te=u.proposedRule,Fe=u.variants,Ve=u.onAddAsVariant,Ae=u.isCopyEnabled,De=u.showSaveWithoutValidation,Le=void 0!==De&&De,Ee=u.onSaveWithoutValidation,Be=u.onComparisonLinkClick,We=u.targetComparisonVariantId,qe=u.highlightedComparisonField,Pe=u.onSubmitFeedback,ze=u.isUseNormalChat,Oe=void 0!==ze&&ze,Ne=u.userDetails,Ue=u.handleGlobalClickCapture,Je=u.isGlobalEditActive,He=u.socketTimeOutInMilliSeconds,Ge=u.initialDraftMessage,Xe=u.onValidateSession,Ye=a.useState(g),Ke=Ye[0],Qe=Ye[1],Ze=a.useState(!1);Ze[0];var $e=Ze[1],en=a.useState(!1),nn=en[0],tn=en[1],an=a.useState(!1),on=an[0];an[1];var sn=a.useState(45),rn=sn[0],ln=sn[1],dn=a.useState("right"),un=dn[0],cn=dn[1],gn=c.default.useRef(un),hn=a.useState(!1),mn=hn[0],pn=hn[1],fn=a.useState(0),Cn=fn[0],vn=fn[1],xn=a.useState(40),Sn=xn[0],bn=xn[1];a.useEffect(function(){gn.current=un},[un]),a.useEffect(function(){Qe(g)},[g]);var kn=a.useCallback(function(e){e.preventDefault(),pn(!0),vn(e.clientX),bn(rn)},[rn]),wn=a.useCallback(function(e){if(mn){var n=document.querySelector("[data-dialog-content]");if(n){var t=n.getBoundingClientRect(),a=(e.clientX-Cn)/t.width*100,o=Math.max(20,Math.min(80,Sn+a));ln(o),o>Sn&&cn("right"),o<Sn&&cn("left")}}},[mn,Cn,Sn]),Mn=a.useCallback(function(){pn(!1)},[]);a.useEffect(function(){if(mn)return document.addEventListener("mousemove",wn),document.addEventListener("mouseup",Mn),function(){document.removeEventListener("mousemove",wn),document.removeEventListener("mouseup",Mn)}},[mn,wn,Mn]);var yn=function(e,n){J&&"backdropClick"===n||("escapeKeyDown"!==n&&"manualClose"!==n||!(null==fe?void 0:fe())?(Qe(!1),C()):null==Ce||Ce())},In=a.useCallback(function(e){ln(function(n){var t;if("number"==typeof e)return e>n&&cn("right"),e<n&&cn("left"),e;var a=gn.current,o=null!==(t={20:30,30:"left"===a?20:50,50:"left"===a?30:75,75:"left"===a?50:100,100:75}[n])&&void 0!==t?t:40;return 100===o&&cn("left"),20===o&&cn("right"),o})},[]),Rn=a.useCallback(function(){je&&(In(30),je())},[In,je]);return n.jsx(t.Dialog,e.__assign({open:Ke,onClose:yn,maxWidth:!1,fullWidth:!0,PaperProps:{sx:{width:T,height:V,display:"flex",flexDirection:"column",padding:0,margin:0,maxWidth:"100vw",borderRadius:"10px"}}},{children:n.jsxs(t.DialogContent,e.__assign({"data-dialog-content":!0,onClickCapture:Ue,sx:{flex:1,overflow:"hidden",display:"flex",flexDirection:"row",gap:0,padding:0,fontFamily:'"Plus Jakarta Sans", sans-serif',"& *":{fontFamily:'"Plus Jakarta Sans", sans-serif !important'}}},{children:[n.jsx(t.Box,e.__assign({sx:{width:"".concat(rn,"%"),maxWidth:"".concat(rn,"%"),transition:mn?"none":"width 0.3s ease-in-out, max-width 0.3s ease-in-out",bgcolor:"#ffffff",p:0,display:0===rn?"none":"flex",flexDirection:"column"}},{children:Oe?n.jsx(d.default,{chatAssistantName:h,organizationName:m,baseUrl:p,baseWebsocketUrl:f,setIsNewChatClicked:$e,ThinkingBulbIconComponent:v,isFormSaveClicked:nn,setIsFormSavedClicked:tn,onResetLearningData:function(){},sendMessageInChat:D,setSendMessageInChat:L,isFormValidating:on,chatTitle:k,customMetaData:S,headerMessageHandlers:I,aiResponse:R,setAIResponse:_,onResetChat:B,initialChatMessage:P,onSave:y,chatSize:rn,movingTowards:un,setChatSize:In,setCitations:z,textareaPlaceholder:Q,setCurrentRequestId:Z,showSavedMessage:ee,savedMessage:te,isError:oe,errorMessage:se,isSaving:le,onStreamingStateChange:ue,onViewComparison:Rn,isCopyEnabled:Ae,onComparisonLinkClick:Be,onSubmitFeedback:Pe}):n.jsx(o.default,{chatAssistantName:h,organizationName:m,baseUrl:p,baseWebsocketUrl:f,setIsNewChatClicked:$e,ThinkingBulbIconComponent:v,isFormSaveClicked:nn,setIsFormSavedClicked:tn,onResetLearningData:function(){},sendMessageInChat:D,setSendMessageInChat:L,isFormValidating:on,chatTitle:k,customMetaData:S,headerMessageHandlers:I,aiResponse:R,setAIResponse:_,onResetChat:B,initialChatMessage:P,onSave:y,chatSize:rn,movingTowards:un,setChatSize:In,setCitations:z,textareaPlaceholder:Q,setCurrentRequestId:Z,showSavedMessage:ee,savedMessage:te,isError:oe,errorMessage:se,isSaving:le,onStreamingStateChange:ue,onViewComparison:Rn,isCopyEnabled:Ae,onComparisonLinkClick:Be,onSubmitFeedback:Pe,userDetails:Ne,isGlobalEditActive:Je,socketTimeOutInMilliSeconds:He,initialDraftMessage:Ge,onValidateSession:Xe,onCloseSessionModal:me})})),n.jsx(t.Box,{sx:{width:"2px",cursor:"col-resize",backgroundColor:mn?"#1976d2":"#e0e0e0",transition:"background-color 0.2s ease","&:hover":{backgroundColor:"#1976d2"},flexShrink:0},onMouseDown:kn}),n.jsxs(t.Box,e.__assign({sx:{width:"".concat(100-rn,"%"),maxWidth:"".concat(100-rn,"%"),transition:mn?"none":"width 0.3s ease-in-out, max-width 0.3s ease-in-out",display:100===rn?"none":"flex",flexDirection:"column",overflowY:"hidden",position:"relative"}},{children:[n.jsx(s.default,{isLoading:_e||!1,mainText:"Fetching differences between rules",subText:"This may take a moment..."}),n.jsx(s.default,{isLoading:pe||!1,mainText:xe,subText:be}),Ie?n.jsx(l.default,{proposedRule:Te,variants:Fe,onSelectVariant:function(e){console.log("Selected Variant ID:",e.id)},onAddAsVariant:function(){null==Ve||Ve(),In(40),null==Re||Re(!1)},onSkip:function(){In(40),null==Re||Re(!1)},onBack:function(){In(40),null==Re||Re(!1)},targetVariantId:We,highlightedField:qe}):we?n.jsx(r.default,{variants:Fe,onSelectVariant:function(e){console.log("Selected Variant ID:",e.id)},onAddAsVariant:function(){null==Ve||Ve(),In(40),null==Me||Me(!1)},onSkip:function(){In(40),null==Me||Me(!1)},onBack:function(){In(40),null==Me||Me(!1)},targetVariantId:We}):n.jsx(i.default,{setIsFormSavedClicked:tn,customSections:x,onSave:y,formHeader:M,onClose:function(){return yn(0,"manualClose")},validateCustom:E,template:W,templateProps:q,isLoading:N,isAiStreaming:de,saveButtonConfig:G,saveButtonColor:X,showSaveWithoutValidation:Le,saveWithoutValBtnConfig:K,onSaveWithoutValidation:Ee}),n.jsx(t.Dialog,e.__assign({open:ge,onClose:function(){return null==he?void 0:he(!1)},PaperProps:{sx:{borderRadius:"12px",padding:"8px",maxWidth:"400px"}}},{children:n.jsxs(t.Box,e.__assign({sx:{p:3,textAlign:"center",fontFamily:"'Plus Jakarta Sans', sans-serif"}},{children:[n.jsx("h3",e.__assign({style:{fontSize:"18px",fontWeight:600,color:"#0F172A",marginBottom:"6px"}},{children:"Exit Teach Me OTJ?"})),n.jsx("p",e.__assign({style:{fontSize:"14px",color:"#64748B",lineHeight:"1.5",marginBottom:"10px"}},{children:"Exiting will discard any unsaved changes and end your session."})),n.jsxs(t.Box,e.__assign({sx:{display:"flex",gap:2,justifyContent:"center"}},{children:[n.jsx("button",e.__assign({onClick:function(){return null==he?void 0:he(!1)},style:{flex:1,padding:"10px 16px",cursor:"pointer",backgroundColor:"white",border:"1px solid #E2E8F0",borderRadius:"8px",fontSize:"14px",fontWeight:500,color:"#475569",transition:"all 0.2s"},onMouseOver:function(e){return e.currentTarget.style.backgroundColor="#F8FAFC"},onMouseOut:function(e){return e.currentTarget.style.backgroundColor="white"}},{children:"Cancel"})),n.jsx("button",e.__assign({onClick:me,style:{flex:1,padding:"10px 16px",backgroundColor:"#EF4444",color:"white",border:"none",borderRadius:"8px",fontSize:"14px",fontWeight:500,cursor:"pointer",transition:"background-color 0.2s"},onMouseOver:function(e){return e.currentTarget.style.backgroundColor="#DC2626"},onMouseOut:function(e){return e.currentTarget.style.backgroundColor="#EF4444"}},{children:"Yes, Discard"}))]}))]}))}))]}))]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("@mui/material"),a=require("react"),o=require("./_components/ChatComponents/ChatComponent.js"),i=require("./_components/ILPopup.js"),s=require("./_components/VariantLoadingOverlay.js"),r=require("./_components/templates/RuleComparison/RuleComparison.js"),l=require("./_components/templates/RuleComparison/AgentComposerRuleComparison.js"),u=require("./_components/ChatComponents/NormalChat.js"),d=require("../LearningManagement/store/useLearningTemplateStore.js"),c=require("./_components/templates/RuleComparison/RuleComparisonNew.js");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var m=g(a);exports.default=function(g){var h=g.open,p=g.chatAssistantName,f=g.organizationName,C=g.baseUrl,v=g.baseWebsocketUrl,x=g.closeFunction,S=g.ThinkingBulbIconComponent,b=g.customSections,k=g.customMetaData,w=g.chatTitle,M=void 0===w?"Instant Learning On-The-Job":w,y=g.formTitle,R=void 0===y?"Instant Learning On-The-Job Form":y,I=g.onSave,j=g.headerMessageHandlers,_=g.aiResponse,T=g.setAIResponse,V=g.width,F=void 0===V?"90vw":V,A=g.height,L=void 0===A?"90vh":A,D=g.sendMessageInChat,B=void 0===D?"":D,E=g.setSendMessageInChat,W=g.validateCustom,q=g.onResetChat,P=g.template,z=g.templateProps,O=g.initialChatMessage,N=g.setCitations,U=g.isLoading,J=void 0!==U&&U,H=g.isLocked,G=void 0!==H&&H,X=g.saveButtonConfig,Y=void 0===X?{label:"Save Learning",loadingLabel:"Saving Learning..."}:X,K=g.saveButtonColor,Q=g.saveWithoutValBtnConfig,Z=void 0===Q?{label:"Save Without Validation",loadingLabel:"Saving Without Validation..."}:Q,$=g.textareaPlaceholder,ee=g.setCurrentRequestId,ne=g.showSavedMessage,te=void 0!==ne&&ne,ae=g.savedMessage,oe=void 0===ae?"Thank you teacher for teaching me, your learning has been saved successfully.":ae,ie=g.isError,se=void 0!==ie&&ie,re=g.errorMessage,le=void 0===re?"I'm sorry, I couldn't save your changes. Please try again.":re,ue=g.isSaving,de=void 0!==ue&&ue,ce=g.isAiStreaming,ge=g.setIsAiStreaming,me=g.showConfirmReset,he=void 0!==me&&me,pe=g.setShowConfirmReset,fe=g.confirmReset,Ce=g.isLoadingVariants,ve=g.isFormDirty,xe=g.onResetRequest,Se=g.mainText,be=void 0===Se?"Adding a variant":Se,ke=g.subText,we=void 0===ke?"This may take a moment as we update the learning with the new variant.":ke,Me=g.showComparison,ye=void 0!==Me&&Me,Re=g.setShowComparison,Ie=g.showAgentComposerRuleComparison,je=void 0!==Ie&&Ie,_e=g.setShowAgentComposerRuleComparison,Te=g.isFetchingComparison,Ve=g.handleOpenComparison,Fe=g.proposedRule,Ae=g.variants,Le=g.onAddAsVariant,De=g.isCopyEnabled,Be=g.showSaveWithoutValidation,Ee=void 0!==Be&&Be,We=g.onSaveWithoutValidation,qe=g.onComparisonLinkClick,Pe=g.targetComparisonVariantId,ze=g.highlightedComparisonField,Oe=g.onSubmitFeedback,Ne=g.isUseNormalChat,Ue=void 0!==Ne&&Ne,Je=g.userDetails,He=g.handleGlobalClickCapture,Ge=g.isGlobalEditActive,Xe=g.socketTimeOutInMilliSeconds,Ye=g.initialDraftMessage,Ke=g.onValidateSession,Qe=a.useState(h),Ze=Qe[0],$e=Qe[1],en=a.useState(!1);en[0];var nn=en[1],tn=a.useState(!1),an=tn[0],on=tn[1],sn=a.useState(!1),rn=sn[0];sn[1];var ln=a.useState(45),un=ln[0],dn=ln[1],cn=a.useState("right"),gn=cn[0],mn=cn[1],hn=m.default.useRef(gn),pn=a.useState(!1),fn=pn[0],Cn=pn[1],vn=a.useState(0),xn=vn[0],Sn=vn[1],bn=a.useState(40),kn=bn[0],wn=bn[1],Mn=d.useLearningTemplateStore.getState().backwardCompatibility;a.useEffect(function(){hn.current=gn},[gn]),a.useEffect(function(){$e(h)},[h]);var yn=a.useCallback(function(e){e.preventDefault(),Cn(!0),Sn(e.clientX),wn(un)},[un]),Rn=a.useCallback(function(e){if(fn){var n=document.querySelector("[data-dialog-content]");if(n){var t=n.getBoundingClientRect(),a=(e.clientX-xn)/t.width*100,o=Math.max(20,Math.min(80,kn+a));dn(o),o>kn&&mn("right"),o<kn&&mn("left")}}},[fn,xn,kn]),In=a.useCallback(function(){Cn(!1)},[]);a.useEffect(function(){if(fn)return document.addEventListener("mousemove",Rn),document.addEventListener("mouseup",In),function(){document.removeEventListener("mousemove",Rn),document.removeEventListener("mouseup",In)}},[fn,Rn,In]);var jn=function(e,n){G&&"backdropClick"===n||("escapeKeyDown"!==n&&"manualClose"!==n||!(null==ve?void 0:ve())?($e(!1),x()):null==xe||xe())},_n=a.useCallback(function(e){dn(function(n){var t;if("number"==typeof e)return e>n&&mn("right"),e<n&&mn("left"),e;var a=hn.current,o=null!==(t={20:30,30:"left"===a?20:50,50:"left"===a?30:75,75:"left"===a?50:100,100:75}[n])&&void 0!==t?t:40;return 100===o&&mn("left"),20===o&&mn("right"),o})},[]),Tn=a.useCallback(function(){Ve&&(_n(30),Ve())},[_n,Ve]);return n.jsx(t.Dialog,e.__assign({open:Ze,onClose:jn,maxWidth:!1,fullWidth:!0,PaperProps:{sx:{width:F,height:L,display:"flex",flexDirection:"column",padding:0,margin:0,maxWidth:"100vw",borderRadius:"10px"}}},{children:n.jsxs(t.DialogContent,e.__assign({"data-dialog-content":!0,onClickCapture:He,sx:{flex:1,overflow:"hidden",display:"flex",flexDirection:"row",gap:0,padding:0,fontFamily:'"Plus Jakarta Sans", sans-serif',"& *":{fontFamily:'"Plus Jakarta Sans", sans-serif !important'}}},{children:[n.jsx(t.Box,e.__assign({sx:{width:"".concat(un,"%"),maxWidth:"".concat(un,"%"),transition:fn?"none":"width 0.3s ease-in-out, max-width 0.3s ease-in-out",bgcolor:"#ffffff",p:0,display:0===un?"none":"flex",flexDirection:"column"}},{children:Ue?n.jsx(u.default,{chatAssistantName:p,organizationName:f,baseUrl:C,baseWebsocketUrl:v,setIsNewChatClicked:nn,ThinkingBulbIconComponent:S,isFormSaveClicked:an,setIsFormSavedClicked:on,onResetLearningData:function(){},sendMessageInChat:B,setSendMessageInChat:E,isFormValidating:rn,chatTitle:M,customMetaData:k,headerMessageHandlers:j,aiResponse:_,setAIResponse:T,onResetChat:q,initialChatMessage:O,onSave:I,chatSize:un,movingTowards:gn,setChatSize:_n,setCitations:N,textareaPlaceholder:$,setCurrentRequestId:ee,showSavedMessage:te,savedMessage:oe,isError:se,errorMessage:le,isSaving:de,onStreamingStateChange:ge,onViewComparison:Tn,isCopyEnabled:De,onComparisonLinkClick:qe,onSubmitFeedback:Oe}):n.jsx(o.default,{chatAssistantName:p,organizationName:f,baseUrl:C,baseWebsocketUrl:v,setIsNewChatClicked:nn,ThinkingBulbIconComponent:S,isFormSaveClicked:an,setIsFormSavedClicked:on,onResetLearningData:function(){},sendMessageInChat:B,setSendMessageInChat:E,isFormValidating:rn,chatTitle:M,customMetaData:k,headerMessageHandlers:j,aiResponse:_,setAIResponse:T,onResetChat:q,initialChatMessage:O,onSave:I,chatSize:un,movingTowards:gn,setChatSize:_n,setCitations:N,textareaPlaceholder:$,setCurrentRequestId:ee,showSavedMessage:te,savedMessage:oe,isError:se,errorMessage:le,isSaving:de,onStreamingStateChange:ge,onViewComparison:Tn,isCopyEnabled:De,onComparisonLinkClick:qe,onSubmitFeedback:Oe,userDetails:Je,isGlobalEditActive:Ge,socketTimeOutInMilliSeconds:Xe,initialDraftMessage:Ye,onValidateSession:Ke,onCloseSessionModal:fe})})),n.jsx(t.Box,{sx:{width:"2px",cursor:"col-resize",backgroundColor:fn?"#1976d2":"#e0e0e0",transition:"background-color 0.2s ease","&:hover":{backgroundColor:"#1976d2"},flexShrink:0},onMouseDown:yn}),n.jsxs(t.Box,e.__assign({sx:{width:"".concat(100-un,"%"),maxWidth:"".concat(100-un,"%"),transition:fn?"none":"width 0.3s ease-in-out, max-width 0.3s ease-in-out",display:100===un?"none":"flex",flexDirection:"column",overflowY:"hidden",position:"relative"}},{children:[n.jsx(s.default,{isLoading:Te||!1,mainText:"Fetching differences between rules",subText:"This may take a moment..."}),n.jsx(s.default,{isLoading:Ce||!1,mainText:be,subText:we}),je?n.jsx(l.default,{proposedRule:Fe,variants:Ae,onSelectVariant:function(e){console.log("Selected Variant ID:",e.id)},onAddAsVariant:function(){null==Le||Le(),_n(40),null==_e||_e(!1)},onSkip:function(){_n(40),null==_e||_e(!1)},onBack:function(){_n(40),null==_e||_e(!1)},targetVariantId:Pe,highlightedField:ze}):ye?Mn?n.jsx(c.default,{proposedRule:Fe,variants:Ae,onSelectVariant:function(e){console.log("Selected Variant ID:",e.id)},onAddAsVariant:function(){null==Le||Le(),_n(40),null==Re||Re(!1)},onSkip:function(){_n(40),null==Re||Re(!1)},onBack:function(){_n(40),null==Re||Re(!1)},targetVariantId:Pe,highlightedField:ze}):n.jsx(r.default,{variants:Ae,onSelectVariant:function(e){console.log("Selected Variant ID:",e.id)},onAddAsVariant:function(){null==Le||Le(),_n(40),null==Re||Re(!1)},onSkip:function(){_n(40),null==Re||Re(!1)},onBack:function(){_n(40),null==Re||Re(!1)},targetVariantId:Pe}):n.jsx(i.default,{setIsFormSavedClicked:on,customSections:b,onSave:I,formHeader:R,onClose:function(){return jn(0,"manualClose")},validateCustom:W,template:P,templateProps:z,isLoading:J,isAiStreaming:ce,saveButtonConfig:Y,saveButtonColor:K,showSaveWithoutValidation:Ee,saveWithoutValBtnConfig:Z,onSaveWithoutValidation:We}),n.jsx(t.Dialog,e.__assign({open:he,onClose:function(){return null==pe?void 0:pe(!1)},PaperProps:{sx:{borderRadius:"12px",padding:"8px",maxWidth:"400px"}}},{children:n.jsxs(t.Box,e.__assign({sx:{p:3,textAlign:"center",fontFamily:"'Plus Jakarta Sans', sans-serif"}},{children:[n.jsx("h3",e.__assign({style:{fontSize:"18px",fontWeight:600,color:"#0F172A",marginBottom:"6px"}},{children:"Exit Teach Me OTJ?"})),n.jsx("p",e.__assign({style:{fontSize:"14px",color:"#64748B",lineHeight:"1.5",marginBottom:"10px"}},{children:"Exiting will discard any unsaved changes and end your session."})),n.jsxs(t.Box,e.__assign({sx:{display:"flex",gap:2,justifyContent:"center"}},{children:[n.jsx("button",e.__assign({onClick:function(){return null==pe?void 0:pe(!1)},style:{flex:1,padding:"10px 16px",cursor:"pointer",backgroundColor:"white",border:"1px solid #E2E8F0",borderRadius:"8px",fontSize:"14px",fontWeight:500,color:"#475569",transition:"all 0.2s"},onMouseOver:function(e){return e.currentTarget.style.backgroundColor="#F8FAFC"},onMouseOut:function(e){return e.currentTarget.style.backgroundColor="white"}},{children:"Cancel"})),n.jsx("button",e.__assign({onClick:fe,style:{flex:1,padding:"10px 16px",backgroundColor:"#EF4444",color:"white",border:"none",borderRadius:"8px",fontSize:"14px",fontWeight:500,cursor:"pointer",transition:"background-color 0.2s"},onMouseOver:function(e){return e.currentTarget.style.backgroundColor="#DC2626"},onMouseOut:function(e){return e.currentTarget.style.backgroundColor="#EF4444"}},{children:"Yes, Discard"}))]}))]}))}))]}))]}))}))};
2
2
  //# sourceMappingURL=ILOTJ.js.map
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("@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
+ //# sourceMappingURL=RuleComparisonNew.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RuleComparisonNew.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react/jsx-runtime"),i=require("react"),n=require("uuid"),t=require("../config.js"),s=require("../store/useAuthStore.js"),o=require("../RuleContent/AddScopeApprovalSearchComponent.js"),a=require("../store/useAppSecRolesStore.js"),l=require("../store/useEnvStore.js"),p=require("./ScopeSkeletonLoader.js");exports.default=function(d){var u=d.isOpen,c=d.onClose,g=d.onSubmit,x=d.hasGlobalRuleSet,_=void 0!==x&&x;d.canCreateGlobal;var f=i.useState("");f[0];var h=f[1],v=i.useState(""),b=v[0],m=v[1],y=i.useState(""),S=y[0],j=y[1],C=i.useState(!1),q=C[0],k=C[1],E=i.useState({}),w=E[0],B=E[1],D=i.useState("approval_required"),R=D[0],A=D[1],z=i.useState([]),I=z[0],F=z[1],G=i.useState([]),L=G[0],N=G[1],T=i.useState(""),W=T[0],O=T[1],P=s.default().user,M=a.useAppSecRolesStore(function(e){return e.roles}),H=l.default(function(e){return e.rbacConfig});if(i.useEffect(function(){u&&(h(""),m(""),j(""),B({}),A("approval_required"),F([]),N([]),O(""))},[u]),!u)return null;var K={overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.3)"},modal:{position:"relative",width:"600px",borderRadius:"12px",backgroundColor:"#ffffff",padding:"24px",boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",maxHeight:"90vh",overflowY:"auto"},header:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"24px"},title:{margin:0,fontSize:"18px",fontWeight:500,color:"#19213D"},subtitle:{marginTop:"4px",fontSize:"14px",fontWeight:400,color:"#666F8D"},closeButton:{background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"#9CA3AF"},formGroup:{display:"flex",flexDirection:"column",marginBottom:"20px",gap:"6px"},label:{fontSize:"14px",fontWeight:500,color:"#19213D"},asterisk:{color:"#8F2C23",marginRight:"4px",fontSize:"16px",fontWeight:600},input:{width:"100%",padding:"8px 12px",borderRadius:"6px",border:"1px solid #E2E8F0",outline:"none",fontSize:"14px"},inputError:{border:"1px solid #8F2C23"},errorText:{margin:0,marginTop:"4px",fontSize:"12px",color:"#8F2C23"},textarea:{width:"100%",padding:"8px 12px",borderRadius:"6px",border:"1px solid #E2E8F0",outline:"none",fontSize:"14px",minHeight:"100px",maxHeight:"200px",overflowY:"auto",resize:"vertical"},footer:{display:"flex",justifyContent:"flex-end",gap:"12px",marginTop:"32px"},cancelBtn:{padding:"8px 16px",borderRadius:"6px",border:"1px solid #E2E8F0",backgroundColor:"transparent",color:"#64748B",fontSize:"14px",fontWeight:500,cursor:"pointer"},submitBtn:{padding:"8px 16px",borderRadius:"6px",border:"none",backgroundColor:"#2563EB",color:"#ffffff",fontSize:"14px",fontWeight:500,cursor:"pointer"},disabledBtn:{opacity:.5,cursor:"not-allowed"}};return q?r.jsx(p.default,{isLoading:q}):r.jsx("div",e.__assign({style:K.overlay},{children:r.jsxs("div",e.__assign({style:K.modal},{children:[r.jsxs("div",e.__assign({style:K.header},{children:[r.jsxs("div",{children:[r.jsx("h2",e.__assign({style:K.title},{children:"Create Scope"})),r.jsx("p",e.__assign({style:K.subtitle},{children:"Create a scope to group and manage rules."}))]}),r.jsx("button",e.__assign({onClick:c,style:K.closeButton},{children:"✕"}))]})),r.jsxs("div",{children:[r.jsxs("div",e.__assign({style:K.formGroup},{children:[r.jsxs("label",e.__assign({style:K.label},{children:[r.jsx("span",e.__assign({style:K.asterisk},{children:"*"})),"Scope Name"]})),r.jsx("input",{type:"text",value:b,onChange:function(r){m(r.target.value),w.name&&B(function(r){return e.__assign(e.__assign({},r),{name:void 0})})},placeholder:"e.g. Global Learnings",style:e.__assign(e.__assign({},K.input),w.name?K.inputError:{})}),w.name&&r.jsx("p",e.__assign({style:K.errorText},{children:w.name}))]})),r.jsxs("div",e.__assign({style:K.formGroup},{children:[r.jsxs("label",e.__assign({style:K.label},{children:[r.jsx("span",e.__assign({style:K.asterisk},{children:"*"})),"Description"]})),r.jsx("input",{type:"text",value:S,onChange:function(r){var i=r.target.value;if(i.length>200)return j(i.slice(0,200)),void B(function(r){return e.__assign(e.__assign({},r),{description:"Description must be 200 characters or fewer"})});j(i),w.description&&B(function(r){return e.__assign(e.__assign({},r),{description:void 0})})},placeholder:"Enter short description for scope",style:e.__assign(e.__assign({},K.input),w.description?K.inputError:{})}),w.description&&r.jsx("p",e.__assign({style:K.errorText},{children:w.description}))]})),r.jsxs("div",e.__assign({style:e.__assign(e.__assign({},K.formGroup),{gap:"12px"})},{children:[r.jsx("label",e.__assign({style:K.label},{children:"Approval Settings"})),r.jsxs("div",e.__assign({role:"radio","aria-checked":"approval_required"===R,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:"4px"},onClick:function(){return A("approval_required")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||A("approval_required")}},{children:[r.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[r.jsx("div",e.__assign({style:{display:"flex",height:"16px",width:"16px",flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("approval_required"===R?"#2563EB":"#CBD5E1")}},{children:"approval_required"===R&&r.jsx("div",{style:{height:"8px",width:"8px",borderRadius:"50%",backgroundColor:"#2563EB"}})})),r.jsx("span",e.__assign({style:{fontSize:"14px",fontWeight:500,color:"#19213D"}},{children:"Approval Required Before Publishing"}))]})),r.jsx("p",e.__assign({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#666F8D"}},{children:"Learnings require approval before publishing."}))]})),"approval_required"===R&&r.jsx(o.default,{selectedApprovers:I,selectedGroupOfApprovers:L,onApproversChange:F,onGroupsChange:N}),W&&r.jsx("p",e.__assign({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#8F2C23"}},{children:W})),r.jsxs("div",e.__assign({role:"radio","aria-checked":"publish_without"===R,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:"4px"},onClick:function(){A("publish_without"),O("")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||(A("publish_without"),O(""))}},{children:[r.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[r.jsx("div",e.__assign({style:{display:"flex",height:"16px",width:"16px",flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("publish_without"===R?"#2563EB":"#CBD5E1")}},{children:"publish_without"===R&&r.jsx("div",{style:{height:"8px",width:"8px",borderRadius:"50%",backgroundColor:"#2563EB"}})})),r.jsx("span",e.__assign({style:{fontSize:"14px",fontWeight:500,color:"#19213D"}},{children:"Publish Without Approval"}))]})),r.jsx("p",e.__assign({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#666F8D"}},{children:"Learnings can be published directly."}))]}))]}))]}),r.jsxs("div",e.__assign({style:K.footer},{children:[r.jsx("button",e.__assign({onClick:c,disabled:q,style:e.__assign(e.__assign({},K.cancelBtn),q?K.disabledBtn:{})},{children:"Cancel"})),r.jsx("button",e.__assign({onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var r,i,s,o,a,l,p,d;return e.__generator(this,function(u){switch(u.label){case 0:if(x={},f=!0,b.trim()||(x.name="Scope Name is required",f=!1),S.trim()||(x.description="Description is required",f=!1),B(x),!f)return[2];if("approval_required"===R&&0===I.length&&0===L.length)return O("Please select at least one approver or approver group."),[2];O(""),k(!0),r=_?"genreRuleSet":"globalRuleSet",i="approval_required"===R,console.log("topicData",r),s={topic:r,customScopeGroupName:t.IL_CONFIG_CONSTANTS.CUSTOM_SCOPE_GROUP_NAME,scopeDescription:S,parentScopeId:null,customScopeName:b,customScopeId:n.v4(),createByName:null==P?void 0:P.firstname,createdBy:null==P?void 0:P.email,approvalRequired:i,appsecData:{application:null==H?void 0:H.applicationId,module:null==H?void 0:H.moduleId,roles:e.__spreadArray(e.__spreadArray([],i?[{users:I.map(function(e){return e.email}),groups:L.map(function(e){return e._id}),role:null!==(l=null===(a=M.find(function(e){return"Learning Manager"===e.name}))||void 0===a?void 0:a._id)&&void 0!==l?l:""}]:[],!0),[{users:[null==P?void 0:P.email],groups:[],role:null!==(d=null===(p=M.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===p?void 0:p._id)&&void 0!==d?d:""}],!1)}},u.label=1;case 1:return u.trys.push([1,3,4,5]),[4,g(s)];case 2:return u.sent(),c(),[3,5];case 3:return o=u.sent(),console.error("Error in submission",o),[3,5];case 4:return k(!1),[7];case 5:return[2]}var x,f})})},disabled:q,style:e.__assign(e.__assign({},K.submitBtn),q?K.disabledBtn:{})},{children:q?"Creating...":"Create Scope"}))]}))]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react/jsx-runtime"),i=require("react"),n=require("uuid"),t=require("../config.js"),s=require("../store/useAuthStore.js"),o=require("../RuleContent/AddScopeApprovalSearchComponent.js"),a=require("../store/useAppSecRolesStore.js"),l=require("../store/useEnvStore.js"),p=require("./ScopeSkeletonLoader.js");exports.default=function(d){var u=d.isOpen,c=d.onClose,g=d.onSubmit,x=d.hasGlobalRuleSet,_=void 0!==x&&x;d.canCreateGlobal;var f=i.useState("");f[0];var h=f[1],v=i.useState(""),b=v[0],m=v[1],y=i.useState(""),S=y[0],j=y[1],C=i.useState(!1),q=C[0],k=C[1],E=i.useState({}),w=E[0],B=E[1],D=i.useState("approval_required"),R=D[0],A=D[1],z=i.useState([]),I=z[0],F=z[1],G=i.useState([]),L=G[0],N=G[1],T=i.useState(""),W=T[0],O=T[1],P=s.default().user,M=a.useAppSecRolesStore(function(e){return e.roles}),H=l.default(function(e){return e.rbacConfig});if(i.useEffect(function(){u&&(h(""),m(""),j(""),B({}),A("approval_required"),F([]),N([]),O(""))},[u]),!u)return null;var K={overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.3)"},modal:{position:"relative",width:"600px",borderRadius:"12px",backgroundColor:"#ffffff",padding:"24px",boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",maxHeight:"90vh",overflowY:"auto"},header:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"24px"},title:{margin:0,fontSize:"18px",fontWeight:500,color:"#19213D"},subtitle:{marginTop:"4px",fontSize:"14px",fontWeight:400,color:"#666F8D"},closeButton:{background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"#9CA3AF"},formGroup:{display:"flex",flexDirection:"column",marginBottom:"20px",gap:"6px"},label:{fontSize:"14px",fontWeight:500,color:"#19213D"},asterisk:{color:"#8F2C23",marginRight:"4px",fontSize:"16px",fontWeight:600},input:{width:"100%",padding:"8px 12px",borderRadius:"6px",border:"1px solid #E2E8F0",outline:"none",fontSize:"14px"},inputError:{border:"1px solid #8F2C23"},errorText:{margin:0,marginTop:"4px",fontSize:"12px",color:"#8F2C23"},textarea:{width:"100%",padding:"8px 12px",borderRadius:"6px",border:"1px solid #E2E8F0",outline:"none",fontSize:"14px",minHeight:"100px",maxHeight:"200px",overflowY:"auto",resize:"vertical"},footer:{display:"flex",justifyContent:"flex-end",gap:"12px",marginTop:"32px"},cancelBtn:{padding:"8px 16px",borderRadius:"6px",border:"1px solid #E2E8F0",backgroundColor:"transparent",color:"#64748B",fontSize:"14px",fontWeight:500,cursor:"pointer"},submitBtn:{padding:"8px 16px",borderRadius:"6px",border:"none",backgroundColor:"#2563EB",color:"#ffffff",fontSize:"14px",fontWeight:500,cursor:"pointer"},disabledBtn:{opacity:.5,cursor:"not-allowed"}};return q?r.jsx(p.default,{isLoading:q}):r.jsx("div",e.__assign({style:K.overlay},{children:r.jsxs("div",e.__assign({style:K.modal},{children:[r.jsxs("div",e.__assign({style:K.header},{children:[r.jsxs("div",{children:[r.jsx("h2",e.__assign({style:K.title},{children:"Create Scope"})),r.jsx("p",e.__assign({style:K.subtitle},{children:"Create a scope to group and manage rules."}))]}),r.jsx("button",e.__assign({onClick:c,style:K.closeButton},{children:"✕"}))]})),r.jsxs("div",{children:[r.jsxs("div",e.__assign({style:K.formGroup},{children:[r.jsxs("label",e.__assign({style:K.label},{children:[r.jsx("span",e.__assign({style:K.asterisk},{children:"*"})),"Scope Name"]})),r.jsx("input",{type:"text",value:b,onChange:function(r){var i=r.target.value;if(i.length>50)return m(i.slice(0,50)),void B(function(r){return e.__assign(e.__assign({},r),{name:"Scope Name must be 50 characters or fewer"})});m(i),w.name&&B(function(r){return e.__assign(e.__assign({},r),{name:void 0})})},placeholder:"e.g. Global Learnings",style:e.__assign(e.__assign({},K.input),w.name?K.inputError:{})}),w.name&&r.jsx("p",e.__assign({style:K.errorText},{children:w.name}))]})),r.jsxs("div",e.__assign({style:K.formGroup},{children:[r.jsxs("label",e.__assign({style:K.label},{children:[r.jsx("span",e.__assign({style:K.asterisk},{children:"*"})),"Description"]})),r.jsx("input",{type:"text",value:S,onChange:function(r){var i=r.target.value;if(i.length>200)return j(i.slice(0,200)),void B(function(r){return e.__assign(e.__assign({},r),{description:"Description must be 200 characters or fewer"})});j(i),w.description&&B(function(r){return e.__assign(e.__assign({},r),{description:void 0})})},placeholder:"Enter short description for scope",style:e.__assign(e.__assign({},K.input),w.description?K.inputError:{})}),w.description&&r.jsx("p",e.__assign({style:K.errorText},{children:w.description}))]})),r.jsxs("div",e.__assign({style:e.__assign(e.__assign({},K.formGroup),{gap:"12px"})},{children:[r.jsx("label",e.__assign({style:K.label},{children:"Approval Settings"})),r.jsxs("div",e.__assign({role:"radio","aria-checked":"approval_required"===R,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:"4px"},onClick:function(){return A("approval_required")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||A("approval_required")}},{children:[r.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[r.jsx("div",e.__assign({style:{display:"flex",height:"16px",width:"16px",flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("approval_required"===R?"#2563EB":"#CBD5E1")}},{children:"approval_required"===R&&r.jsx("div",{style:{height:"8px",width:"8px",borderRadius:"50%",backgroundColor:"#2563EB"}})})),r.jsx("span",e.__assign({style:{fontSize:"14px",fontWeight:500,color:"#19213D"}},{children:"Approval Required Before Publishing"}))]})),r.jsx("p",e.__assign({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#666F8D"}},{children:"Learnings require approval before publishing."}))]})),"approval_required"===R&&r.jsx(o.default,{selectedApprovers:I,selectedGroupOfApprovers:L,onApproversChange:F,onGroupsChange:N}),W&&r.jsx("p",e.__assign({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#8F2C23"}},{children:W})),r.jsxs("div",e.__assign({role:"radio","aria-checked":"publish_without"===R,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:"4px"},onClick:function(){A("publish_without"),O("")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||(A("publish_without"),O(""))}},{children:[r.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[r.jsx("div",e.__assign({style:{display:"flex",height:"16px",width:"16px",flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("publish_without"===R?"#2563EB":"#CBD5E1")}},{children:"publish_without"===R&&r.jsx("div",{style:{height:"8px",width:"8px",borderRadius:"50%",backgroundColor:"#2563EB"}})})),r.jsx("span",e.__assign({style:{fontSize:"14px",fontWeight:500,color:"#19213D"}},{children:"Publish Without Approval"}))]})),r.jsx("p",e.__assign({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#666F8D"}},{children:"Learnings can be published directly."}))]}))]}))]}),r.jsxs("div",e.__assign({style:K.footer},{children:[r.jsx("button",e.__assign({onClick:c,disabled:q,style:e.__assign(e.__assign({},K.cancelBtn),q?K.disabledBtn:{})},{children:"Cancel"})),r.jsx("button",e.__assign({onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var r,i,s,o,a,l,p,d;return e.__generator(this,function(u){switch(u.label){case 0:if(x={},f=!0,b.trim()||(x.name="Scope Name is required",f=!1),S.trim()||(x.description="Description is required",f=!1),B(x),!f)return[2];if("approval_required"===R&&0===I.length&&0===L.length)return O("Please select at least one approver or approver group."),[2];O(""),k(!0),r=_?"genreRuleSet":"globalRuleSet",i="approval_required"===R,console.log("topicData",r),s={topic:r,customScopeGroupName:t.IL_CONFIG_CONSTANTS.CUSTOM_SCOPE_GROUP_NAME,scopeDescription:S,parentScopeId:null,customScopeName:b,customScopeId:n.v4(),createByName:null==P?void 0:P.firstname,createdBy:null==P?void 0:P.email,approvalRequired:i,appsecData:{application:null==H?void 0:H.applicationId,module:null==H?void 0:H.moduleId,roles:e.__spreadArray(e.__spreadArray([],i?[{users:I.map(function(e){return e.email}),groups:L.map(function(e){return e._id}),role:null!==(l=null===(a=M.find(function(e){return"Learning Manager"===e.name}))||void 0===a?void 0:a._id)&&void 0!==l?l:""}]:[],!0),[{users:[null==P?void 0:P.email],groups:[],role:null!==(d=null===(p=M.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===p?void 0:p._id)&&void 0!==d?d:""}],!1)}},u.label=1;case 1:return u.trys.push([1,3,4,5]),[4,g(s)];case 2:return u.sent(),c(),[3,5];case 3:return o=u.sent(),console.error("Error in submission",o),[3,5];case 4:return k(!1),[7];case 5:return[2]}var x,f})})},disabled:q,style:e.__assign(e.__assign({},K.submitBtn),q?K.disabledBtn:{})},{children:q?"Creating...":"Create Scope"}))]}))]}))}))};
2
2
  //# sourceMappingURL=CreateRuleSetLegacyModal.js.map