@e-llm-studio/instant-learning 0.0.134 → 0.0.136
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/features/IL-OTJ/_components/ChatComponents/ChatComponent.js +1 -1
- package/dist/cjs/features/IL-OTJ/_components/MarkdownComponents/MarkdownElements.js +2 -0
- package/dist/cjs/features/IL-OTJ/_components/MarkdownComponents/MarkdownElements.js.map +1 -0
- package/dist/cjs/features/IL-OTJ/_components/MarkdownComponents/MarkdownSelect.js +2 -0
- package/dist/cjs/features/IL-OTJ/_components/MarkdownComponents/MarkdownSelect.js.map +1 -0
- package/dist/cjs/features/IL-OTJ/_components/MessageRendering/MessageRendering.js +1 -1
- package/dist/cjs/features/IL-OTJ/_components/molecules/Condition/ConditionList.js +1 -1
- package/dist/cjs/features/IL-OTJ/_components/organisms/ConditionSection/ConditionSection.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/node_modules/lucide-react/dist/esm/icons/send-horizontal.js +1 -1
- package/dist/cjs/node_modules/lucide-react/dist/esm/icons/send-horizontal.js.map +1 -1
- package/dist/features/IL-OTJ/_components/ChatComponents/ChatComponent.js +1 -1
- package/dist/features/IL-OTJ/_components/MarkdownComponents/MarkdownElements.js +2 -0
- package/dist/features/IL-OTJ/_components/MarkdownComponents/MarkdownElements.js.map +1 -0
- package/dist/features/IL-OTJ/_components/MarkdownComponents/MarkdownSelect.js +2 -0
- package/dist/features/IL-OTJ/_components/MarkdownComponents/MarkdownSelect.js.map +1 -0
- package/dist/features/IL-OTJ/_components/MessageRendering/MessageRendering.js +1 -1
- package/dist/features/IL-OTJ/_components/molecules/Condition/ConditionList.js +1 -1
- package/dist/features/IL-OTJ/_components/organisms/ConditionSection/ConditionSection.js +1 -1
- package/dist/index.js +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/send-horizontal.js +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/send-horizontal.js.map +1 -1
- package/dist/types/src/features/IL-OTJ/ILOTJTest.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/ChatComponents/ChatComponent.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/MarkdownComponents/MarkdownElements.d.ts +26 -0
- package/dist/types/src/features/IL-OTJ/_components/MarkdownComponents/MarkdownElements.d.ts.map +1 -0
- package/dist/types/src/features/IL-OTJ/_components/MarkdownComponents/MarkdownSelect.d.ts +20 -0
- package/dist/types/src/features/IL-OTJ/_components/MarkdownComponents/MarkdownSelect.d.ts.map +1 -0
- package/dist/types/src/features/IL-OTJ/_components/MessageRendering/MessageRendering.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/molecules/Condition/ConditionList.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/organisms/ConditionSection/ConditionSection.d.ts +1 -1
- package/dist/types/src/features/IL-OTJ/_components/organisms/ConditionSection/ConditionSection.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownSelect.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__spreadArray as e,__rest as n,__assign as t}from"../../../../node_modules/tslib/tslib.es6.mjs.js";import{jsx as r,jsxs as a,Fragment as i}from"react/jsx-runtime";import{ReactMarkdown as o}from"../../../../node_modules/react-markdown/lib/react-markdown.js";import c from"../../../../node_modules/rehype-raw/lib/index.js";import s from"../../../../node_modules/remark-gfm/index.js";import{useState as d,useRef as l,useEffect as u,useCallback as m,useMemo as f}from"react";import{RuleDisplay as v,ActionableButton as g,ActionableCheckbox as h}from"./ClickableChatComponents.js";import{MarkdownLinkRenderer as p,MarkdownDivRenderer as S,MarkdownSpanRenderer as b}from"./MarkdownElements.js";import{extractTextFromChildren as w}from"../../helpers/utils.js";import{RuleVariantCard as k}from"./RuleVariantCard.js";var y=function(y){var C=y.index,E=y.content,T=y.role;y.messages;var x=y.handleStream,I=y.scrollToBottom,B=y.isLastMessage,N=y.onSave,L=y.citations,z=y.setChatSize,M=y.chatSize,j=y.isStreamEnd,_=y.messageIsEnd,A=d(E),W=A[0],D=A[1],$=d([]),P=$[0],V=$[1],H=d(!1),R=H[0],q=H[1],F=d(!1),J=F[0],K=F[1],O=d(!1),U=O[0],Y=O[1],G=d(null),Q=G[0],X=G[1],Z=d(null),ee=Z[0],ne=Z[1],te=d(new Set),re=te[0],ae=te[1],ie=d(new Set),oe=ie[0],ce=ie[1],se=l({handleStream:x,onSave:N,selectedTiers:P,tiersSubmitted:J,citations:L,openCardIds:re,openCitationIds:oe,chatSize:M,isLastMessage:B,scrollToBottom:I,isStreamEnd:j,selectedVariant:ee,messageIsEnd:_,isCommitted:U,clickedAction:Q});se.current={handleStream:x,onSave:N,selectedTiers:P,tiersSubmitted:J,citations:L,openCardIds:re,openCitationIds:oe,chatSize:M,isLastMessage:B,scrollToBottom:I,isStreamEnd:j,selectedVariant:ee,messageIsEnd:_,isCommitted:U,clickedAction:Q},u(function(){ne(null),Y(!1),X(null)},[C]),u(function(){if(_&&!U&&!ee){var e=W.match(/<variant-card[^>]*isselected=["']true["'][^>]*>/i);if(e){var n=e[0].match(/id=["']([^"']+)["']/),t=e[0].match(/variantname=["']([^"']+)["']/),r=e[0].match(/decisionstrength=["']([^"']+)["']/);n&&t&&ne({id:n[1],variantName:t[1],decisionStrength:parseInt((null==r?void 0:r[1])||"0")})}}},[W,_,U,ee]);var de=m(function(e,n,t){var r=function(t){var r=new Set(t);return n?r.add(e):r.delete(e),r};"card"===t?ae(function(e){return r(e)}):ce(function(e){return r(e)})},[]),le=m(function(e,n,t){void 0===n&&(n=!1);var r=se.current,a=r.handleStream,i=r.onSave,o=e.trim();"save this learning"===o.toLowerCase()&&i?i():a&&(a(new KeyboardEvent("keydown",{key:"Enter"}),!1,o),n&&t&&(Y(!0),X(t))),n||D(function(e){return e.replace(/<button([^>]*)class=["']clickable-button["']([^>]*)>([\s\S]*?)<\/button>/gi,function(e,n,t,r){var a=r.trim(),i='data-selected="'.concat(a===o,'"');return"<button".concat(n,'class="clickable-button" ').concat(i).concat(t,">").concat(r,"</button>")})})},[]),ue=m(function(e,n){var t=se.current.citations;return t&&t.find(function(t){return t.customMetaData.citation_number&&"Cognitive Decisioning"!==t.customMetaData.citation_title&&t.customMetaData.source===n&&String(t.customMetaData.citation_number)===String(e)})||null},[]),me=m(function(n,t){var r=se.current.scrollToBottom,a=Array.isArray(n)?n[0].trim():n.trim();q(!0),V(function(n){var r=e([],n,!0);if(["both tiers","all tiers"].includes(a.toLowerCase()))r=t?["Both Tiers","Tier 1","Tier 2"]:[];else{t?r.includes(a)||r.push(a):r=r.filter(function(e){return e!==a});var i=r.includes("Tier 1"),o=r.includes("Tier 2");i&&o?r.includes("Both Tiers")||r.push("Both Tiers"):r=r.filter(function(e){return!["Both Tiers","All tiers"].includes(e)})}return r.filter(function(e,n){return r.indexOf(e)===n})}),null==r||r()},[]),fe=m(function(e,n,t,r){se.current.isCommitted||n&&ne({id:e,variantName:t,decisionStrength:r})},[]),ve=function(){if(!se.current.isCommitted){var e="Edit ".concat((null==ee?void 0:ee.variantName)||"Selected Behavior");le(e,!0,"edit")}},ge=m(function(){var e=se.current,n=e.handleStream,t=e.selectedTiers,r=t.join(" and ");t.some(function(e){return"both tiers"===e.toLowerCase()||"all tiers"===e.toLowerCase()})&&(r="Both Tiers"),n(new KeyboardEvent("keydown",{key:"Enter"}),!1,"".concat(r)),K(!0),q(!1),D(function(e){return e.replace(/<checkbox\s+class=["']clickable-box["'][^>]*>([\s\S]*?)<\/checkbox>/gi,function(e,n){var r=n.trim();return t.includes(r)?e:""})})},[]),he=f(function(){return{p:function(e){e.node;var a=n(e,["node"]);return r("span",t({},a,{style:{maxWidth:"100%",wordWrap:"break-word",overflowWrap:"break-word",wordBreak:"break-word",whiteSpace:"normal",overflow:"hidden",display:"block",fontSize:"1rem",lineHeight:"1.625rem",marginBottom:"user"===T?"0":"1rem"}},{children:null==a?void 0:a.children}))},code:function(e){e.node;var a=n(e,["node"]);return r("span",t({},a,{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==a?void 0:a.children}))},ol:function(e){e.node;var a=n(e,["node"]);return r("ol",t({},a,{style:{display:"flex",flexDirection:"column",gap:"1rem",listStyle:"decimal",paddingLeft:"2.5rem"}},{children:null==a?void 0:a.children}))},ul:function(e){e.node;var a=n(e,["node"]);return r("ul",t({},a,{style:{display:"flex",flexDirection:"column",gap:"1rem",listStyle:"decimal",paddingLeft:"2.5rem"}},{children:null==a?void 0:a.children}))},rule:function(e){e.node;var t=n(e,["node"]);return r(v,{content:w(t.children)})},button:function(e){var a=e.node,i=e.className,o=n(e,["node","className"]),c=se.current,s=c.isLastMessage,d=c.handleStream,l=c.isStreamEnd;return r(g,t({node:a,className:i||o.class,handleStream:d,onAction:le,disabled:!s,isStreamEnd:l},o))},checkbox:function(e){var a=e.node,i=e.className,o=n(e,["node","className"]),c=se.current,s=c.selectedTiers,d=c.tiersSubmitted,l=c.isLastMessage;return r(h,t({node:a,className:i||o.class,selectedItems:s,onToggle:me,isSubmitted:d,disabled:!l},o))},a:function(e){var n=se.current,a=n.chatSize,i=n.openCitationIds;return r(p,t({},e,{chatSize:a,openCitationIds:i,getCitationByNumber:ue,handleToggleState:de,isStreamEnd:se.current.isStreamEnd}))},div:function(e){var n=se.current,a=n.openCardIds,i=n.citations,o=n.isLastMessage,c=n.isStreamEnd,s=!o||c;return"rule-validation-card-trigger"===e.className?r(S,t({},e)):r(S,t({},e,{openCardIds:a,citations:i,handleToggleState:de,isStreamEnd:s}))},span:function(e){var n;if(null===(n=e.className)||void 0===n?void 0:n.includes("cognitive-card-trigger")){var a=se.current,i=a.openCardIds,o=a.citations,c=a.isLastMessage,s=a.isStreamEnd;return r(b,t({},e,{openCardIds:i,citations:o,handleToggleState:de,isStreamEnd:!c||s}))}return r("span",t({},e))},"variant-card":function(e){e.node;var a=n(e,["node"]),i=a.variantname,o=a.decisionstrength,c=a.id,s=se.current,d=s.isCommitted,l=s.isLastMessage,u=s.selectedVariant;if(!_)return null;var m=(null==u?void 0:u.id)===c,f=parseInt(o||"0");return r(k,t({variantName:i,decisionStrength:f,isEditable:!d&&l,isSelected:m,onToggle:function(e){return fe(c,e,i,f)},onEdit:function(){return ve()}},{children:a.children}))},br:function(e){return r("p",t({style:{marginBottom:"0.75rem"}},e))}}},[le,me,ue,de,T,ee,U,_]);u(function(){J||(D(E),setTimeout(function(){null==I||I()},50))},[E,J,I]);var pe=l(0);u(function(){var e=re.size+oe.size;e>0&&0===pe.current?null==z||z(50):0===e&&pe.current>0&&(null==z||z(40)),pe.current=e},[re,oe,z]);var Se=f(function(){return[c]},[]),be=f(function(){return[s]},[]),we=(null==ee?void 0:ee.variantName)||"Selected Behavior";return a(i,{children:[a("div",t({style:{lineHeight:"1.625rem",fontSize:"1rem",marginTop:"0.5rem",marginBottom:"".concat("assistant"===T?"1rem":"0rem"),fontFamily:"Plus Jakarta Sans, sans-serif"}},{children:[r(o,t({components:he,rehypePlugins:Se,remarkPlugins:be},{children:function(e){if(!e)return"";var n=e.replace(/\\"/g,'"').replace(/\\'/g,"'");n=(n=(n=(n=(n=n.replace(/```(?:\w+)?\n?([\s\S]*?)```/gi,"$1")).replace(/<br\s*\/?>/gi,"\n\n")).replace(/<variant-card\s+([\s\S]*?)>([\s\S]*?)<\/variant-card>/gi,function(e,n,t){for(var r,a={},i=/([a-z0-9-]+)\s*=\s*(["'])([\s\S]*?)\2(?=\s|>|$)/gi;null!==(r=i.exec(n));)a[r[1]]=r[3];return'\n\n<variant-card id="'.concat(a.id||"",'" variantname="').concat(a.variantname||"",'" decisionstrength="').concat(a.decisionstrength||"0",'" iseditable="').concat(a.iseditable||"false",'" isselected="').concat(a.isselected||"false",'">').concat(t,"</variant-card>\n\n")})).replace(/<rule-validation-card\s+([\s\S]*?)>([\s\S]*?)<\/rule-validation-card>/gi,function(e,n){for(var t,r={},a=/([a-z0-9-]+)\s*=\s*(["'])([\s\S]*?)\2(?=\s|>|$)/gi;null!==(t=a.exec(n));)r[t[1]]=t[3];var i=function(e){return(r[e]||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")};return'\n\n<div class="rule-validation-card-trigger" \n data-type="'.concat(i("validationType"),'"\n data-decision-strength="').concat(i("decisionStrength"),'"\n data-title="').concat(i("ruleTitle"),'"\n data-description="').concat(i("ruleDescription"),'"\n data-scope="').concat(i("scope"),'"\n data-wta="').concat(i("wta"),'"\n data-wnta="').concat(i("wnta"),'"\n data-whyissue="').concat(i("whyIssue"),'"></div>\n\n')})).replace(/<!--<ai_reasoning>(?![\s\S]*?<\/ai_reasoning>-->)[\s\S]*$/gi,"");["ai_reasoning"].forEach(function(e){var t=new RegExp("\x3c!--\\s*(<".concat(e,">[\\s\\S]*?<\\/").concat(e,">)\\s*--\x3e"),"gi");n=n.replace(t,"$1")});var t=0;n=n.replace(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/gi,function(e,n){var r=n.replace(/\[([^\]]+)\]\(([^)]+)\)/g,function(e,n,t){return'<a href="'.concat(t,'" data-shielded="true">').concat(n,"</a>")});return r=r.replace(/</g,"<").replace(/>/g,">"),t++,'<span class="cognitive-card-trigger" data-card-id="card-'.concat(t,'">').concat(r,"</span>")});var r=0;return n.replace(/(\[[^\]]+\]\()([^)]+)(\))/g,function(e,n,t,a){var i=t.replace(/\s/g,"%20");if(i.includes("citationNumber=")){r++;var o=i.includes("?")?"&":"?";return"".concat(n).concat(i).concat(o,"uiUniqueId=").concat(r).concat(a)}return"".concat(n).concat(i).concat(a)})}(W)}),C),_&&W.includes("<variant-card")&&a("div",t({style:{gap:"8px"}},{children:[a(g,t({className:"clickable-button",handleStream:x,disabled:!B||!ee&&!U||U&&"add"!==Q,isStreamEnd:j,onAction:function(){return le("Add ".concat(we),!0,"add")},"data-selected":"add"===Q?"true":U?"false":void 0},{children:["Add ",we]})),a(g,t({className:"clickable-button",handleStream:x,disabled:!B||!ee&&!U||U&&"edit"!==Q,isStreamEnd:j,onAction:function(){return le("Edit ".concat(we),!0,"edit")},"data-selected":"edit"===Q?"true":U?"false":void 0},{children:["Edit ",we]})),r(g,t({className:"clickable-button",handleStream:x,disabled:!B||U&&"skip"!==Q,isStreamEnd:j,onAction:function(){return le("Skip for now",!0,"skip")},"data-selected":"skip"===Q?"true":U?"false":void 0},{children:"Skip for now"}))]}))]})),r("div",t({style:{display:"flex",maxWidth:"100%"}},{children:r("div",t({style:{width:"100%"}},{children:(null==P?void 0:P.length)>0&&R&&!J?a("div",t({style:{marginTop:"10px"}},{children:[a("span",{children:["It looks like you've chosen ",P&&0!==P.length?P.some(function(e){return"both tiers"===e.toLowerCase()||"all tiers"===e.toLowerCase()})?"Both Tiers":P.join(", "):"",". Would you like me to proceed?"]}),r("p",{children:r("button",t({style:{padding:"0.5rem 1rem",margin:"0.5rem 0",backgroundColor:"#2661eb",color:"white",border:"none",borderRadius:"8px",cursor:"pointer",fontSize:"0.75rem",fontWeight:"500",fontFamily:"Plus Jakarta Sans, sans-serif"},onClick:ge},{children:"Yes"}))})]})):null}))}))]})};export{y as default};
|
|
1
|
+
import{__spreadArray as e,__rest as n,__assign as t}from"../../../../node_modules/tslib/tslib.es6.mjs.js";import{jsx as r,jsxs as a,Fragment as i}from"react/jsx-runtime";import{ReactMarkdown as o}from"../../../../node_modules/react-markdown/lib/react-markdown.js";import c from"../../../../node_modules/rehype-raw/lib/index.js";import s from"../../../../node_modules/remark-gfm/index.js";import{useState as l,useRef as d,useEffect as u,useCallback as m,useMemo as f}from"react";import{RuleDisplay as v,ActionableButton as g,ActionableCheckbox as p}from"./ClickableChatComponents.js";import{MarkdownLinkRenderer as h,MarkdownDivRenderer as S,MarkdownSpanRenderer as b}from"../MarkdownComponents/MarkdownElements.js";import{extractTextFromChildren as w}from"../../helpers/utils.js";import{RuleVariantCard as k}from"./RuleVariantCard.js";var y=function(y){var C=y.index,E=y.content,x=y.role;y.messages;var T=y.handleStream,I=y.scrollToBottom,B=y.isLastMessage,N=y.onSave,L=y.citations,z=y.setChatSize,M=y.chatSize,j=y.isStreamEnd,_=y.messageIsEnd,A=l(E),W=A[0],D=A[1],$=l([]),P=$[0],V=$[1],H=l(!1),R=H[0],q=H[1],F=l(!1),J=F[0],K=F[1],O=l(!1),U=O[0],Y=O[1],G=l(null),Q=G[0],X=G[1],Z=l(null),ee=Z[0],ne=Z[1],te=l(new Set),re=te[0],ae=te[1],ie=l(new Set),oe=ie[0],ce=ie[1],se=d({handleStream:T,onSave:N,selectedTiers:P,tiersSubmitted:J,citations:L,openCardIds:re,openCitationIds:oe,chatSize:M,isLastMessage:B,scrollToBottom:I,isStreamEnd:j,selectedVariant:ee,messageIsEnd:_,isCommitted:U,clickedAction:Q});se.current={handleStream:T,onSave:N,selectedTiers:P,tiersSubmitted:J,citations:L,openCardIds:re,openCitationIds:oe,chatSize:M,isLastMessage:B,scrollToBottom:I,isStreamEnd:j,selectedVariant:ee,messageIsEnd:_,isCommitted:U,clickedAction:Q},u(function(){ne(null),Y(!1),X(null)},[C]),u(function(){if(_&&!U&&!ee){var e=W.match(/<variant-card[^>]*isselected=["']true["'][^>]*>/i);if(e){var n=e[0].match(/id=["']([^"']+)["']/),t=e[0].match(/variantname=["']([^"']+)["']/),r=e[0].match(/decisionstrength=["']([^"']+)["']/);n&&t&&ne({id:n[1],variantName:t[1],decisionStrength:parseInt((null==r?void 0:r[1])||"0")})}}},[W,_,U,ee]);var le=m(function(e,n,t){var r=function(t){var r=new Set(t);return n?r.add(e):r.delete(e),r};"card"===t?ae(function(e){return r(e)}):ce(function(e){return r(e)})},[]),de=m(function(e,n,t){void 0===n&&(n=!1);var r=se.current,a=r.handleStream,i=r.onSave,o=e.trim();"save this learning"===o.toLowerCase()&&i?i():a&&(a(new KeyboardEvent("keydown",{key:"Enter"}),!1,o),n&&t&&(Y(!0),X(t))),n||D(function(e){return e.replace(/<button([^>]*)class=["']clickable-button["']([^>]*)>([\s\S]*?)<\/button>/gi,function(e,n,t,r){var a=r.trim(),i='data-selected="'.concat(a===o,'"');return"<button".concat(n,'class="clickable-button" ').concat(i).concat(t,">").concat(r,"</button>")})})},[]),ue=m(function(e,n){var t=se.current.citations;return t&&t.find(function(t){return t.customMetaData.citation_number&&"Cognitive Decisioning"!==t.customMetaData.citation_title&&t.customMetaData.source===n&&String(t.customMetaData.citation_number)===String(e)})||null},[]),me=m(function(n,t){var r=se.current.scrollToBottom,a=Array.isArray(n)?n[0].trim():n.trim();q(!0),V(function(n){var r=e([],n,!0);if(["both tiers","all tiers"].includes(a.toLowerCase()))r=t?["Both Tiers","Tier 1","Tier 2"]:[];else{t?r.includes(a)||r.push(a):r=r.filter(function(e){return e!==a});var i=r.includes("Tier 1"),o=r.includes("Tier 2");i&&o?r.includes("Both Tiers")||r.push("Both Tiers"):r=r.filter(function(e){return!["Both Tiers","All tiers"].includes(e)})}return r.filter(function(e,n){return r.indexOf(e)===n})}),null==r||r()},[]),fe=m(function(e,n,t,r){se.current.isCommitted||n&&ne({id:e,variantName:t,decisionStrength:r})},[]),ve=function(){if(!se.current.isCommitted){var e="Edit ".concat((null==ee?void 0:ee.variantName)||"Selected Behavior");de(e,!0,"edit")}},ge=m(function(){var e=se.current,n=e.handleStream,t=e.selectedTiers,r=t.join(" and ");t.some(function(e){return"both tiers"===e.toLowerCase()||"all tiers"===e.toLowerCase()})&&(r="Both Tiers"),n(new KeyboardEvent("keydown",{key:"Enter"}),!1,"".concat(r)),K(!0),q(!1),D(function(e){return e.replace(/<checkbox\s+class=["']clickable-box["'][^>]*>([\s\S]*?)<\/checkbox>/gi,function(e,n){var r=n.trim();return t.includes(r)?e:""})})},[]),pe=f(function(){return{p:function(e){e.node;var a=n(e,["node"]);return r("span",t({},a,{style:{maxWidth:"100%",wordWrap:"break-word",overflowWrap:"break-word",wordBreak:"break-word",whiteSpace:"normal",overflow:"hidden",display:"block",fontSize:"1rem",lineHeight:"1.625rem",marginBottom:"user"===x?"0":"1rem"}},{children:null==a?void 0:a.children}))},code:function(e){e.node;var a=n(e,["node"]);return r("span",t({},a,{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==a?void 0:a.children}))},ol:function(e){e.node;var a=n(e,["node"]);return r("ol",t({},a,{style:{display:"flex",flexDirection:"column",gap:"1rem",listStyle:"decimal",paddingLeft:"2.5rem"}},{children:null==a?void 0:a.children}))},ul:function(e){e.node;var a=n(e,["node"]);return r("ul",t({},a,{style:{display:"flex",flexDirection:"column",gap:"1rem",listStyle:"decimal",paddingLeft:"2.5rem"}},{children:null==a?void 0:a.children}))},rule:function(e){e.node;var t=n(e,["node"]);return r(v,{content:w(t.children)})},button:function(e){var a=e.node,i=e.className,o=n(e,["node","className"]),c=se.current,s=c.isLastMessage,l=c.handleStream,d=c.isStreamEnd;return r(g,t({node:a,className:i||o.class,handleStream:l,onAction:de,disabled:!s,isStreamEnd:d},o))},checkbox:function(e){var a=e.node,i=e.className,o=n(e,["node","className"]),c=se.current,s=c.selectedTiers,l=c.tiersSubmitted,d=c.isLastMessage;return r(p,t({node:a,className:i||o.class,selectedItems:s,onToggle:me,isSubmitted:l,disabled:!d},o))},a:function(e){var n=se.current,a=n.chatSize,i=n.openCitationIds;return r(h,t({},e,{chatSize:a,openCitationIds:i,getCitationByNumber:ue,handleToggleState:le,isStreamEnd:se.current.isStreamEnd}))},div:function(e){var n=se.current,a=n.openCardIds,i=n.citations,o=n.isLastMessage,c=n.isStreamEnd;return"rule-validation-card-trigger"===e.className?r(S,t({},e)):r(S,t({},e,{openCardIds:a,citations:i,handleToggleState:le,isStreamEnd:c,isLastMessage:o,handleStream:T}))},span:function(e){var n;if(null===(n=e.className)||void 0===n?void 0:n.includes("cognitive-card-trigger")){var a=se.current,i=a.openCardIds,o=a.citations,c=a.isLastMessage,s=a.isStreamEnd;return r(b,t({},e,{openCardIds:i,citations:o,handleToggleState:le,isStreamEnd:!c||s}))}return r("span",t({},e))},"variant-card":function(e){e.node;var a=n(e,["node"]),i=a.variantname,o=a.decisionstrength,c=a.id,s=se.current,l=s.isCommitted,d=s.isLastMessage,u=s.selectedVariant;if(!_)return null;var m=(null==u?void 0:u.id)===c,f=parseInt(o||"0");return r(k,t({variantName:i,decisionStrength:f,isEditable:!l&&d,isSelected:m,onToggle:function(e){return fe(c,e,i,f)},onEdit:function(){return ve()}},{children:a.children}))},br:function(e){return r("p",t({style:{marginBottom:"0.75rem"}},e))}}},[de,me,ue,le,x,ee,U,_]);u(function(){J||(D(E),setTimeout(function(){null==I||I()},50))},[E,J,I]);var he=d(0);u(function(){var e=re.size+oe.size;e>0&&0===he.current?null==z||z(50):0===e&&he.current>0&&(null==z||z(40)),he.current=e},[re,oe,z]);var Se=f(function(){return[c]},[]),be=f(function(){return[s]},[]),we=(null==ee?void 0:ee.variantName)||"Selected Behavior";return a(i,{children:[a("div",t({style:{lineHeight:"1.625rem",fontSize:"1rem",marginTop:"0.5rem",marginBottom:"".concat("assistant"===x?"1rem":"0rem"),fontFamily:"Plus Jakarta Sans, sans-serif"}},{children:[r(o,t({components:pe,rehypePlugins:Se,remarkPlugins:be},{children:function(e){if(!e)return"";var n=e.replace(/\\"/g,'"').replace(/\\'/g,"'");n=(n=(n=(n=(n=(n=(n=n.replace(/```(?:\w+)?\n?([\s\S]*?)```/gi,"$1")).replace(/<br\s*\/?>/gi,"\n\n")).replace(/<variant-card\s+([\s\S]*?)>([\s\S]*?)<\/variant-card>/gi,function(e,n,t){for(var r,a={},i=/([a-z0-9-]+)\s*=\s*(["'])([\s\S]*?)\2(?=\s|>|$)/gi;null!==(r=i.exec(n));)a[r[1]]=r[3];return'\n\n<variant-card id="'.concat(a.id||"",'" variantname="').concat(a.variantname||"",'" decisionstrength="').concat(a.decisionstrength||"0",'" iseditable="').concat(a.iseditable||"false",'" isselected="').concat(a.isselected||"false",'">').concat(t,"</variant-card>\n\n")})).replace(/<rule-validation-card\s+([\s\S]*?)>([\s\S]*?)<\/rule-validation-card>/gi,function(e,n){for(var t,r={},a=/([a-z0-9-]+)\s*=\s*(["'])([\s\S]*?)\2(?=\s|>|$)/gi;null!==(t=a.exec(n));)r[t[1]]=t[3];var i=function(e){return(r[e]||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")};return'\n\n<div class="rule-validation-card-trigger" \n data-type="'.concat(i("validationType"),'"\n data-decision-strength="').concat(i("decisionStrength"),'"\n data-title="').concat(i("ruleTitle"),'"\n data-description="').concat(i("ruleDescription"),'"\n data-scope="').concat(i("scope"),'"\n data-wta="').concat(i("wta"),'"\n data-wnta="').concat(i("wnta"),'"\n data-whyissue="').concat(i("whyIssue"),'"></div>\n\n')})).replace(/<(singleselect|multiselect|instantselect)>([\s\S]*?)<\/\1>/gi,function(e,n,t){var r="multi";return"singleselect"===n?r="single":"instantselect"===n&&(r="instant"),'\n\n<div class="markdown-select-trigger" data-type="'.concat(r,'">').concat(t,"</div>\n\n")})).replace(/<selectoption\s+([\s\S]*?)>([\s\S]*?)<\/selectoption>/gi,function(e,n,t){for(var r,a={},i=/([a-z0-9-]+)\s*=\s*(["'])([\s\S]*?)\2/gi;null!==(r=i.exec(n));)a[r[1]]=r[3];return'<div class="select-option-item" data-id="'.concat(a.id||"",'" data-cd="').concat(a.cd||"false",'">').concat(t,"</div>")})).replace(/<!--<ai_reasoning>(?![\s\S]*?<\/ai_reasoning>-->)[\s\S]*$/gi,"");["ai_reasoning"].forEach(function(e){var t=new RegExp("\x3c!--\\s*(<".concat(e,">[\\s\\S]*?<\\/").concat(e,">)\\s*--\x3e"),"gi");n=n.replace(t,"$1")});var t=0;n=n.replace(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/gi,function(e,n){var r=n.replace(/\[([^\]]+)\]\(([^)]+)\)/g,function(e,n,t){return'<a href="'.concat(t,'" data-shielded="true">').concat(n,"</a>")});return r=r.replace(/</g,"<").replace(/>/g,">"),t++,'<span class="cognitive-card-trigger" data-card-id="card-'.concat(t,'">').concat(r,"</span>")});var r=0;return n.replace(/(\[[^\]]+\]\()([^)]+)(\))/g,function(e,n,t,a){var i=t.replace(/\s/g,"%20");if(i.includes("citationNumber=")){r++;var o=i.includes("?")?"&":"?";return"".concat(n).concat(i).concat(o,"uiUniqueId=").concat(r).concat(a)}return"".concat(n).concat(i).concat(a)})}(W)}),C),_&&W.includes("<variant-card")&&a("div",t({style:{gap:"8px"}},{children:[a(g,t({className:"clickable-button",handleStream:T,disabled:!B||!ee&&!U||U&&"add"!==Q,isStreamEnd:j,onAction:function(){return de("Add ".concat(we),!0,"add")},"data-selected":"add"===Q?"true":U?"false":void 0},{children:["Add ",we]})),a(g,t({className:"clickable-button",handleStream:T,disabled:!B||!ee&&!U||U&&"edit"!==Q,isStreamEnd:j,onAction:function(){return de("Edit ".concat(we),!0,"edit")},"data-selected":"edit"===Q?"true":U?"false":void 0},{children:["Edit ",we]})),r(g,t({className:"clickable-button",handleStream:T,disabled:!B||U&&"skip"!==Q,isStreamEnd:j,onAction:function(){return de("Skip for now",!0,"skip")},"data-selected":"skip"===Q?"true":U?"false":void 0},{children:"Skip for now"}))]}))]})),r("div",t({style:{display:"flex",maxWidth:"100%"}},{children:r("div",t({style:{width:"100%"}},{children:(null==P?void 0:P.length)>0&&R&&!J?a("div",t({style:{marginTop:"10px"}},{children:[a("span",{children:["It looks like you've chosen ",P&&0!==P.length?P.some(function(e){return"both tiers"===e.toLowerCase()||"all tiers"===e.toLowerCase()})?"Both Tiers":P.join(", "):"",". Would you like me to proceed?"]}),r("p",{children:r("button",t({style:{padding:"0.5rem 1rem",margin:"0.5rem 0",backgroundColor:"#2661eb",color:"white",border:"none",borderRadius:"8px",cursor:"pointer",fontSize:"0.75rem",fontWeight:"500",fontFamily:"Plus Jakarta Sans, sans-serif"},onClick:ge},{children:"Yes"}))})]})):null}))}))]})};export{y as default};
|
|
2
2
|
//# sourceMappingURL=MessageRendering.js.map
|