@iblai/iblai-js 1.13.2 → 1.14.0
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/data-layer/web-utils/auth.d.ts +1 -0
- package/dist/playwright/web-utils/auth.d.ts +1 -0
- package/dist/web-containers/source/next/index.esm.js +142 -392
- package/dist/web-containers/web-utils/auth.d.ts +1 -0
- package/dist/web-utils/auth.d.ts +1 -0
- package/dist/web-utils/auth.esm.js +2 -0
- package/dist/web-utils/auth.esm.js.map +1 -0
- package/dist/web-utils/auth.js +13 -0
- package/dist/web-utils/auth.js.map +1 -0
- package/dist/web-utils/web-utils/auth.d.ts +1 -0
- package/package.json +8 -3
|
@@ -206089,6 +206089,10 @@ const AGENT_SETTINGS_TAB_LABELS = {
|
|
|
206089
206089
|
label: 'Allow Copies',
|
|
206090
206090
|
tooltip: 'Allow other admins to create a copy of this agent.',
|
|
206091
206091
|
},
|
|
206092
|
+
showReasoning: {
|
|
206093
|
+
label: 'Verbose Reasoning',
|
|
206094
|
+
tooltip: 'Show the agent’s reasoning steps while it responds.',
|
|
206095
|
+
},
|
|
206092
206096
|
image: {
|
|
206093
206097
|
label: 'Image',
|
|
206094
206098
|
altText: 'Agent',
|
|
@@ -206147,7 +206151,7 @@ function resolveSettingsTabLabels(override) {
|
|
|
206147
206151
|
}
|
|
206148
206152
|
|
|
206149
206153
|
function useEditMentorSettings({ onSuccessfulSave, labels }) {
|
|
206150
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
206154
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
206151
206155
|
const { tenantKey, mentorId, username, executeGatedAction } = useAgentSettings();
|
|
206152
206156
|
const { data: categories, isLoading: isLoadingCategories } = useGetMentorCategoriesQuery(
|
|
206153
206157
|
// @ts-expect-error userId is not part of the query type definition
|
|
@@ -206177,6 +206181,8 @@ function useEditMentorSettings({ onSuccessfulSave, labels }) {
|
|
|
206177
206181
|
// @ts-expect-error - is_lti_accessible exists in API response but not in type
|
|
206178
206182
|
is_lti_accessible: (_g = mentor === null || mentor === void 0 ? void 0 : mentor.is_lti_accessible) !== null && _g !== void 0 ? _g : false,
|
|
206179
206183
|
forkable: (_h = mentor === null || mentor === void 0 ? void 0 : mentor.forkable) !== null && _h !== void 0 ? _h : false,
|
|
206184
|
+
// @ts-expect-error - show_reasoning exists in API response but not in type
|
|
206185
|
+
show_reasoning: (_j = mentor === null || mentor === void 0 ? void 0 : mentor.show_reasoning) !== null && _j !== void 0 ? _j : false,
|
|
206180
206186
|
},
|
|
206181
206187
|
onSubmit: async ({ value }) => {
|
|
206182
206188
|
const values = {};
|
|
@@ -206216,6 +206222,9 @@ function useEditMentorSettings({ onSuccessfulSave, labels }) {
|
|
|
206216
206222
|
if (value.forkable !== undefined) {
|
|
206217
206223
|
values.forkable = value.forkable;
|
|
206218
206224
|
}
|
|
206225
|
+
if (value.show_reasoning !== undefined) {
|
|
206226
|
+
values.show_reasoning = value.show_reasoning;
|
|
206227
|
+
}
|
|
206219
206228
|
try {
|
|
206220
206229
|
const savedMentor = await editMentor({
|
|
206221
206230
|
mentor: mentorId,
|
|
@@ -206339,7 +206348,7 @@ function AgentSettingsTab({ onSuccessfulSave, onSuccessfulDelete, tenants, isLoa
|
|
|
206339
206348
|
// @ts-expect-error permissions field type is opaque
|
|
206340
206349
|
permissions: (_j = mentor === null || mentor === void 0 ? void 0 : mentor.permissions) === null || _j === void 0 ? void 0 : _j.field, enableRBAC: enableRBAC, children: ({ disabled }) => (jsx(form.Field, { name: "show_voice_call", children: (field) => (jsxs("div", { className: "flex items-center justify-between", children: [jsxs("div", { className: "flex items-center gap-2", children: [jsx("span", { className: "text-sm font-medium text-[#646464]", children: labels.fields.showVoiceCall.label }), jsx(TooltipProvider, { children: jsxs(Tooltip, { children: [jsx(TooltipTrigger, { type: "button", "aria-label": "More info about show voice call", children: jsx(Info$3, { className: "h-4 w-4 text-gray-400" }) }), jsx(TooltipContent, { className: "ibl-tooltip-content", children: jsx("p", { children: labels.fields.showVoiceCall.tooltip }) })] }) })] }), jsx(CustomSwitch, { checked: field.state.value, onCheckedChange: (checked) => field.handleChange(checked), disabled: isDisabled || disabled, "aria-label": `Show voice call ${field.state.value ? 'enabled' : 'disabled'}` })] })) })) }), jsx(WithFormPermissions, { name: "show_voice_record",
|
|
206341
206350
|
// @ts-expect-error permissions field type is opaque
|
|
206342
|
-
permissions: (_k = mentor === null || mentor === void 0 ? void 0 : mentor.permissions) === null || _k === void 0 ? void 0 : _k.field, enableRBAC: enableRBAC, children: ({ disabled }) => (jsx(form.Field, { name: "show_voice_record", children: (field) => (jsxs("div", { className: "flex items-center justify-between", children: [jsxs("div", { className: "flex items-center gap-2", children: [jsx("span", { className: "text-sm font-medium text-[#646464]", children: labels.fields.showVoiceRecord.label }), jsx(TooltipProvider, { children: jsxs(Tooltip, { children: [jsx(TooltipTrigger, { type: "button", "aria-label": "More info about show voice record", children: jsx(Info$3, { className: "h-4 w-4 text-gray-400" }) }), jsx(TooltipContent, { className: "ibl-tooltip-content", children: jsx("p", { children: labels.fields.showVoiceRecord.tooltip }) })] }) })] }), jsx(CustomSwitch, { checked: field.state.value, onCheckedChange: (checked) => field.handleChange(checked), disabled: isDisabled || disabled, "aria-label": `Show voice record ${field.state.value ? 'enabled' : 'disabled'}` })] })) })) }), jsx(form.Field, { name: "forkable", children: (field) => (jsxs("div", { className: "flex items-center justify-between", children: [jsxs("div", { className: "flex items-center gap-2", children: [jsx("span", { className: "text-sm font-medium text-[#646464]", children: labels.fields.allowCopies.label }), jsx(TooltipProvider, { children: jsxs(Tooltip, { children: [jsx(TooltipTrigger, { type: "button", "aria-label": "More info about allow copies", children: jsx(Info$3, { className: "h-4 w-4 text-gray-400" }) }), jsx(TooltipContent, { className: "ibl-tooltip-content", children: jsx("p", { children: labels.fields.allowCopies.tooltip }) })] }) })] }), jsx(CustomSwitch, { checked: field.state.value, onCheckedChange: (checked) => field.handleChange(checked), disabled: isDisabled, "aria-label": `Allow copies ${field.state.value ? 'enabled' : 'disabled'}` })] })) })] }), jsx(WithFormPermissions, { name: "profile_image",
|
|
206351
|
+
permissions: (_k = mentor === null || mentor === void 0 ? void 0 : mentor.permissions) === null || _k === void 0 ? void 0 : _k.field, enableRBAC: enableRBAC, children: ({ disabled }) => (jsx(form.Field, { name: "show_voice_record", children: (field) => (jsxs("div", { className: "flex items-center justify-between", children: [jsxs("div", { className: "flex items-center gap-2", children: [jsx("span", { className: "text-sm font-medium text-[#646464]", children: labels.fields.showVoiceRecord.label }), jsx(TooltipProvider, { children: jsxs(Tooltip, { children: [jsx(TooltipTrigger, { type: "button", "aria-label": "More info about show voice record", children: jsx(Info$3, { className: "h-4 w-4 text-gray-400" }) }), jsx(TooltipContent, { className: "ibl-tooltip-content", children: jsx("p", { children: labels.fields.showVoiceRecord.tooltip }) })] }) })] }), jsx(CustomSwitch, { checked: field.state.value, onCheckedChange: (checked) => field.handleChange(checked), disabled: isDisabled || disabled, "aria-label": `Show voice record ${field.state.value ? 'enabled' : 'disabled'}` })] })) })) }), jsx(form.Field, { name: "forkable", children: (field) => (jsxs("div", { className: "flex items-center justify-between", children: [jsxs("div", { className: "flex items-center gap-2", children: [jsx("span", { className: "text-sm font-medium text-[#646464]", children: labels.fields.allowCopies.label }), jsx(TooltipProvider, { children: jsxs(Tooltip, { children: [jsx(TooltipTrigger, { type: "button", "aria-label": "More info about allow copies", children: jsx(Info$3, { className: "h-4 w-4 text-gray-400" }) }), jsx(TooltipContent, { className: "ibl-tooltip-content", children: jsx("p", { children: labels.fields.allowCopies.tooltip }) })] }) })] }), jsx(CustomSwitch, { checked: field.state.value, onCheckedChange: (checked) => field.handleChange(checked), disabled: isDisabled, "aria-label": `Allow copies ${field.state.value ? 'enabled' : 'disabled'}` })] })) }), jsx(form.Field, { name: "show_reasoning", children: (field) => (jsxs("div", { className: "flex items-center justify-between", children: [jsxs("div", { className: "flex items-center gap-2", children: [jsx("span", { className: "text-sm font-medium text-[#646464]", children: labels.fields.showReasoning.label }), jsx(TooltipProvider, { children: jsxs(Tooltip, { children: [jsx(TooltipTrigger, { type: "button", "aria-label": "More info about verbose reasoning", children: jsx(Info$3, { className: "h-4 w-4 text-gray-400" }) }), jsx(TooltipContent, { className: "ibl-tooltip-content", children: jsx("p", { children: labels.fields.showReasoning.tooltip }) })] }) })] }), jsx(CustomSwitch, { checked: field.state.value, onCheckedChange: (checked) => field.handleChange(checked), disabled: isDisabled, "aria-label": `Verbose reasoning ${field.state.value ? 'enabled' : 'disabled'}` })] })) })] }), jsx(WithFormPermissions, { name: "profile_image",
|
|
206343
206352
|
// @ts-expect-error permissions field type is opaque
|
|
206344
206353
|
permissions: (_l = mentor === null || mentor === void 0 ? void 0 : mentor.permissions) === null || _l === void 0 ? void 0 : _l.field, enableRBAC: enableRBAC, children: ({ disabled }) => (jsx(form.Field, { name: "profile_image", children: (field) => (jsxs("div", { className: "order-1 mb-6 space-y-2 sm:order-2 sm:mb-0", children: [jsx(Label, { className: "text-sm font-medium text-[#646464]", children: labels.fields.image.label }), jsxs("div", { className: "flex h-[200px] flex-col items-center justify-center rounded-lg border-2 border-dashed border-gray-200", onClick: (event) => {
|
|
206345
206354
|
event.stopPropagation();
|
|
@@ -213405,7 +213414,7 @@ const AGENT_SEARCH_LABELS = {
|
|
|
213405
213414
|
custom: {
|
|
213406
213415
|
title: 'Custom',
|
|
213407
213416
|
createTitle: 'Create Custom Agent',
|
|
213408
|
-
createDescription: 'Build your own custom agent tailored to your specific
|
|
213417
|
+
createDescription: 'Build your own custom agent tailored to your specific needs',
|
|
213409
213418
|
createSubtext: 'Get started today',
|
|
213410
213419
|
createAriaLabel: 'Create Custom Agent',
|
|
213411
213420
|
ariaLabel: 'Custom agents',
|
|
@@ -214237,18 +214246,18 @@ const useMediaQuery = (settings, device, onChange) => {
|
|
|
214237
214246
|
|
|
214238
214247
|
const CSS_CLASS_NAMES = {
|
|
214239
214248
|
CHAT: {
|
|
214240
|
-
AI_MESSAGE_RESPONSE:
|
|
214241
|
-
USER_MESSAGE_QUERY:
|
|
214242
|
-
TEXTAREA:
|
|
214243
|
-
SUBMIT_MESSAGE_BUTTON:
|
|
214244
|
-
STOP_STREAMING_BUTTON:
|
|
214249
|
+
AI_MESSAGE_RESPONSE: 'chat-ai-message-response',
|
|
214250
|
+
USER_MESSAGE_QUERY: 'chat-user-message-query',
|
|
214251
|
+
TEXTAREA: 'chat-textarea',
|
|
214252
|
+
SUBMIT_MESSAGE_BUTTON: 'chat-submit-message-button',
|
|
214253
|
+
STOP_STREAMING_BUTTON: 'chat-stop-streaming-button',
|
|
214245
214254
|
},
|
|
214246
214255
|
APP_LAYOUT: {
|
|
214247
|
-
MAIN_CONTENT_AREA:
|
|
214248
|
-
GUIDED_SUGGESTED_PROMPTS:
|
|
214249
|
-
GUIDED_SUGGESTED_PROMPTS_REFRESH:
|
|
214250
|
-
WELCOME_CHAT_BUTTON:
|
|
214251
|
-
MENTOR_IMAGE_CONTAINER_RING:
|
|
214256
|
+
MAIN_CONTENT_AREA: 'chat-main-content-area',
|
|
214257
|
+
GUIDED_SUGGESTED_PROMPTS: 'chat-guided-suggested-prompts',
|
|
214258
|
+
GUIDED_SUGGESTED_PROMPTS_REFRESH: 'chat-guided-suggested-prompts-refresh',
|
|
214259
|
+
WELCOME_CHAT_BUTTON: 'chat-welcome-button',
|
|
214260
|
+
MENTOR_IMAGE_CONTAINER_RING: 'mentor-image-container-ring',
|
|
214252
214261
|
},
|
|
214253
214262
|
};
|
|
214254
214263
|
|
|
@@ -214322,7 +214331,7 @@ const AutoResizeTextarea = ({ allowEmptySubmit = false, value, onChange, onSubmi
|
|
|
214322
214331
|
disabled, placeholder: placeholder, style: combinedStyle, className: `flex max-h-32 min-h-[36px] w-full resize-none rounded-2xl border-0 border-gray-200 bg-transparent px-4 py-2 pt-2 pb-1 text-base ring-offset-white placeholder:text-gray-400 focus:outline-none focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-800 dark:bg-gray-950 dark:ring-offset-gray-950 dark:placeholder:text-gray-400 ${className}`, ...props }));
|
|
214323
214332
|
};
|
|
214324
214333
|
|
|
214325
|
-
function DocumentSidebar({ isModal = false, sessionId
|
|
214334
|
+
function DocumentSidebar({ isModal = false, sessionId }) {
|
|
214326
214335
|
const [isCollapsed, setIsCollapsed] = React.useState(false);
|
|
214327
214336
|
const params = useParams();
|
|
214328
214337
|
const username = useUsername();
|
|
@@ -214348,8 +214357,7 @@ function DocumentSidebar({ isModal = false, sessionId, }) {
|
|
|
214348
214357
|
: 'hidden rounded-tl-lg rounded-bl-lg md:hidden lg:block', !isModal && (isCollapsed ? 'w-[40px]' : 'w-[380px]')), style: {
|
|
214349
214358
|
backgroundColor: isCollapsed && !isModal ? 'white' : '#F3F6FB',
|
|
214350
214359
|
maxHeight: 'calc(100vh - 80px)',
|
|
214351
|
-
}, children: jsxs("div", { className: "flex h-full flex-col", children: [!isModal && (jsxs("div", { className: cn('flex cursor-pointer items-center gap-2 border-b border-gray-200 p-4 transition-colors duration-200', isCollapsed &&
|
|
214352
|
-
'h-[80px] justify-center rounded-tl-[5px] rounded-bl-[5px] p-2', 'hover:bg-blue-100'), onClick: toggleCollapse, style: { backgroundColor: '#F3F6FB' }, children: [jsx(FileText, { className: "h-5 w-5 shrink-0 text-blue-600" }), !isCollapsed && (jsxs(Fragment$1, { children: [jsx("h2", { className: "text-base font-medium text-[#646464]", children: "Retrieved Documents" }), jsx(ChevronRight, { className: cn('ml-auto h-4 w-4 text-gray-400 transition-transform', isCollapsed ? 'rotate-180' : '') })] }))] })), (!isCollapsed || isModal) && (jsx(Fragment$1, { children: jsx("div", { className: "flex-1 overflow-auto", style: { backgroundColor: '#F3F6FB' }, children: jsx("div", { className: "mt-0 space-y-1 p-2", children: vectorDocuments.map((doc, index) => {
|
|
214360
|
+
}, children: jsxs("div", { className: "flex h-full flex-col", children: [!isModal && (jsxs("div", { className: cn('flex cursor-pointer items-center gap-2 border-b border-gray-200 p-4 transition-colors duration-200', isCollapsed && 'h-[80px] justify-center rounded-tl-[5px] rounded-bl-[5px] p-2', 'hover:bg-blue-100'), onClick: toggleCollapse, style: { backgroundColor: '#F3F6FB' }, children: [jsx(FileText, { className: "h-5 w-5 shrink-0 text-blue-600" }), !isCollapsed && (jsxs(Fragment$1, { children: [jsx("h2", { className: "text-base font-medium text-[#646464]", children: "Retrieved Documents" }), jsx(ChevronRight, { className: cn('ml-auto h-4 w-4 text-gray-400 transition-transform', isCollapsed ? 'rotate-180' : '') })] }))] })), (!isCollapsed || isModal) && (jsx(Fragment$1, { children: jsx("div", { className: "flex-1 overflow-auto", style: { backgroundColor: '#F3F6FB' }, children: jsx("div", { className: "mt-0 space-y-1 p-2", children: vectorDocuments.map((doc, index) => {
|
|
214353
214361
|
var _a, _b;
|
|
214354
214362
|
return (jsxs(React.Fragment, { children: [jsx("div", { className: "rounded-lg p-2 hover:bg-gray-50", children: jsxs("div", { className: "flex items-start gap-2", children: [jsx(Radio$1, { className: "mt-1 h-4 w-4 text-gray-400" }), jsxs("div", { className: "min-w-0 flex-1 space-y-1", children: [jsxs("div", { className: "flex items-center justify-between", children: [jsx(Link$2, { href: (_a = doc.source) !== null && _a !== void 0 ? _a : '', target: "_blank", className: "min-w-0", children: jsx("span", { className: "text-sm font-semibold break-words text-[#646464] hover:text-blue-600", children: doc.title }) }), jsx("div", { className: "flex items-center gap-2 self-center", children: jsx("span", { className: "text-xs text-gray-500", children: (_b = doc === null || doc === void 0 ? void 0 : doc.score) === null || _b === void 0 ? void 0 : _b.toFixed(2) }) })] }), jsx("p", { className: "line-clamp-6 pt-[10px] text-[14px] text-gray-600", children: doc.snippet })] })] }) }), index < vectorDocuments.length - 1 && (jsx("div", { className: "my-2 border-t border-gray-200" }))] }, index));
|
|
214355
214363
|
}) }) }) }))] }) })) : null }));
|
|
@@ -214396,7 +214404,7 @@ const OpenFolderIcon = ({ className }) => (jsxs("svg", { className: className, x
|
|
|
214396
214404
|
const UploadIcon = ({ className }) => (jsx("svg", { width: "38", height: "38", className: className, viewBox: "0 0 38 38", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M27.2366 33.2506V29.7643H23.7501C23.0526 29.7643 22.487 29.1981 22.4866 28.5006C22.4866 27.803 23.0524 27.2371 23.7501 27.2371H27.2366V23.7506C27.2366 23.053 27.8024 22.4871 28.5001 22.4871C29.1978 22.4875 29.7638 23.0532 29.7638 23.7506V27.2371H33.2501L33.5043 27.2632C34.08 27.381 34.5138 27.8902 34.5138 28.5006C34.5134 29.1109 34.0798 29.6205 33.5043 29.7383L33.2501 29.7643H29.7638V33.2506C29.7634 33.9479 29.1976 34.514 28.5001 34.5143C27.8026 34.5143 27.237 33.9481 27.2366 33.2506ZM30.402 15.8334V13.9334C30.402 12.5824 30.4022 11.6451 30.3427 10.9164C30.2988 10.3807 30.227 10.0206 30.1294 9.74745L30.0235 9.50068C29.7311 8.92667 29.2858 8.44594 28.7395 8.11095L28.4984 7.97734C28.1982 7.82448 27.7962 7.71651 27.0827 7.6582C26.3541 7.59871 25.4164 7.59698 24.0657 7.59698H17.4119C17.4121 7.68822 17.4028 7.78067 17.3822 7.87345L16.5157 11.7792C16.3158 12.6789 16.164 13.4195 15.844 14.0466L15.6975 14.3082C15.4337 14.7301 15.0996 15.102 14.7122 15.4103L14.3077 15.698C13.7973 16.0171 13.2077 16.1885 12.5116 16.3511L11.7787 16.5162L7.87296 17.3827C7.78018 17.4033 7.68773 17.4125 7.59649 17.4124V24.066C7.59649 25.4168 7.59822 26.3544 7.65773 27.0831C7.71602 27.7967 7.824 28.1985 7.97687 28.4987L8.11046 28.74C8.44545 29.2861 8.92618 29.7315 9.50019 30.0241L9.74698 30.1297C10.0201 30.2276 10.3802 30.2994 10.9159 30.3431C11.6446 30.4027 12.5819 30.4025 13.9329 30.4025H15.7401C16.4377 30.4025 17.0034 30.9686 17.0037 31.666C17.0037 32.3639 16.4379 32.9297 15.7401 32.9297H13.9329C12.6236 32.9297 11.5654 32.9309 10.71 32.861C9.94894 32.7988 9.26323 32.6767 8.62443 32.4027L8.35353 32.2746C7.3634 31.7702 6.53405 31.0031 5.95626 30.0611L5.72432 29.6473C5.35958 28.9316 5.2091 28.1592 5.138 27.289C5.06814 26.4336 5.06934 25.3751 5.06934 24.066V17.1007C5.06934 14.1375 6.81931 11.139 9.04746 8.9422C11.2726 6.74834 14.2658 5.06832 17.1002 5.07169L24.0657 5.06983C25.3748 5.06983 26.4331 5.06861 27.2885 5.13847C28.1589 5.20957 28.931 5.36007 29.647 5.72481L30.0606 5.95675C31.0028 6.53454 31.7698 7.36389 32.2743 8.35401L32.4004 8.6249C32.6746 9.26391 32.7983 9.94916 32.8606 10.7105C32.9305 11.5659 32.9292 12.6241 32.9292 13.9334V15.8334C32.9292 16.5312 32.3634 17.097 31.6657 17.097C30.968 17.0966 30.402 16.531 30.402 15.8334ZM14.7438 8.09795C13.4171 8.62423 12.0385 9.54189 10.8213 10.742C9.57977 11.9662 8.62125 13.3695 8.08262 14.748L11.2314 14.0484L11.9828 13.8777C12.5884 13.7339 12.7997 13.6602 12.9681 13.5549L13.1388 13.4343C13.3023 13.3041 13.443 13.1466 13.5544 12.9686L13.6527 12.7719C13.7483 12.5359 13.8461 12.14 14.048 11.2318L14.7438 8.09795Z", fill: "currentColor" }) }));
|
|
214397
214405
|
|
|
214398
214406
|
const PAGE_SIZE = 10;
|
|
214399
|
-
const MemoryMenu = ({ onClose, mentorId, tenantKey, username
|
|
214407
|
+
const MemoryMenu = ({ onClose, mentorId, tenantKey, username }) => {
|
|
214400
214408
|
const [page, setPage] = useState(1);
|
|
214401
214409
|
const [accumulated, setAccumulated] = useState([]);
|
|
214402
214410
|
const [searchQuery, setSearchQuery] = useState('');
|
|
@@ -214563,22 +214571,20 @@ const MemoryMenu = ({ onClose, mentorId, tenantKey, username, }) => {
|
|
|
214563
214571
|
return dateStr;
|
|
214564
214572
|
}
|
|
214565
214573
|
};
|
|
214566
|
-
return (jsxs(Fragment$1, { children: [jsxs("div", { className: "border-b border-gray-100 p-4", children: [jsxs("div", { className: "mb-3 flex items-center justify-between", children: [jsx("h3", { className: "font-semibold text-gray-900", children: "Your Memory" }), jsxs("div", { className: "flex items-center gap-2", children: [jsx(Button$1, { variant: "ghost", size: "icon", className: "h-6 w-6 rounded-full hover:bg-[#38A1E5] hover:text-white", onClick: () => setIsAddingMemory(true), children: jsx(Plus, { className: "h-4 w-4" }) }), jsx(Button$1, { variant: "ghost", size: "icon", className: "h-6 w-6 rounded-full hover:bg-gray-100", onClick: onClose, children: jsx(X$2, { className: "h-4 w-4" }) })] })] }), jsxs("div", { className: "relative", children: [jsx(Search, { className: "absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2 transform text-gray-400" }), jsx(Input, { placeholder: "Search memories...", value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), className: "h-8 rounded-md border border-gray-300 pl-10 text-sm" })] }), jsx("p", { className: "mt-2 text-sm text-gray-500", children: "Your saved memories for this agent" })] }), isAddingMemory && (jsxs("div", { className: "border-b border-gray-100 bg-gray-50 p-4", children: [jsx("h4", { className: "mb-3 font-medium text-gray-900", children: "Add New Memory" }), jsxs("div", { className: "space-y-3", children: [jsx(Textarea, { placeholder: "Memory content...", value: newMemory.content, onChange: (e) => setNewMemory({ ...newMemory, content: e.target.value }), className: "min-h-[60px] resize-none rounded-md border border-gray-300 text-sm" }), categories.length > 0 && (jsxs(Select$1, { value: newMemory.categorySlug, onValueChange: (val) => setNewMemory({ ...newMemory, categorySlug: val }), children: [jsx(SelectTrigger, { className: "h-8 text-sm", children: jsx(SelectValue, { placeholder: "Select category" }) }), jsx(SelectContent, { children: categories.map((cat) => (jsx(SelectItem, { value: cat.slug, children: cat.name }, cat.slug))) })] })), jsxs("div", { className: "flex gap-2", children: [jsxs(Button$1, { size: "sm", onClick: handleAddMemory, disabled: !newMemory.content.trim() || isCreating, className: "bg-[#38A1E5] text-white hover:bg-[#2891D5]", children: [isCreating ?
|
|
214574
|
+
return (jsxs(Fragment$1, { children: [jsxs("div", { className: "border-b border-gray-100 p-4", children: [jsxs("div", { className: "mb-3 flex items-center justify-between", children: [jsx("h3", { className: "font-semibold text-gray-900", children: "Your Memory" }), jsxs("div", { className: "flex items-center gap-2", children: [jsx(Button$1, { variant: "ghost", size: "icon", className: "h-6 w-6 rounded-full hover:bg-[#38A1E5] hover:text-white", onClick: () => setIsAddingMemory(true), children: jsx(Plus, { className: "h-4 w-4" }) }), jsx(Button$1, { variant: "ghost", size: "icon", className: "h-6 w-6 rounded-full hover:bg-gray-100", onClick: onClose, children: jsx(X$2, { className: "h-4 w-4" }) })] })] }), jsxs("div", { className: "relative", children: [jsx(Search, { className: "absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2 transform text-gray-400" }), jsx(Input, { placeholder: "Search memories...", value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), className: "h-8 rounded-md border border-gray-300 pl-10 text-sm" })] }), jsx("p", { className: "mt-2 text-sm text-gray-500", children: "Your saved memories for this agent" })] }), isAddingMemory && (jsxs("div", { className: "border-b border-gray-100 bg-gray-50 p-4", children: [jsx("h4", { className: "mb-3 font-medium text-gray-900", children: "Add New Memory" }), jsxs("div", { className: "space-y-3", children: [jsx(Textarea, { placeholder: "Memory content...", value: newMemory.content, onChange: (e) => setNewMemory({ ...newMemory, content: e.target.value }), className: "min-h-[60px] resize-none rounded-md border border-gray-300 text-sm" }), categories.length > 0 && (jsxs(Select$1, { value: newMemory.categorySlug, onValueChange: (val) => setNewMemory({ ...newMemory, categorySlug: val }), children: [jsx(SelectTrigger, { className: "h-8 text-sm", children: jsx(SelectValue, { placeholder: "Select category" }) }), jsx(SelectContent, { children: categories.map((cat) => (jsx(SelectItem, { value: cat.slug, children: cat.name }, cat.slug))) })] })), jsxs("div", { className: "flex gap-2", children: [jsxs(Button$1, { size: "sm", onClick: handleAddMemory, disabled: !newMemory.content.trim() || isCreating, className: "bg-[#38A1E5] text-white hover:bg-[#2891D5]", children: [isCreating ? jsx(LoaderCircle, { className: "mr-1 h-3 w-3 animate-spin" }) : null, "Save"] }), jsx(Button$1, { size: "sm", variant: "outline", onClick: () => {
|
|
214567
214575
|
setIsAddingMemory(false);
|
|
214568
214576
|
setNewMemory({ content: '', categorySlug: '' });
|
|
214569
214577
|
}, children: "Cancel" })] })] })] })), jsx("div", { ref: scrollRef, onScroll: handleScroll, className: "max-h-80 overflow-y-auto", children: isInitialLoading ? (jsx("div", { className: "flex items-center justify-center p-8", children: jsx(LoaderCircle, { className: "h-5 w-5 animate-spin text-gray-400" }) })) : (jsxs(Fragment$1, { children: [filteredMemories.map((memory) => {
|
|
214570
214578
|
const isEditing = editingMemoryId === memory.id;
|
|
214571
|
-
return (jsx("div", { className: "border-b border-gray-50 p-3 transition-colors last:border-b-0 hover:bg-gray-50", children: isEditing ? (jsxs("div", { className: "space-y-3", children: [jsx(Textarea, { value: editContent, onChange: (e) => setEditContent(e.target.value), className: "min-h-[60px] resize-none rounded-md border border-gray-300 text-sm", placeholder: "Memory content..." }), categories.length > 0 && (jsxs(Select$1, { value: editCategorySlug, onValueChange: setEditCategorySlug, children: [jsx(SelectTrigger, { className: "h-8 text-sm", children: jsx(SelectValue, { placeholder: "Select category" }) }), jsx(SelectContent, { children: categories.map((cat) => (jsx(SelectItem, { value: cat.slug, children: cat.name }, cat.slug))) })] })), jsxs("div", { className: "flex gap-2", children: [jsxs(Button$1, { size: "sm", onClick: handleSaveEdit, disabled: !editContent.trim() || isUpdating, className: "bg-[#38A1E5] text-white hover:bg-[#2891D5]", children: [isUpdating ?
|
|
214579
|
+
return (jsx("div", { className: "border-b border-gray-50 p-3 transition-colors last:border-b-0 hover:bg-gray-50", children: isEditing ? (jsxs("div", { className: "space-y-3", children: [jsx(Textarea, { value: editContent, onChange: (e) => setEditContent(e.target.value), className: "min-h-[60px] resize-none rounded-md border border-gray-300 text-sm", placeholder: "Memory content..." }), categories.length > 0 && (jsxs(Select$1, { value: editCategorySlug, onValueChange: setEditCategorySlug, children: [jsx(SelectTrigger, { className: "h-8 text-sm", children: jsx(SelectValue, { placeholder: "Select category" }) }), jsx(SelectContent, { children: categories.map((cat) => (jsx(SelectItem, { value: cat.slug, children: cat.name }, cat.slug))) })] })), jsxs("div", { className: "flex gap-2", children: [jsxs(Button$1, { size: "sm", onClick: handleSaveEdit, disabled: !editContent.trim() || isUpdating, className: "bg-[#38A1E5] text-white hover:bg-[#2891D5]", children: [isUpdating ? jsx(LoaderCircle, { className: "mr-1 h-3 w-3 animate-spin" }) : null, "Save"] }), jsx(Button$1, { size: "sm", variant: "outline", onClick: () => {
|
|
214572
214580
|
setEditingMemoryId(null);
|
|
214573
214581
|
setEditContent('');
|
|
214574
214582
|
setEditCategorySlug('');
|
|
214575
214583
|
}, children: "Cancel" })] })] })) : (jsx("div", { children: jsxs("div", { className: "flex items-start justify-between", children: [jsxs("div", { className: "flex-1", children: [jsx("div", { className: "flex items-center gap-2", children: jsx("span", { className: "rounded-full bg-blue-100 px-2 py-0.5 text-xs text-blue-700", children: memory.category.name }) }), jsx("p", { className: "mt-1 line-clamp-2 text-xs text-gray-600", children: memory.content }), jsx("p", { className: "mt-1 text-xs text-gray-400", children: formatTimestamp(memory.createdAt) })] }), jsxs("div", { className: "ml-2 flex items-center gap-1", children: [jsx(Button$1, { variant: "ghost", size: "icon", className: "h-6 w-6 rounded-full hover:bg-blue-100", onClick: (e) => startEdit(memory, e), children: jsx(PenLine, { className: "h-3 w-3 text-blue-500" }) }), jsx(Button$1, { variant: "ghost", size: "icon", className: "h-6 w-6 rounded-full hover:bg-red-100", disabled: deletingId === memory.id, onClick: (e) => handleDeleteMemory(memory.id, e), children: deletingId === memory.id ? (jsx(LoaderCircle, { className: "h-3 w-3 animate-spin text-red-500" })) : (jsx(Trash2, { className: "h-3 w-3 text-red-500" })) })] })] }) })) }, memory.id));
|
|
214576
|
-
}), filteredMemories.length === 0 && !isInitialLoading && (jsx("div", { className: "p-4 text-center text-sm text-gray-500", children: searchQuery
|
|
214577
|
-
? 'No memories found matching your search.'
|
|
214578
|
-
: 'No memories yet.' })), isFetching && accumulated.length > 0 && (jsx("div", { className: "flex items-center justify-center p-3", children: jsx(LoaderCircle, { className: "h-4 w-4 animate-spin text-gray-400" }) }))] })) })] }));
|
|
214584
|
+
}), filteredMemories.length === 0 && !isInitialLoading && (jsx("div", { className: "p-4 text-center text-sm text-gray-500", children: searchQuery ? 'No memories found matching your search.' : 'No memories yet.' })), isFetching && accumulated.length > 0 && (jsx("div", { className: "flex items-center justify-center p-3", children: jsx(LoaderCircle, { className: "h-4 w-4 animate-spin text-gray-400" }) }))] })) })] }));
|
|
214579
214585
|
};
|
|
214580
214586
|
|
|
214581
|
-
function MemoryButton({ mentorId, tenantKey, username
|
|
214587
|
+
function MemoryButton({ mentorId, tenantKey, username }) {
|
|
214582
214588
|
const [isOpen, setIsOpen] = useState(false);
|
|
214583
214589
|
return (jsxs(Popover, { open: isOpen, onOpenChange: setIsOpen, children: [jsx(PopoverTrigger, { asChild: true, children: jsxs(Button$1, { variant: "ghost", size: "sm", type: "button", className: `flex h-8 items-center gap-1.5 rounded-lg px-2 text-sm transition-all duration-200 ${isOpen
|
|
214584
214590
|
? 'border border-[#D0E0FF] bg-[#F5F8FF] text-[#38A1E5]'
|
|
@@ -214899,14 +214905,11 @@ const OutsideButtons = ({
|
|
|
214899
214905
|
// Get the currently selected more option for display
|
|
214900
214906
|
const getSelectedMoreOption = () => {
|
|
214901
214907
|
return (
|
|
214902
|
-
/* istanbul ignore next -- @preserve moreMenuItems is always empty */ moreMenuItems.find((item) => item.slug && activeOptions.includes(item.slug)) ||
|
|
214903
|
-
hiddenButtons.find((item) => item.slug && activeOptions.includes(item.slug)));
|
|
214908
|
+
/* istanbul ignore next -- @preserve moreMenuItems is always empty */ moreMenuItems.find((item) => item.slug && activeOptions.includes(item.slug)) || hiddenButtons.find((item) => item.slug && activeOptions.includes(item.slug)));
|
|
214904
214909
|
};
|
|
214905
214910
|
const selectedMoreOption = getSelectedMoreOption();
|
|
214906
214911
|
// Don't render anything if there are no buttons to show
|
|
214907
|
-
if (visibleButtons.length === 0 &&
|
|
214908
|
-
hiddenButtons.length === 0 &&
|
|
214909
|
-
moreMenuItems.length === 0) {
|
|
214912
|
+
if (visibleButtons.length === 0 && hiddenButtons.length === 0 && moreMenuItems.length === 0) {
|
|
214910
214913
|
return null;
|
|
214911
214914
|
}
|
|
214912
214915
|
return (jsxs("div", { className: "bg-card flex w-full max-w-[calc(100%-1rem)] items-center justify-center gap-4 rounded-b-xl border border-t-0 border-gray-200 py-3 text-sm text-gray-600", children: [visibleButtons.map((button, index) => (jsxs(React__default.Fragment, { children: [index > 0 && jsx("span", { className: "font-medium text-gray-500", children: "|" }), jsxs(Button$1, { variant: "ghost", size: "sm", type: "button", disabled: disabled || pendingAuth !== null, className: `flex h-8 items-center gap-2 rounded-lg px-3 transition-all duration-200 disabled:cursor-not-allowed disabled:opacity-50 ${button.isActive
|
|
@@ -214925,7 +214928,7 @@ const OutsideButtons = ({
|
|
|
214925
214928
|
if (button.slug) {
|
|
214926
214929
|
onCrossClick(button.slug);
|
|
214927
214930
|
}
|
|
214928
|
-
} }))] })] }, button.name))), (hiddenButtons.length > 0 || moreMenuItems.length > 0) && (jsxs(Fragment$1, { children: [visibleButtons.length > 0 &&
|
|
214931
|
+
} }))] })] }, button.name))), (hiddenButtons.length > 0 || moreMenuItems.length > 0) && (jsxs(Fragment$1, { children: [visibleButtons.length > 0 && jsx("span", { className: "font-medium text-gray-500", children: "|" }), jsxs(DropdownMenu, { children: [jsx(DropdownMenuTrigger, { asChild: true, disabled: disabled, children: jsx(Button$1, { variant: "ghost", size: "sm", type: "button", disabled: disabled, className: `flex h-8 items-center gap-2 rounded-lg px-3 transition-all duration-200 disabled:cursor-not-allowed disabled:opacity-50 ${selectedMoreOption
|
|
214929
214932
|
? 'border border-[#D0E0FF] bg-[#F5F8FF] text-[#38A1E5]' // Active state
|
|
214930
214933
|
: 'border border-gray-200 hover:border-[#D0E0FF] hover:bg-[#F5F8FF]' // Default and hover state
|
|
214931
214934
|
}`, children: selectedMoreOption ? (jsxs(Fragment$1, { children: [jsx("span", { className:
|
|
@@ -214941,9 +214944,7 @@ function ScreenSharingButton({ onClick, isScreenSharingModalOpen, screenSharing,
|
|
|
214941
214944
|
}
|
|
214942
214945
|
return 'Enable Screen Sharing';
|
|
214943
214946
|
}
|
|
214944
|
-
if (!screenSharing ||
|
|
214945
|
-
!((_a = navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.getDisplayMedia) ||
|
|
214946
|
-
isSafariBrowser()) {
|
|
214947
|
+
if (!screenSharing || !((_a = navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.getDisplayMedia) || isSafariBrowser()) {
|
|
214947
214948
|
return null;
|
|
214948
214949
|
}
|
|
214949
214950
|
return (jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx("div", { children: jsx(Button$1, { variant: "ghost", size: "icon", type: "button", className: cn('h-9 w-9 text-gray-400', isScreenSharingModalOpen && 'ibl-button-primary'), disabled: disabled || isPreviewMode, onClick: onClick, "aria-label": "Screen Sharing", children: jsx(ScreenShare, { className: cn('h-6 w-6 text-gray-400', {
|
|
@@ -215027,11 +215028,7 @@ function VoiceChatButton({ isPreviewMode, handleMicrophoneBtnClick, processing,
|
|
|
215027
215028
|
if (!showVoiceRecorder) {
|
|
215028
215029
|
return null;
|
|
215029
215030
|
}
|
|
215030
|
-
return (jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx("div", { children: jsxs(Button$1, { variant: "ghost", size: "icon", className: "h-9 w-9 text-gray-400", disabled: disabled || isPreviewMode || processing, type: "button", "aria-label": processing
|
|
215031
|
-
? 'Processing voice input'
|
|
215032
|
-
: recording
|
|
215033
|
-
? 'Stop voice input'
|
|
215034
|
-
: 'Voice input', onClick: handleMicrophoneBtnClick, children: [jsx(Icon$1, { processing: processing, recording: recording }), jsx("span", { className: "sr-only", children: "Voice input" })] }) }) }), jsx(TooltipContent, { className: "ibl-tooltip-content capitalize", children: "Voice Record" })] }));
|
|
215031
|
+
return (jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx("div", { children: jsxs(Button$1, { variant: "ghost", size: "icon", className: "h-9 w-9 text-gray-400", disabled: disabled || isPreviewMode || processing, type: "button", "aria-label": processing ? 'Processing voice input' : recording ? 'Stop voice input' : 'Voice input', onClick: handleMicrophoneBtnClick, children: [jsx(Icon$1, { processing: processing, recording: recording }), jsx("span", { className: "sr-only", children: "Voice input" })] }) }) }), jsx(TooltipContent, { className: "ibl-tooltip-content capitalize", children: "Voice Record" })] }));
|
|
215035
215032
|
}
|
|
215036
215033
|
|
|
215037
215034
|
function FileTypeIcon({ fileName, fileType }) {
|
|
@@ -215051,14 +215048,10 @@ function FileTypeIcon({ fileName, fileType }) {
|
|
|
215051
215048
|
else if (type.includes('video')) {
|
|
215052
215049
|
return jsx(FileVideo, { className: "h-5 w-5 text-blue-500" });
|
|
215053
215050
|
}
|
|
215054
|
-
else if (type.includes('spreadsheet') ||
|
|
215055
|
-
type.includes('excel') ||
|
|
215056
|
-
type.includes('csv')) {
|
|
215051
|
+
else if (type.includes('spreadsheet') || type.includes('excel') || type.includes('csv')) {
|
|
215057
215052
|
return jsx(FileSpreadsheet, { className: "h-5 w-5 text-blue-500" });
|
|
215058
215053
|
}
|
|
215059
|
-
else if (type.includes('zip') ||
|
|
215060
|
-
type.includes('compressed') ||
|
|
215061
|
-
type.includes('archive')) {
|
|
215054
|
+
else if (type.includes('zip') || type.includes('compressed') || type.includes('archive')) {
|
|
215062
215055
|
return jsx(FileArchive, { className: "h-5 w-5 text-blue-500" });
|
|
215063
215056
|
}
|
|
215064
215057
|
else if (type.includes('javascript') ||
|
|
@@ -215090,19 +215083,7 @@ function FileTypeIcon({ fileName, fileType }) {
|
|
|
215090
215083
|
else if (['zip', 'rar', '7z', 'tar', 'gz'].includes(extension)) {
|
|
215091
215084
|
return jsx(FileArchive, { className: "h-5 w-5 text-blue-500" });
|
|
215092
215085
|
}
|
|
215093
|
-
else if ([
|
|
215094
|
-
'js',
|
|
215095
|
-
'ts',
|
|
215096
|
-
'jsx',
|
|
215097
|
-
'tsx',
|
|
215098
|
-
'html',
|
|
215099
|
-
'css',
|
|
215100
|
-
'json',
|
|
215101
|
-
'py',
|
|
215102
|
-
'java',
|
|
215103
|
-
'c',
|
|
215104
|
-
'cpp',
|
|
215105
|
-
].includes(extension)) {
|
|
215086
|
+
else if (['js', 'ts', 'jsx', 'tsx', 'html', 'css', 'json', 'py', 'java', 'c', 'cpp'].includes(extension)) {
|
|
215106
215087
|
return jsx(FileCode, { className: "h-5 w-5 text-blue-500" });
|
|
215107
215088
|
}
|
|
215108
215089
|
// Default icon
|
|
@@ -215119,10 +215100,7 @@ function FileAttachmentsList({ attachedFiles, onRemoveFile, onRetryFile, }) {
|
|
|
215119
215100
|
success: 'bg-blue-50 border-blue-200',
|
|
215120
215101
|
error: 'bg-red-50 border-red-200',
|
|
215121
215102
|
};
|
|
215122
|
-
return (jsx("div", { className: "flex flex-wrap gap-2 px-3 pt-3", children: attachedFiles.map((file) => (jsxs("div", { className: "relative", children: [jsx(TooltipProvider, { children: jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsxs("div", { className: cn('inline-flex max-w-fit cursor-pointer items-center gap-2 rounded-lg border p-2 transition-colors', statusColors[file.uploadStatus]), children: [jsxs("div", { className: "relative flex h-10 w-10 items-center justify-center rounded-lg bg-blue-100", children: [jsx(FileTypeIcon, { fileName: file.fileName, fileType: file.fileType }), file.uploadStatus === 'uploading' && (jsx("div", { className: "absolute inset-0 flex items-center justify-center rounded-lg bg-blue-100/90", children: jsx("div", { className: "h-4 w-4 animate-spin rounded-full border-2 border-blue-500 border-t-transparent" }) })), file.uploadStatus === 'success' && (jsx("div", { className: "absolute -top-1 -right-1 h-3 w-3 rounded-full border-2 border-white bg-blue-500" })), file.uploadStatus === 'error' && (jsx("div", { className: "absolute -top-1 -right-1 flex h-3 w-3 items-center justify-center rounded-full border-2 border-white bg-red-500", children: jsx(X$2, { className: "h-2 w-2 text-white" }) }))] }), jsxs("div", { className: "min-w-0 flex-1", children: [jsx("div", { className: "max-w-[150px] truncate text-sm font-medium text-gray-900", children: file.fileName }), jsxs("div", { className: "flex items-center gap-2", children: [jsx("div", { className: "text-xs text-gray-500 uppercase", children: file.fileType.split('/')[1] || 'FILE' }), file.uploadStatus === 'uploading' && (jsxs("span", { className: "text-xs font-medium text-blue-600", children: [file.uploadProgress, "%", file.retryCount &&
|
|
215123
|
-
file.retryCount > 0 &&
|
|
215124
|
-
` (retry ${file.retryCount})`] })), file.uploadStatus === 'error' && (jsxs("button", { onClick: () => onRetryFile(file.id), className: "flex items-center gap-1 text-xs font-medium text-blue-600 hover:text-blue-700", children: [jsx(RotateCw, { className: "h-3 w-3" }), "Retry"] }))] }), file.uploadStatus === 'uploading' && (jsx("div", { className: "mt-1 h-1 w-[150px] overflow-hidden rounded-full bg-gray-200", children: jsx("div", { className: "h-full bg-blue-500 transition-all duration-300 ease-out", style: { width: `${file.uploadProgress}%` } }) }))] })] }) }), jsxs(TooltipContent, { className: "ibl-tooltip-content", children: [jsx("p", { children: file.fileName }), jsxs("p", { className: "mt-1 text-xs text-gray-500 capitalize", children: ["Status: ", file.uploadStatus, file.uploadStatus === 'uploading' &&
|
|
215125
|
-
` (${file.uploadProgress}%)`, file.retryCount && file.retryCount > 0 && (jsxs("span", { className: "block text-yellow-600", children: ["Retry attempt ", file.retryCount] }))] })] })] }) }), jsxs(Button$1, { variant: "ghost", size: "icon", className: "absolute -top-2 -right-2 z-10 h-5 w-5 rounded-[5px] border border-gray-200 bg-white p-0 shadow-sm hover:bg-gray-200", onClick: () => onRemoveFile(file.id), disabled: file.uploadStatus === 'uploading', children: [jsx(X$2, { className: "h-3 w-3" }), jsx("span", { className: "sr-only", children: "Remove file" })] })] }, file.id))) }));
|
|
215103
|
+
return (jsx("div", { className: "flex flex-wrap gap-2 px-3 pt-3", children: attachedFiles.map((file) => (jsxs("div", { className: "relative", children: [jsx(TooltipProvider, { children: jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsxs("div", { className: cn('inline-flex max-w-fit cursor-pointer items-center gap-2 rounded-lg border p-2 transition-colors', statusColors[file.uploadStatus]), children: [jsxs("div", { className: "relative flex h-10 w-10 items-center justify-center rounded-lg bg-blue-100", children: [jsx(FileTypeIcon, { fileName: file.fileName, fileType: file.fileType }), file.uploadStatus === 'uploading' && (jsx("div", { className: "absolute inset-0 flex items-center justify-center rounded-lg bg-blue-100/90", children: jsx("div", { className: "h-4 w-4 animate-spin rounded-full border-2 border-blue-500 border-t-transparent" }) })), file.uploadStatus === 'success' && (jsx("div", { className: "absolute -top-1 -right-1 h-3 w-3 rounded-full border-2 border-white bg-blue-500" })), file.uploadStatus === 'error' && (jsx("div", { className: "absolute -top-1 -right-1 flex h-3 w-3 items-center justify-center rounded-full border-2 border-white bg-red-500", children: jsx(X$2, { className: "h-2 w-2 text-white" }) }))] }), jsxs("div", { className: "min-w-0 flex-1", children: [jsx("div", { className: "max-w-[150px] truncate text-sm font-medium text-gray-900", children: file.fileName }), jsxs("div", { className: "flex items-center gap-2", children: [jsx("div", { className: "text-xs text-gray-500 uppercase", children: file.fileType.split('/')[1] || 'FILE' }), file.uploadStatus === 'uploading' && (jsxs("span", { className: "text-xs font-medium text-blue-600", children: [file.uploadProgress, "%", file.retryCount && file.retryCount > 0 && ` (retry ${file.retryCount})`] })), file.uploadStatus === 'error' && (jsxs("button", { onClick: () => onRetryFile(file.id), className: "flex items-center gap-1 text-xs font-medium text-blue-600 hover:text-blue-700", children: [jsx(RotateCw, { className: "h-3 w-3" }), "Retry"] }))] }), file.uploadStatus === 'uploading' && (jsx("div", { className: "mt-1 h-1 w-[150px] overflow-hidden rounded-full bg-gray-200", children: jsx("div", { className: "h-full bg-blue-500 transition-all duration-300 ease-out", style: { width: `${file.uploadProgress}%` } }) }))] })] }) }), jsxs(TooltipContent, { className: "ibl-tooltip-content", children: [jsx("p", { children: file.fileName }), jsxs("p", { className: "mt-1 text-xs text-gray-500 capitalize", children: ["Status: ", file.uploadStatus, file.uploadStatus === 'uploading' && ` (${file.uploadProgress}%)`, file.retryCount && file.retryCount > 0 && (jsxs("span", { className: "block text-yellow-600", children: ["Retry attempt ", file.retryCount] }))] })] })] }) }), jsxs(Button$1, { variant: "ghost", size: "icon", className: "absolute -top-2 -right-2 z-10 h-5 w-5 rounded-[5px] border border-gray-200 bg-white p-0 shadow-sm hover:bg-gray-200", onClick: () => onRemoveFile(file.id), disabled: file.uploadStatus === 'uploading', children: [jsx(X$2, { className: "h-3 w-3" }), jsx("span", { className: "sr-only", children: "Remove file" })] })] }, file.id))) }));
|
|
215126
215104
|
}
|
|
215127
215105
|
|
|
215128
215106
|
const StopStreamingButton = forwardRef(function StopStreamingButton({ stopGenerating }, ref) {
|
|
@@ -215141,10 +215119,7 @@ const StopStreamingButton = forwardRef(function StopStreamingButton({ stopGenera
|
|
|
215141
215119
|
});
|
|
215142
215120
|
|
|
215143
215121
|
function SubmitMessageButton({ isPreviewMode, allowAnonymousAccess, isUploading, disabled = false, isConnecting = false, }) {
|
|
215144
|
-
const isDisabled = disabled ||
|
|
215145
|
-
(isPreviewMode && !allowAnonymousAccess) ||
|
|
215146
|
-
isUploading ||
|
|
215147
|
-
isConnecting;
|
|
215122
|
+
const isDisabled = disabled || (isPreviewMode && !allowAnonymousAccess) || isUploading || isConnecting;
|
|
215148
215123
|
const getTooltipText = () => {
|
|
215149
215124
|
if (isConnecting)
|
|
215150
215125
|
return 'Connecting...';
|
|
@@ -215173,9 +215148,7 @@ function ChatInputForm({ onSubmit, onScreenSharingClick, isScreenSharingModalOpe
|
|
|
215173
215148
|
// Check if user has chat permission via RBAC
|
|
215174
215149
|
const mentorDbId = (_a = mentorSettings === null || mentorSettings === void 0 ? void 0 : mentorSettings.data) === null || _a === void 0 ? void 0 : _a.mentorDbId;
|
|
215175
215150
|
const mentorRbacKey = mentorDbId ? `/mentors/${mentorDbId}/` : null;
|
|
215176
|
-
const hasMentorRbacData = mentorRbacKey
|
|
215177
|
-
? mentorRbacKey in rbacPermissions
|
|
215178
|
-
: false;
|
|
215151
|
+
const hasMentorRbacData = mentorRbacKey ? mentorRbacKey in rbacPermissions : false;
|
|
215179
215152
|
const hasChatPermission = mentorDbId && hasMentorRbacData
|
|
215180
215153
|
? checkRbacPermission(rbacPermissions, `/mentors/${mentorDbId}/#chat`)
|
|
215181
215154
|
: true; // Default to true if mentor ID not available or RBAC data not loaded
|
|
@@ -215209,8 +215182,7 @@ function ChatInputForm({ onSubmit, onScreenSharingClick, isScreenSharingModalOpe
|
|
|
215209
215182
|
},
|
|
215210
215183
|
});
|
|
215211
215184
|
const visibleToLoggedInUsersOnly = !isAccessingPublicRoute || isLoggedIn();
|
|
215212
|
-
const isMentorViewableByAnyone = ((_b = mentorSettings === null || mentorSettings === void 0 ? void 0 : mentorSettings.data) === null || _b === void 0 ? void 0 : _b.mentorVisibility) ===
|
|
215213
|
-
MentorVisibilityEnum.VIEWABLE_BY_ANYONE;
|
|
215185
|
+
const isMentorViewableByAnyone = ((_b = mentorSettings === null || mentorSettings === void 0 ? void 0 : mentorSettings.data) === null || _b === void 0 ? void 0 : _b.mentorVisibility) === MentorVisibilityEnum.VIEWABLE_BY_ANYONE;
|
|
215214
215186
|
const setInputValue = (input) => {
|
|
215215
215187
|
dispatch(chatInputSliceActions.setTextareaInput(input));
|
|
215216
215188
|
};
|
|
@@ -215278,22 +215250,18 @@ function ChatInputForm({ onSubmit, onScreenSharingClick, isScreenSharingModalOpe
|
|
|
215278
215250
|
};
|
|
215279
215251
|
return (jsxs(Fragment$1, { children: [isTabletOrMobile && !isPreviewMode && !embedMode && !compactMode && (jsx("div", { className: "mx-auto flex w-full justify-end pt-4 pl-4", style: chatAreaMaxWidth ? { maxWidth: `${chatAreaMaxWidth}px` } : undefined, children: jsx(RetrievedDocumentsButton, { sessionId: sessionId }) })), ((_c = mentorSettings === null || mentorSettings === void 0 ? void 0 : mentorSettings.data) === null || _c === void 0 ? void 0 : _c.disclaimer) && !compactMode && (jsx("div", { className: "mx-auto mt-1 w-full pb-1", style: chatAreaMaxWidth ? { maxWidth: `${chatAreaMaxWidth}px` } : undefined, children: jsx("p", { id: "chat-input-disclaimer", className: "text-center text-[0.625rem] text-gray-500 italic", children: (_d = mentorSettings === null || mentorSettings === void 0 ? void 0 : mentorSettings.data) === null || _d === void 0 ? void 0 : _d.disclaimer }) })), jsxs("form", { ref: containerRef, onSubmit: handleSubmit, className: cn('mx-auto mt-4 w-full pb-2', CSS_CLASS_NAMES.CHAT.TEXTAREA), style: chatAreaMaxWidth ? { maxWidth: `${chatAreaMaxWidth}px` } : undefined, children: [jsxs("div", { className: "relative overflow-hidden rounded-2xl border border-gray-200 bg-[#fbfbfb] pb-3 shadow-xs", children: [jsx(FileAttachmentsList, { attachedFiles: attachedFiles, onRemoveFile: handleRemoveFile, onRetryFile: retryUpload }), fileAddedNotification && (jsxs("div", { className: "animate-in slide-in-from-bottom-5 absolute top-0 right-0 left-0 -mt-10 flex items-center gap-2 rounded-md bg-blue-50 p-2 text-xs text-blue-600 duration-300", children: [jsx(FileText, { className: "h-3 w-3" }), jsx("span", { className: "truncate", children: fileAddedNotification })] })), jsxs("div", { className: "grid", children: [jsx("label", { id: "chat-input-label", htmlFor: "chat-input-textarea", className: cn(persistentChatInputLabel
|
|
215280
215252
|
? 'block px-[18.5px] pt-3 text-xs font-medium text-gray-600'
|
|
215281
|
-
: 'sr-only'), children: "Ask anything" }), jsx(AutoResizeTextarea, { id: "chat-input-textarea", "aria-labelledby": "chat-input-label", "aria-describedby": ((_e = mentorSettings === null || mentorSettings === void 0 ? void 0 : mentorSettings.data) === null || _e === void 0 ? void 0 : _e.disclaimer)
|
|
215282
|
-
? 'chat-input-disclaimer'
|
|
215283
|
-
: undefined, value: inputValue, onChange: handleInputChange, onSubmit: handleSubmit, sessionId: sessionId, isPreviewMode: isPreviewMode, textAreaRows: textAreaRows, placeholder: isChatDisabledByRbac
|
|
215253
|
+
: 'sr-only'), children: "Ask anything" }), jsx(AutoResizeTextarea, { id: "chat-input-textarea", "aria-labelledby": "chat-input-label", "aria-describedby": ((_e = mentorSettings === null || mentorSettings === void 0 ? void 0 : mentorSettings.data) === null || _e === void 0 ? void 0 : _e.disclaimer) ? 'chat-input-disclaimer' : undefined, value: inputValue, onChange: handleInputChange, onSubmit: handleSubmit, sessionId: sessionId, isPreviewMode: isPreviewMode, textAreaRows: textAreaRows, placeholder: isChatDisabledByRbac
|
|
215284
215254
|
? "Sorry about that! You don't have permission to chat."
|
|
215285
|
-
: textAreaPlaceholder(), disabled: isChatDisabledByRbac || hasUploadingFiles, allowEmptySubmit: attachedFiles.length > 0, allowAnonymousAccess: isMentorViewableByAnyone ||
|
|
215286
|
-
showingSharedChat ||
|
|
215287
|
-
!!userIsVisiting, embedMode: embedMode }), jsxs("div", { className: "flex items-center gap-2 px-2", children: [visibleToLoggedInUsersOnly && !compactMode && (jsx(UploadMenu, { onFileInputTrigger: () => executeWithTrialCheck(triggerFileInput), disabled: isChatDisabledByRbac || !sessionId, mentorId: mentorId, tenantKey: tenantKey, isPublicRoute: isPublicRoute })), visibleToLoggedInUsersOnly && !compactMode && (jsx(InsideButtons, { containerWidth: containerWidth, activeOptions: activeTools, onOptionClick: updateSessionTools, deepResearch: deepResearch, artifactsEnabled: artifactsEnabled, disabled: isChatDisabledByRbac, onOpenPromptGallery: openPromptGallery, embedMode: embedMode, promptsIsEnabled: promptsIsEnabled, studyMode: studyMode, memoryEnabled: mentorSettings.data.memoryEnabled, mentorId: mentorId, tenantKey: tenantKey, username: username })), jsxs("div", { className: "ml-auto flex", children: [visibleToLoggedInUsersOnly && !compactMode && (jsx(ScreenSharingButton, { onClick: onScreenSharingClick, isScreenSharingModalOpen: isScreenSharingModalOpen, screenSharing: screenSharing, isPreviewMode: isPreviewMode, disabled: isChatDisabledByRbac })), visibleToLoggedInUsersOnly && !compactMode && (jsx(VoiceChatButton, { isPreviewMode: isPreviewMode, handleMicrophoneBtnClick: () => executeWithTrialCheck(handleMicrophoneBtnClick), processing: processing, recording: recording, disabled: isChatDisabledByRbac, mentorId: mentorId, tenantKey: tenantKey, isPublicRoute: isPublicRoute })), visibleToLoggedInUsersOnly && !compactMode && (jsx(VoiceCallButton, { isPreviewMode: isPreviewMode, onClick: () => executeWithTrialCheck(onPhoneCallClick), disabled: isChatDisabledByRbac, mentorId: mentorId, tenantKey: tenantKey, isPublicRoute: isPublicRoute })), isStreaming ? (jsx(StopStreamingButton, { ref: stopStreamingButtonRef, stopGenerating: stopGenerating })) : (jsx(SubmitMessageButton, { isPreviewMode: isPreviewMode, allowAnonymousAccess: isMentorViewableByAnyone, isUploading: hasUploadingFiles, disabled: isChatDisabledByRbac || !sessionId, isConnecting: isConnecting }))] })] })] }), jsx("input", { type: "file", ref: fileUploadInputRef, className: "hidden", onChange: handleFileInputChange, accept: fileUploadCapabilities.allSupportedTypes.length > 0
|
|
215255
|
+
: textAreaPlaceholder(), disabled: isChatDisabledByRbac || hasUploadingFiles, allowEmptySubmit: attachedFiles.length > 0, allowAnonymousAccess: isMentorViewableByAnyone || showingSharedChat || !!userIsVisiting, embedMode: embedMode }), jsxs("div", { className: "flex items-center gap-2 px-2", children: [visibleToLoggedInUsersOnly && !compactMode && (jsx(UploadMenu, { onFileInputTrigger: () => executeWithTrialCheck(triggerFileInput), disabled: isChatDisabledByRbac || !sessionId, mentorId: mentorId, tenantKey: tenantKey, isPublicRoute: isPublicRoute })), visibleToLoggedInUsersOnly && !compactMode && (jsx(InsideButtons, { containerWidth: containerWidth, activeOptions: activeTools, onOptionClick: updateSessionTools, deepResearch: deepResearch, artifactsEnabled: artifactsEnabled, disabled: isChatDisabledByRbac, onOpenPromptGallery: openPromptGallery, embedMode: embedMode, promptsIsEnabled: promptsIsEnabled, studyMode: studyMode, memoryEnabled: mentorSettings.data.memoryEnabled, mentorId: mentorId, tenantKey: tenantKey, username: username })), jsxs("div", { className: "ml-auto flex", children: [visibleToLoggedInUsersOnly && !compactMode && (jsx(ScreenSharingButton, { onClick: onScreenSharingClick, isScreenSharingModalOpen: isScreenSharingModalOpen, screenSharing: screenSharing, isPreviewMode: isPreviewMode, disabled: isChatDisabledByRbac })), visibleToLoggedInUsersOnly && !compactMode && (jsx(VoiceChatButton, { isPreviewMode: isPreviewMode, handleMicrophoneBtnClick: () => executeWithTrialCheck(handleMicrophoneBtnClick), processing: processing, recording: recording, disabled: isChatDisabledByRbac, mentorId: mentorId, tenantKey: tenantKey, isPublicRoute: isPublicRoute })), visibleToLoggedInUsersOnly && !compactMode && (jsx(VoiceCallButton, { isPreviewMode: isPreviewMode, onClick: () => executeWithTrialCheck(onPhoneCallClick), disabled: isChatDisabledByRbac, mentorId: mentorId, tenantKey: tenantKey, isPublicRoute: isPublicRoute })), isStreaming ? (jsx(StopStreamingButton, { ref: stopStreamingButtonRef, stopGenerating: stopGenerating })) : (jsx(SubmitMessageButton, { isPreviewMode: isPreviewMode, allowAnonymousAccess: isMentorViewableByAnyone, isUploading: hasUploadingFiles, disabled: isChatDisabledByRbac || !sessionId, isConnecting: isConnecting }))] })] })] }), jsx("input", { type: "file", ref: fileUploadInputRef, className: "hidden", onChange: handleFileInputChange, accept: fileUploadCapabilities.allSupportedTypes.length > 0
|
|
215288
215256
|
? fileUploadCapabilities.allSupportedTypes.join(',')
|
|
215289
215257
|
: MENTOR_CHAT_DOCUMENTS_EXTENSIONS.join(','), multiple: true, disabled: isChatDisabledByRbac || !sessionId })] }), visibleToLoggedInUsersOnly && !compactMode && (jsx("div", { className: "flex w-full justify-center", children: jsx(OutsideButtons, { activeOptions: activeTools, onOptionClick: updateSessionTools, setSessionTools: setSessionTools, onCrossClick: updateSessionTools, containerWidth: containerWidth, enableWebBrowsing: enableWebBrowsing, imageGeneration: imageGeneration, codeInterpreter: codeInterpreter, googleSlidesIsEnabled: googleSlidesIsEnabled, googleDocumentIsEnabled: googleDocumentIsEnabled, tenantKey: tenantKey, userId: username, disabled: isChatDisabledByRbac }) }))] }), isPromptGalleryOpen && (jsx(PromptGalleryModal$1, { isOpen: isPromptGalleryOpen, onClose: () => setIsPromptGalleryOpen(false), onSelectPrompt: handleSelectPrompt, mentorId: mentorId, tenantKey: tenantKey, userIsStudent: userIsStudent })), isFreeTrialModalOpen && FreeTrialDialog && (jsx(FreeTrialDialog, { isOpen: isFreeTrialModalOpen, onClose: closeFreeTrialModal }))] }));
|
|
215290
215258
|
}
|
|
215291
215259
|
|
|
215292
|
-
function LoadingMessage({ mentorName, profileImage
|
|
215260
|
+
function LoadingMessage({ mentorName, profileImage }) {
|
|
215293
215261
|
return (jsx("div", { className: "mb-4", children: jsxs("div", { className: "ml-0 flex items-center", children: [jsxs("div", { className: "relative mr-2 flex-shrink-0 sm:mr-3", children: [jsx("div", { className: "absolute inset-0 animate-spin rounded-full border-2 border-gray-300 border-t-blue-500" }), jsxs(Avatar, { className: "h-7 w-7 rounded-full border border-transparent p-[1px] sm:h-8 sm:w-8", children: [jsx(AvatarImage, { src: profileImage, alt: mentorName }), jsx(AvatarFallback, { children: mentorName.substring(0, 2).toUpperCase() })] })] }), jsx("span", { className: "text-sm text-gray-700", children: "Just a sec..." })] }) }));
|
|
215294
215262
|
}
|
|
215295
215263
|
|
|
215296
|
-
function AdvancedChatHeader({ tabs, activeTab, setActiveTab, isTyping
|
|
215264
|
+
function AdvancedChatHeader({ tabs, activeTab, setActiveTab, isTyping }) {
|
|
215297
215265
|
return (jsx(Fragment$1, { children: jsx("div", { className: "flex border-b border-gray-200", children: tabs.map((tab) => (jsx("button", { type: "button", onClick: () => {
|
|
215298
215266
|
if (isTyping) {
|
|
215299
215267
|
toast.error('You cannot switch tabs while streaming');
|
|
@@ -215370,8 +215338,7 @@ const pulseAnimations = `
|
|
|
215370
215338
|
}
|
|
215371
215339
|
`;
|
|
215372
215340
|
function VoiceChatModal({ isOpen, onClose, toggleMute, isMuted, connectionState, isSpeaking, }) {
|
|
215373
|
-
const isLoading = connectionState === 'requesting-permission' ||
|
|
215374
|
-
connectionState === 'connecting';
|
|
215341
|
+
const isLoading = connectionState === 'requesting-permission' || connectionState === 'connecting';
|
|
215375
215342
|
const isConnected = connectionState === 'connected';
|
|
215376
215343
|
const shouldAnimate = isConnected && !isMuted;
|
|
215377
215344
|
const loadingMessage = isLoading
|
|
@@ -215400,11 +215367,7 @@ function VoiceChatModal({ isOpen, onClose, toggleMute, isMuted, connectionState,
|
|
|
215400
215367
|
'soundWave5',
|
|
215401
215368
|
].map((animName, i) => (jsx("div", { className: "w-1 transform-gpu rounded-full bg-white", style: {
|
|
215402
215369
|
height: shouldAnimate ? '30px' : '12px',
|
|
215403
|
-
opacity: shouldAnimate
|
|
215404
|
-
? isSpeaking
|
|
215405
|
-
? 1
|
|
215406
|
-
: 0.7
|
|
215407
|
-
: 0.5,
|
|
215370
|
+
opacity: shouldAnimate ? (isSpeaking ? 1 : 0.7) : 0.5,
|
|
215408
215371
|
animation: shouldAnimate
|
|
215409
215372
|
? `${animName} ${isSpeaking ? 0.8 + i * 0.15 : 1.2 + i * 0.2}s ease-in-out infinite`
|
|
215410
215373
|
: 'none',
|
|
@@ -216006,7 +215969,7 @@ function AIMessageSpeak({ content }) {
|
|
|
216006
215969
|
window.speechSynthesis.speak(utterance);
|
|
216007
215970
|
};
|
|
216008
215971
|
const label = isSpeaking ? 'Stop Reading Aloud' : 'Read Aloud';
|
|
216009
|
-
return (jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsxs("button", { onClick: handleToggle, "aria-label": label, "aria-pressed": isSpeaking, className: "-ml-1 text-gray-500 hover:text-gray-700", children: [jsx("span", { className: "sr-only", children: label }), isSpeaking ?
|
|
215972
|
+
return (jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsxs("button", { onClick: handleToggle, "aria-label": label, "aria-pressed": isSpeaking, className: "-ml-1 text-gray-500 hover:text-gray-700", children: [jsx("span", { className: "sr-only", children: label }), isSpeaking ? jsx(CircleStop, { className: "h-4 w-4" }) : jsx(Volume2, { className: "h-4 w-4" })] }) }), jsx(TooltipContent, { className: "ibl-tooltip-content", children: label })] }));
|
|
216010
215973
|
}
|
|
216011
215974
|
|
|
216012
215975
|
function getUserMessageBeforeCurrentId(messages, currentId) {
|
|
@@ -216025,7 +215988,7 @@ const RATING = {
|
|
|
216025
215988
|
GOOD: 1,
|
|
216026
215989
|
BAD: -1,
|
|
216027
215990
|
};
|
|
216028
|
-
function AIMessageRating({ content, messages, mentorId, sessionId, tenantKey
|
|
215991
|
+
function AIMessageRating({ content, messages, mentorId, sessionId, tenantKey }) {
|
|
216029
215992
|
const [rating, setRating] = React__default.useState(null);
|
|
216030
215993
|
const username = useUsername();
|
|
216031
215994
|
const [updateMessageFeedback, { isLoading }] = useUpdateMessageFeedbackMutation();
|
|
@@ -216071,7 +216034,7 @@ function formatConversationForEmail(messages) {
|
|
|
216071
216034
|
.map((msg) => `[${msg.role === 'user' ? 'User' : 'AI'}]: ${msg.content}`)
|
|
216072
216035
|
.join('\n\n');
|
|
216073
216036
|
}
|
|
216074
|
-
function AIMessageReportInappropriateContent({ mentorName, messages, supportEmail
|
|
216037
|
+
function AIMessageReportInappropriateContent({ mentorName, messages, supportEmail }) {
|
|
216075
216038
|
const toEmail = supportEmail || DEFAULT_SUPPORT_EMAIL;
|
|
216076
216039
|
const subject = `Report Inappropriate Content — ${mentorName}`;
|
|
216077
216040
|
const body = `I would like to report inappropriate content from the following conversation:\n\n---\n${formatConversationForEmail(messages)}\n---\n\nAdditional comments:\n\n-`;
|
|
@@ -216184,17 +216147,13 @@ const buildSnippet = (content, maxLength = 150) => {
|
|
|
216184
216147
|
function MessagePreview({ content, artifactVersions, onOpenCanvas, streamingArtifactId, }) {
|
|
216185
216148
|
var _a, _b;
|
|
216186
216149
|
const currentArtifact = useMemo(() => getCurrentArtifactVersion(artifactVersions), [artifactVersions]);
|
|
216187
|
-
const fallbackVersion = artifactVersions && artifactVersions.length > 0
|
|
216188
|
-
? artifactVersions[0]
|
|
216189
|
-
: null;
|
|
216150
|
+
const fallbackVersion = artifactVersions && artifactVersions.length > 0 ? artifactVersions[0] : null;
|
|
216190
216151
|
const selectedVersion = currentArtifact !== null && currentArtifact !== void 0 ? currentArtifact : fallbackVersion;
|
|
216191
216152
|
const [displayTitle, setDisplayTitle] = useState(null);
|
|
216192
216153
|
const artifactId = (_a = selectedVersion === null || selectedVersion === void 0 ? void 0 : selectedVersion.artifact) === null || _a === void 0 ? void 0 : _a.id;
|
|
216193
216154
|
useEffect(() => {
|
|
216194
216155
|
var _a;
|
|
216195
|
-
const nextTitle = (selectedVersion === null || selectedVersion === void 0 ? void 0 : selectedVersion.title) ||
|
|
216196
|
-
((_a = selectedVersion === null || selectedVersion === void 0 ? void 0 : selectedVersion.artifact) === null || _a === void 0 ? void 0 : _a.title) ||
|
|
216197
|
-
'Untitled Artifact';
|
|
216156
|
+
const nextTitle = (selectedVersion === null || selectedVersion === void 0 ? void 0 : selectedVersion.title) || ((_a = selectedVersion === null || selectedVersion === void 0 ? void 0 : selectedVersion.artifact) === null || _a === void 0 ? void 0 : _a.title) || 'Untitled Artifact';
|
|
216198
216157
|
setDisplayTitle(nextTitle);
|
|
216199
216158
|
}, [selectedVersion === null || selectedVersion === void 0 ? void 0 : selectedVersion.title, (_b = selectedVersion === null || selectedVersion === void 0 ? void 0 : selectedVersion.artifact) === null || _b === void 0 ? void 0 : _b.title]);
|
|
216200
216159
|
useEffect(() => {
|
|
@@ -216267,9 +216226,7 @@ const AIMessageBubble = forwardRef(function AIMessageBubble({ content, profileIm
|
|
|
216267
216226
|
});
|
|
216268
216227
|
const isMentorInappropriateContentEnabled = (tenantMetadata === null || tenantMetadata === void 0 ? void 0 : tenantMetadata.mentor_report_inappropriate_content) !== false;
|
|
216269
216228
|
const supportEmail = (tenantMetadata === null || tenantMetadata === void 0 ? void 0 : tenantMetadata.support_email) || defaultSupportEmail;
|
|
216270
|
-
return (jsx(TooltipProvider, { children: jsx("div", { className: "mb-4", children: jsxs("div", { className: "ml-0 flex items-start", children: [jsx("div", { className: "mr-2 flex-shrink-0 sm:mr-3", children: jsxs(Avatar, { className: "h-7 w-7 rounded-full border border-gray-200 p-[1px] sm:h-8 sm:w-8", children: [jsx(AvatarImage, { src: profileImage, alt: mentorName }), jsx(AvatarFallback, { children: mentorName.substring(0, 2).toUpperCase() })] }) }), jsxs("div", { className: "min-w-0 flex-1", children: [jsxs("div", { className: "mb-1 flex items-center", children: [jsx("span", { className: "mr-2 text-sm font-medium text-gray-900", children: mentorName }), jsx("span", { className: "text-xs text-gray-500", children: timestamp })] }), jsxs("div", { className: cn('mb-1.5 rounded-2xl bg-gray-100 p-3 wrap-anywhere', CSS_CLASS_NAMES.CHAT.AI_MESSAGE_RESPONSE, hasArtifactVersions(message) && 'bg-white p-0'), children: [jsx("div", { className: "overflow-x-auto text-sm/6 text-gray-800 [&_.katex-display]:overflow-x-auto [&_.katex-display]:overflow-y-hidden [&_code]:rounded [&_code]:bg-gray-200 [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_em]:italic [&_li]:mb-1 [&_ol]:list-decimal [&_ol]:pl-4 [&_pre]:overflow-x-auto [&_pre]:rounded [&_pre]:bg-gray-200 [&_pre]:p-2 [&_strong]:font-bold [&_ul]:list-disc [&_ul]:pl-4", children: jsx(MessagePreview, { content: content, artifactVersions: message === null || message === void 0 ? void 0 : message.artifactVersions, onOpenCanvas: onOpenCanvas, streamingArtifactId: streamingArtifactId }) }), (message === null || message === void 0 ? void 0 : message.actions) && (jsx("div", { className: "flex flex-wrap", children: message.actions.map((action, index) => (jsx(Button$1, { onClick: buildActionCallback(action.actionType, authUrl), className: "ibl-button-primary cursor-pointer", children: action.text }, index))) }))] }), jsxs("div", { className: "flex items-center space-x-4", children: [jsx(AIMessageCopy, { ref: ref, content: content }), isLoggedIn() && !showingSharedChat && (jsx(AIMessageRating, { content: content, messages: messages, sessionId: sessionId, mentorId: mentorId, tenantKey: tenantKey })), isLoggedIn() && !showingSharedChat && (jsx(AIMessageShare, { sessionId: sessionId, tenantKey: tenantKey })), isLoggedIn() &&
|
|
216271
|
-
!showingSharedChat &&
|
|
216272
|
-
isMentorInappropriateContentEnabled && (jsx(AIMessageReportInappropriateContent, { mentorName: mentorName, messages: messages, supportEmail: supportEmail })), jsx(AIMessageSpeak, { content: content }), isLoggedIn() && !showingSharedChat && (jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsxs("button", { onClick: () => {
|
|
216229
|
+
return (jsx(TooltipProvider, { children: jsx("div", { className: "mb-4", children: jsxs("div", { className: "ml-0 flex items-start", children: [jsx("div", { className: "mr-2 flex-shrink-0 sm:mr-3", children: jsxs(Avatar, { className: "h-7 w-7 rounded-full border border-gray-200 p-[1px] sm:h-8 sm:w-8", children: [jsx(AvatarImage, { src: profileImage, alt: mentorName }), jsx(AvatarFallback, { children: mentorName.substring(0, 2).toUpperCase() })] }) }), jsxs("div", { className: "min-w-0 flex-1", children: [jsxs("div", { className: "mb-1 flex items-center", children: [jsx("span", { className: "mr-2 text-sm font-medium text-gray-900", children: mentorName }), jsx("span", { className: "text-xs text-gray-500", children: timestamp })] }), jsxs("div", { className: cn('mb-1.5 rounded-2xl bg-gray-100 p-3 wrap-anywhere', CSS_CLASS_NAMES.CHAT.AI_MESSAGE_RESPONSE, hasArtifactVersions(message) && 'bg-white p-0'), children: [jsx("div", { className: "overflow-x-auto text-sm/6 text-gray-800 [&_.katex-display]:overflow-x-auto [&_.katex-display]:overflow-y-hidden [&_code]:rounded [&_code]:bg-gray-200 [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_em]:italic [&_li]:mb-1 [&_ol]:list-decimal [&_ol]:pl-4 [&_pre]:overflow-x-auto [&_pre]:rounded [&_pre]:bg-gray-200 [&_pre]:p-2 [&_strong]:font-bold [&_ul]:list-disc [&_ul]:pl-4", children: jsx(MessagePreview, { content: content, artifactVersions: message === null || message === void 0 ? void 0 : message.artifactVersions, onOpenCanvas: onOpenCanvas, streamingArtifactId: streamingArtifactId }) }), (message === null || message === void 0 ? void 0 : message.actions) && (jsx("div", { className: "flex flex-wrap", children: message.actions.map((action, index) => (jsx(Button$1, { onClick: buildActionCallback(action.actionType, authUrl), className: "ibl-button-primary cursor-pointer", children: action.text }, index))) }))] }), jsxs("div", { className: "flex items-center space-x-4", children: [jsx(AIMessageCopy, { ref: ref, content: content }), isLoggedIn() && !showingSharedChat && (jsx(AIMessageRating, { content: content, messages: messages, sessionId: sessionId, mentorId: mentorId, tenantKey: tenantKey })), isLoggedIn() && !showingSharedChat && (jsx(AIMessageShare, { sessionId: sessionId, tenantKey: tenantKey })), isLoggedIn() && !showingSharedChat && isMentorInappropriateContentEnabled && (jsx(AIMessageReportInappropriateContent, { mentorName: mentorName, messages: messages, supportEmail: supportEmail })), jsx(AIMessageSpeak, { content: content }), isLoggedIn() && !showingSharedChat && (jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsxs("button", { onClick: () => {
|
|
216273
216230
|
const lastUserMessage = getLastUserMessage(messages);
|
|
216274
216231
|
if (lastUserMessage) {
|
|
216275
216232
|
onRetry(lastUserMessage.content);
|
|
@@ -216295,14 +216252,10 @@ function FileCard({ fileName, fileType }) {
|
|
|
216295
216252
|
else if (type.includes('video')) {
|
|
216296
216253
|
return jsx(FileVideo, { className: "h-5 w-5 text-blue-500" });
|
|
216297
216254
|
}
|
|
216298
|
-
else if (type.includes('spreadsheet') ||
|
|
216299
|
-
type.includes('excel') ||
|
|
216300
|
-
type.includes('csv')) {
|
|
216255
|
+
else if (type.includes('spreadsheet') || type.includes('excel') || type.includes('csv')) {
|
|
216301
216256
|
return jsx(FileSpreadsheet, { className: "h-5 w-5 text-blue-500" });
|
|
216302
216257
|
}
|
|
216303
|
-
else if (type.includes('zip') ||
|
|
216304
|
-
type.includes('compressed') ||
|
|
216305
|
-
type.includes('archive')) {
|
|
216258
|
+
else if (type.includes('zip') || type.includes('compressed') || type.includes('archive')) {
|
|
216306
216259
|
return jsx(FileArchive, { className: "h-5 w-5 text-blue-500" });
|
|
216307
216260
|
}
|
|
216308
216261
|
else if (type.includes('javascript') ||
|
|
@@ -216334,19 +216287,7 @@ function FileCard({ fileName, fileType }) {
|
|
|
216334
216287
|
else if (['zip', 'rar', '7z', 'tar', 'gz'].includes(extension)) {
|
|
216335
216288
|
return jsx(FileArchive, { className: "h-5 w-5 text-blue-500" });
|
|
216336
216289
|
}
|
|
216337
|
-
else if ([
|
|
216338
|
-
'js',
|
|
216339
|
-
'ts',
|
|
216340
|
-
'jsx',
|
|
216341
|
-
'tsx',
|
|
216342
|
-
'html',
|
|
216343
|
-
'css',
|
|
216344
|
-
'json',
|
|
216345
|
-
'py',
|
|
216346
|
-
'java',
|
|
216347
|
-
'c',
|
|
216348
|
-
'cpp',
|
|
216349
|
-
].includes(extension)) {
|
|
216290
|
+
else if (['js', 'ts', 'jsx', 'tsx', 'html', 'css', 'json', 'py', 'java', 'c', 'cpp'].includes(extension)) {
|
|
216350
216291
|
return jsx(FileCode, { className: "h-5 w-5 text-blue-500" });
|
|
216351
216292
|
}
|
|
216352
216293
|
// Default icon
|
|
@@ -216373,11 +216314,7 @@ function UserMessageBubble({ message, isHighlighted, profileImage, mentorName, m
|
|
|
216373
216314
|
}
|
|
216374
216315
|
}) })), !message.fileAttachments && message.url && message.fileType && (jsx("div", { className: "flex flex-col items-end", children: message.fileType.startsWith('image/') ? (jsx(ImageMessage, { url: message.url, fileName: message.content, setPreviewImage: onPreviewImage }, message.id)) : (jsx(FileCard, { fileName: message.content, fileType: message.fileType }, message.id)) })), message.replyTo && (jsxs("div", { className: "mb-2 max-w-full cursor-pointer overflow-hidden rounded-2xl border border-gray-100 shadow-sm", onClick: () => {
|
|
216375
216316
|
// Find the index of the original message
|
|
216376
|
-
const originalMessageIndex = messages.findIndex((m) => {
|
|
216377
|
-
var _a, _b;
|
|
216378
|
-
return m.role === ((_a = message.replyTo) === null || _a === void 0 ? void 0 : _a.role) &&
|
|
216379
|
-
m.content === ((_b = message.replyTo) === null || _b === void 0 ? void 0 : _b.content);
|
|
216380
|
-
});
|
|
216317
|
+
const originalMessageIndex = messages.findIndex((m) => { var _a, _b; return m.role === ((_a = message.replyTo) === null || _a === void 0 ? void 0 : _a.role) && m.content === ((_b = message.replyTo) === null || _b === void 0 ? void 0 : _b.content); });
|
|
216381
216318
|
if (originalMessageIndex !== -1) {
|
|
216382
216319
|
onHighlightMessage(originalMessageIndex);
|
|
216383
216320
|
// Scroll to the original message if needed
|
|
@@ -216431,11 +216368,7 @@ function AdvancedStaticChatBuilder({ activeTab, profileImage, mentorName, sendMe
|
|
|
216431
216368
|
const [promptsData, setPromptsData] = useState([]);
|
|
216432
216369
|
const handleFetchPromptData = async () => {
|
|
216433
216370
|
var _a, _b, _c;
|
|
216434
|
-
if (!tenantKey ||
|
|
216435
|
-
false ||
|
|
216436
|
-
!isChatTabActive ||
|
|
216437
|
-
!mentorUniqueId ||
|
|
216438
|
-
!sessionId)
|
|
216371
|
+
if (!tenantKey || false || !isChatTabActive || !mentorUniqueId || !sessionId)
|
|
216439
216372
|
return;
|
|
216440
216373
|
try {
|
|
216441
216374
|
const suggestedPrompts = await triggerGetPromptsSearch({
|
|
@@ -218350,7 +218283,7 @@ function LiveKitScreenSharing({ tenantKey, mentorUniqueId, sessionId, username,
|
|
|
218350
218283
|
return (jsxs(RoomContext.Provider, { value: room, children: [jsx(VideoConference, { className: "hidden", chatMessageFormatter: formatChatMessageLinks }), jsx(ChatRelay, {}), jsx(TranscriptionRelay, {})] }));
|
|
218351
218284
|
}
|
|
218352
218285
|
|
|
218353
|
-
function AppSyncBanner({ badge, text, link, linkText
|
|
218286
|
+
function AppSyncBanner({ badge, text, link, linkText }) {
|
|
218354
218287
|
return (jsx("div", { className: "mx-auto mb-8 w-full max-w-md", children: jsxs("div", { className: "flex items-center justify-between rounded-lg border border-[#D0E0FF] bg-[#F5F8FF] p-2", children: [jsxs("div", { className: "flex items-center gap-2", children: [jsx("span", { className: "rounded-md bg-[#D0E0FF] px-2 py-0.5 text-xs font-medium text-[#666768]", children: badge }), jsx("span", { className: "text-sm font-medium text-gray-900", children: text })] }), jsxs(Link$2, { href: link, target: "_blank", className: cn(buttonVariants({
|
|
218355
218288
|
variant: 'ghost',
|
|
218356
218289
|
size: 'sm',
|
|
@@ -218417,9 +218350,7 @@ function ConversationStarters({ onTemplateSelect, enabledGuidedPrompts, sessionI
|
|
|
218417
218350
|
// Check if user has chat permission via RBAC
|
|
218418
218351
|
const mentorDbId = (_a = mentorSettings === null || mentorSettings === void 0 ? void 0 : mentorSettings.data) === null || _a === void 0 ? void 0 : _a.mentorDbId;
|
|
218419
218352
|
const mentorRbacKey = mentorDbId ? `/mentors/${mentorDbId}/` : null;
|
|
218420
|
-
const hasMentorRbacData = mentorRbacKey
|
|
218421
|
-
? mentorRbacKey in rbacPermissions
|
|
218422
|
-
: false;
|
|
218353
|
+
const hasMentorRbacData = mentorRbacKey ? mentorRbacKey in rbacPermissions : false;
|
|
218423
218354
|
const hasChatPermission = mentorDbId && hasMentorRbacData
|
|
218424
218355
|
? checkRbacPermission(rbacPermissions, `/mentors/${mentorDbId}/#chat`)
|
|
218425
218356
|
: true; // Default to true if mentor ID not available or RBAC data not loaded
|
|
@@ -218462,7 +218393,7 @@ function WelcomeMessage({ aiWelcomeMessage, sessionId, username, tenantKey, ment
|
|
|
218462
218393
|
isNewSession,
|
|
218463
218394
|
isPublicRoute,
|
|
218464
218395
|
});
|
|
218465
|
-
return
|
|
218396
|
+
return jsx(Markdown, { className: className, children: welcomeMessage || aiWelcomeMessage || '' });
|
|
218466
218397
|
}
|
|
218467
218398
|
|
|
218468
218399
|
function WelcomeChat({ onPromptSelect, mentorName, profileImage, enabledGuidedPrompts, sessionId, mentorId, tenantKey, mentorUniqueId, welcomeWsUrl, isPublicRoute, isNewSession = true, aiWelcomeMessage = '', }) {
|
|
@@ -218482,11 +218413,7 @@ function WelcomeChat({ onPromptSelect, mentorName, profileImage, enabledGuidedPr
|
|
|
218482
218413
|
// @ts-ignore
|
|
218483
218414
|
userId: realUsername,
|
|
218484
218415
|
}, {
|
|
218485
|
-
skip: isSuggestedPrompts ||
|
|
218486
|
-
!enabledGuidedPrompts ||
|
|
218487
|
-
!tenantKey ||
|
|
218488
|
-
!sessionId ||
|
|
218489
|
-
!realUsername,
|
|
218416
|
+
skip: isSuggestedPrompts || !enabledGuidedPrompts || !tenantKey || !sessionId || !realUsername,
|
|
218490
218417
|
});
|
|
218491
218418
|
const { data: suggestedPrompts } = useGetPromptsSearchQuery({
|
|
218492
218419
|
org: tenantKey,
|
|
@@ -218599,13 +218526,7 @@ function ProjectActionButtonsInner({ onFilesClick, onInstructionsClick, instruct
|
|
|
218599
218526
|
e.preventDefault();
|
|
218600
218527
|
onInstructionsClick();
|
|
218601
218528
|
}
|
|
218602
|
-
}, tabIndex: 0, role: "button", "aria-label": instructions
|
|
218603
|
-
? 'Edit project instructions'
|
|
218604
|
-
: 'Add project instructions', children: jsx("div", { className: "flex items-start gap-4", children: jsxs("div", { className: "flex-1", children: [jsx("h3", { className: "mb-1 font-semibold text-gray-900", children: instructions
|
|
218605
|
-
? 'Project Instructions'
|
|
218606
|
-
: 'Add project instructions' }), jsx("p", { className: "line-clamp-2 text-sm text-gray-600", children: instructions
|
|
218607
|
-
? instructions
|
|
218608
|
-
: 'Tailor the way the agent responds in this project' })] }) }) })] }) }));
|
|
218529
|
+
}, tabIndex: 0, role: "button", "aria-label": instructions ? 'Edit project instructions' : 'Add project instructions', children: jsx("div", { className: "flex items-start gap-4", children: jsxs("div", { className: "flex-1", children: [jsx("h3", { className: "mb-1 font-semibold text-gray-900", children: instructions ? 'Project Instructions' : 'Add project instructions' }), jsx("p", { className: "line-clamp-2 text-sm text-gray-600", children: instructions ? instructions : 'Tailor the way the agent responds in this project' })] }) }) })] }) }));
|
|
218609
218530
|
}
|
|
218610
218531
|
|
|
218611
218532
|
const ProjectInstructionsModal$1 = dynamic(() => Promise.resolve().then(function () { return projectInstructionsModal; }).then((mod) => mod.ProjectInstructionsModal), { ssr: false });
|
|
@@ -218664,9 +218585,7 @@ const ToastErrorMessage = ({ message, supportEmail, tenantKey, }) => {
|
|
|
218664
218585
|
console.error(JSON.stringify({ tenant: tenantKey, error: message }));
|
|
218665
218586
|
}, [message]);
|
|
218666
218587
|
const plainMessage = markdownToPlainText(message);
|
|
218667
|
-
return (jsx("div", { children: jsxs("span", { children: ["Sorry about that!",
|
|
218668
|
-
? plainMessage
|
|
218669
|
-
: `${plainMessage}.`, ' ', "Please try again or", ' ', jsx("a", { className: "toast-wrapped-contact-tag text-blue-600 hover:text-blue-800", href: `mailto:${supportEmail}`, children: "contact us" }), "."] }) }));
|
|
218588
|
+
return (jsx("div", { children: jsxs("span", { children: ["Sorry about that! ", String(plainMessage).match(/[.!?]$/) ? plainMessage : `${plainMessage}.`, ' ', "Please try again or", ' ', jsx("a", { className: "toast-wrapped-contact-tag text-blue-600 hover:text-blue-800", href: `mailto:${supportEmail}`, children: "contact us" }), "."] }) }));
|
|
218670
218589
|
};
|
|
218671
218590
|
|
|
218672
218591
|
/* istanbul ignore next -- @preserve dynamic import */
|
|
@@ -220908,7 +220827,7 @@ const defaultValues = {
|
|
|
220908
220827
|
prompt: '',
|
|
220909
220828
|
promptVisibility: PromptVisibilityEnum.VIEWABLE_BY_TENANT_STUDENTS,
|
|
220910
220829
|
};
|
|
220911
|
-
function AddPromptModal({ isOpen, onClose, mentorId, tenantKey
|
|
220830
|
+
function AddPromptModal({ isOpen, onClose, mentorId, tenantKey }) {
|
|
220912
220831
|
const username = useUsername();
|
|
220913
220832
|
const { executeWithTrialCheck, isModalOpen, FreeTrialDialog, closeModal } = useShowFreeTrialDialog();
|
|
220914
220833
|
const { data: promptCategories, isLoading: isLoadingPromptCategories } = useGetPromptCategoriesQuery({
|
|
@@ -221014,7 +220933,7 @@ function EditPromptModal({ isOpen, onClose, selectedPrompt, handleSave, isEditin
|
|
|
221014
220933
|
} })] }), jsx(DialogFooter, { children: jsx("div", { className: "flex justify-end gap-2 pt-4", children: jsx(form.Subscribe, { selector: (state) => ({ isFormValue: state.canSubmit }), children: ({ isFormValue }) => (jsx(Button$1, { type: "submit", className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] text-white hover:opacity-90", disabled: isDisabled || !isFormValue, children: isEditing ? 'Saving...' : 'Save' })) }) }) })] }) }) }), isModalOpen && FreeTrialDialog && (jsx(FreeTrialDialog, { isOpen: isModalOpen, onClose: closeModal }))] }));
|
|
221015
220934
|
}
|
|
221016
220935
|
|
|
221017
|
-
function PromptCard({ prompt, onEdit, onSelect, title, tenantKey, userIsStudent
|
|
220936
|
+
function PromptCard({ prompt, onEdit, onSelect, title, tenantKey, userIsStudent }) {
|
|
221018
220937
|
const { copy, status } = useCopyToClipboard(700);
|
|
221019
220938
|
const [deletePrompt, { isLoading: isDeleting }] = useDeletePromptMutation();
|
|
221020
220939
|
const { executeWithTrialCheck, FreeTrialDialog, closeModal, isModalOpen } = useShowFreeTrialDialog();
|
|
@@ -221190,7 +221109,7 @@ var imagePreviewModal = /*#__PURE__*/Object.freeze({
|
|
|
221190
221109
|
ImagePreviewModal: ImagePreviewModal
|
|
221191
221110
|
});
|
|
221192
221111
|
|
|
221193
|
-
function MinimumMentorAlert({ open, onOpenChange
|
|
221112
|
+
function MinimumMentorAlert({ open, onOpenChange }) {
|
|
221194
221113
|
return (jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: jsxs(DialogContent, { className: "space-y-1", children: [jsxs(DialogHeader, { children: [jsx(DialogTitle, { className: "mb-4", children: "Cannot Remove Agent" }), jsx(DialogDescription, { children: "A project must have at least one agent. Please add another agent before removing this one." })] }), jsx(DialogFooter, { children: jsx(Button$1, { onClick: () => onOpenChange(false), className: "ibl-button-primary", children: "Cancel" }) })] }) }));
|
|
221195
221114
|
}
|
|
221196
221115
|
|
|
@@ -241936,10 +241855,7 @@ const MathBlock = Node3.create({
|
|
|
241936
241855
|
];
|
|
241937
241856
|
},
|
|
241938
241857
|
renderHTML({ node }) {
|
|
241939
|
-
return [
|
|
241940
|
-
'span',
|
|
241941
|
-
{ 'data-math-latex': node.attrs.latex, 'data-math-display': 'true' },
|
|
241942
|
-
];
|
|
241858
|
+
return ['span', { 'data-math-latex': node.attrs.latex, 'data-math-display': 'true' }];
|
|
241943
241859
|
},
|
|
241944
241860
|
addNodeView() {
|
|
241945
241861
|
return ({ node }) => {
|
|
@@ -241987,7 +241903,7 @@ const isHtml = (str) => {
|
|
|
241987
241903
|
HTML_TAG_REGEX.test(trimmed));
|
|
241988
241904
|
};
|
|
241989
241905
|
// Toolbar component that matches the reference but styled for canvas header
|
|
241990
|
-
function CanvasRichTextEditorToolbar({ editor
|
|
241906
|
+
function CanvasRichTextEditorToolbar({ editor }) {
|
|
241991
241907
|
const [canUndo, setCanUndo] = useState(false);
|
|
241992
241908
|
const [canRedo, setCanRedo] = useState(false);
|
|
241993
241909
|
const [isMobile, setIsMobile] = useState(false);
|
|
@@ -242018,9 +241934,7 @@ function CanvasRichTextEditorToolbar({ editor, }) {
|
|
|
242018
241934
|
const isProgrammatic = transaction.getMeta('addToHistory') === false ||
|
|
242019
241935
|
transaction.getMeta('preventUpdate') === true;
|
|
242020
241936
|
// If it's not programmatic, has steps, and editor is editable, it's a user edit
|
|
242021
|
-
if (!isProgrammatic &&
|
|
242022
|
-
transaction.steps.length > 0 &&
|
|
242023
|
-
editor.isEditable) {
|
|
241937
|
+
if (!isProgrammatic && transaction.steps.length > 0 && editor.isEditable) {
|
|
242024
241938
|
editor.__hasUserEdited = true;
|
|
242025
241939
|
}
|
|
242026
241940
|
};
|
|
@@ -242115,34 +242029,18 @@ function CanvasRichTextEditorToolbar({ editor, }) {
|
|
|
242115
242029
|
},
|
|
242116
242030
|
];
|
|
242117
242031
|
return (jsxs("div", { ref: containerRef, className: "flex items-center gap-0.5", children: [jsx(Button$1, { variant: "ghost", size: "sm", className: "h-8 w-8 p-0", onClick: () => {
|
|
242118
|
-
editor
|
|
242119
|
-
.chain()
|
|
242120
|
-
.focus(undefined, { scrollIntoView: false })
|
|
242121
|
-
.undo()
|
|
242122
|
-
.run();
|
|
242032
|
+
editor.chain().focus(undefined, { scrollIntoView: false }).undo().run();
|
|
242123
242033
|
}, disabled: !canUndo, "aria-label": "Undo", children: jsx(Undo2, { className: "h-4 w-4 text-gray-600" }) }), jsx(Button$1, { variant: "ghost", size: "sm", className: "h-8 w-8 p-0", onClick: () => {
|
|
242124
|
-
editor
|
|
242125
|
-
|
|
242126
|
-
.focus(undefined, { scrollIntoView: false })
|
|
242127
|
-
.redo()
|
|
242128
|
-
.run();
|
|
242129
|
-
}, disabled: !canRedo, "aria-label": "Redo", children: jsx(Redo2, { className: "h-4 w-4 text-gray-600" }) }), jsx("div", { className: "mx-0.5 h-4 w-px bg-gray-300" }), jsxs(DropdownMenu, { children: [jsx(DropdownMenuTrigger, { asChild: true, children: jsx(Button$1, { variant: "ghost", size: "sm", className: "h-8 w-8 p-0", "aria-label": "More formatting options", children: jsx(Ellipsis, { className: "h-4 w-4 text-gray-600" }) }) }), jsx(DropdownMenuContent, { align: "end", className: "w-48", children: toolbarItems.map((item, index) => (jsxs(React__default.Fragment, { children: [(index === 3 || index === 6) && jsx(DropdownMenuSeparator, {}), jsx(DropdownMenuItem, { onClick: item.action, className: item.isActive ? 'bg-accent' : '', children: jsxs("div", { className: "flex w-full items-center gap-2", children: [jsx("span", { className: item.isActive ? 'text-primary' : 'text-gray-600', children: item.icon }), jsx("span", { className: "flex-1", children: item.name }), item.isActive && (jsx("span", { className: "bg-primary h-2 w-2 rounded-full" }))] }) })] }, item.name))) })] })] }));
|
|
242034
|
+
editor.chain().focus(undefined, { scrollIntoView: false }).redo().run();
|
|
242035
|
+
}, disabled: !canRedo, "aria-label": "Redo", children: jsx(Redo2, { className: "h-4 w-4 text-gray-600" }) }), jsx("div", { className: "mx-0.5 h-4 w-px bg-gray-300" }), jsxs(DropdownMenu, { children: [jsx(DropdownMenuTrigger, { asChild: true, children: jsx(Button$1, { variant: "ghost", size: "sm", className: "h-8 w-8 p-0", "aria-label": "More formatting options", children: jsx(Ellipsis, { className: "h-4 w-4 text-gray-600" }) }) }), jsx(DropdownMenuContent, { align: "end", className: "w-48", children: toolbarItems.map((item, index) => (jsxs(React__default.Fragment, { children: [(index === 3 || index === 6) && jsx(DropdownMenuSeparator, {}), jsx(DropdownMenuItem, { onClick: item.action, className: item.isActive ? 'bg-accent' : '', children: jsxs("div", { className: "flex w-full items-center gap-2", children: [jsx("span", { className: item.isActive ? 'text-primary' : 'text-gray-600', children: item.icon }), jsx("span", { className: "flex-1", children: item.name }), item.isActive && jsx("span", { className: "bg-primary h-2 w-2 rounded-full" })] }) })] }, item.name))) })] })] }));
|
|
242130
242036
|
}
|
|
242131
242037
|
// Desktop: show all buttons
|
|
242132
242038
|
return (jsxs("div", { ref: containerRef, className: "flex flex-wrap items-center gap-0.5", children: [jsx(Button$1, { variant: "ghost", size: "sm", className: "h-8 w-8 p-0", onClick:
|
|
242133
242039
|
/* istanbul ignore next -- @preserve click handler requires enabled state */ () => {
|
|
242134
|
-
editor
|
|
242135
|
-
.chain()
|
|
242136
|
-
.focus(undefined, { scrollIntoView: false })
|
|
242137
|
-
.undo()
|
|
242138
|
-
.run();
|
|
242040
|
+
editor.chain().focus(undefined, { scrollIntoView: false }).undo().run();
|
|
242139
242041
|
}, disabled: !canUndo, "aria-label": "Undo", children: jsx(Undo2, { className: "h-4 w-4 text-gray-600" }) }), jsx(Button$1, { variant: "ghost", size: "sm", className: "h-8 w-8 p-0", onClick:
|
|
242140
242042
|
/* istanbul ignore next -- @preserve click handler requires enabled state */ () => {
|
|
242141
|
-
editor
|
|
242142
|
-
.chain()
|
|
242143
|
-
.focus(undefined, { scrollIntoView: false })
|
|
242144
|
-
.redo()
|
|
242145
|
-
.run();
|
|
242043
|
+
editor.chain().focus(undefined, { scrollIntoView: false }).redo().run();
|
|
242146
242044
|
}, disabled: !canRedo, "aria-label": "Redo", children: jsx(Redo2, { className: "h-4 w-4 text-gray-600" }) }), jsx("div", { className: "mx-0.5 h-4 w-px bg-gray-300" }), jsx(Button$1, { variant: editor.isActive('heading', { level: 1 }) ? 'secondary' : 'ghost', size: "sm", className: "h-8 w-8 p-0", onClick: () => focusWithoutScroll().toggleHeading({ level: 1 }).run(), "aria-label": "Toggle heading 1", children: jsx(Heading1, { className: "h-4 w-4 text-gray-600" }) }), jsx(Button$1, { variant: editor.isActive('heading', { level: 2 }) ? 'secondary' : 'ghost', size: "sm", className: "h-8 w-8 p-0", onClick: () => focusWithoutScroll().toggleHeading({ level: 2 }).run(), "aria-label": "Toggle heading 2", children: jsx(Heading2, { className: "h-4 w-4 text-gray-600" }) }), jsx(Button$1, { variant: editor.isActive('heading', { level: 3 }) ? 'secondary' : 'ghost', size: "sm", className: "h-8 w-8 p-0", onClick: () => focusWithoutScroll().toggleHeading({ level: 3 }).run(), "aria-label": "Toggle heading 3", children: jsx(Heading3, { className: "h-4 w-4 text-gray-600" }) }), jsx("div", { className: "mx-0.5 h-4 w-px bg-gray-300" }), jsx(Button$1, { variant: editor.isActive('bold') ? 'secondary' : 'ghost', size: "sm", className: "h-8 w-8 p-0", onClick: () => focusWithoutScroll().toggleBold().run(), "aria-label": "Toggle bold", children: jsx(Bold$1, { className: "h-4 w-4 text-gray-600" }) }), jsx(Button$1, { variant: editor.isActive('italic') ? 'secondary' : 'ghost', size: "sm", className: "h-8 w-8 p-0", onClick: () => focusWithoutScroll().toggleItalic().run(), "aria-label": "Toggle italic", children: jsx(Italic$1, { className: "h-4 w-4 text-gray-600" }) }), jsx(Button$1, { variant: editor.isActive('code') ? 'secondary' : 'ghost', size: "sm", className: "h-8 w-8 p-0", onClick: () => focusWithoutScroll().toggleCode().run(), "aria-label": "Toggle inline code", children: jsx(CodeXml, { className: "h-4 w-4 text-gray-600" }) }), jsx("div", { className: "mx-0.5 h-4 w-px bg-gray-300" }), jsx(Button$1, { variant: editor.isActive('codeBlock') ? 'secondary' : 'ghost', size: "sm", className: "h-8 w-8 p-0", onClick: () => focusWithoutScroll().toggleCodeBlock().run(), "aria-label": "Toggle code block", children: jsx(FileCode, { className: "h-4 w-4 text-gray-600" }) }), jsx(Button$1, { variant: editor.isActive('blockquote') ? 'secondary' : 'ghost', size: "sm", className: "h-8 w-8 p-0", onClick: () => focusWithoutScroll().toggleBlockquote().run(), "aria-label": "Toggle blockquote", children: jsx(Quote, { className: "h-4 w-4 text-gray-600" }) })] }));
|
|
242147
242045
|
}
|
|
242148
242046
|
function useCanvasRichTextEditor({ value, onChange, exportFormat = 'markdown', disabled, artifactId, org, userId, title, enableAutoSave = false, }) {
|
|
@@ -242431,9 +242329,7 @@ function useCanvasRichTextEditor({ value, onChange, exportFormat = 'markdown', d
|
|
|
242431
242329
|
if (isUpdatingRef.current) {
|
|
242432
242330
|
return;
|
|
242433
242331
|
}
|
|
242434
|
-
const newValue = exportFormat === 'html'
|
|
242435
|
-
? editor.getHTML()
|
|
242436
|
-
: htmlToMarkdown(editor.getHTML());
|
|
242332
|
+
const newValue = exportFormat === 'html' ? editor.getHTML() : htmlToMarkdown(editor.getHTML());
|
|
242437
242333
|
lastSetValueRef.current = newValue;
|
|
242438
242334
|
lastUserInputRef.current = newValue;
|
|
242439
242335
|
onChange(newValue);
|
|
@@ -242588,7 +242484,7 @@ function useCanvasRichTextEditor({ value, onChange, exportFormat = 'markdown', d
|
|
|
242588
242484
|
}, [editor, value, exportFormat]);
|
|
242589
242485
|
return editor;
|
|
242590
242486
|
}
|
|
242591
|
-
function CanvasRichTextEditorContent({ editor
|
|
242487
|
+
function CanvasRichTextEditorContent({ editor }) {
|
|
242592
242488
|
const containerRef = React__default.useRef(null);
|
|
242593
242489
|
// Add native click listener for links - React events don't catch TipTap's rendered content
|
|
242594
242490
|
/* istanbul ignore next -- @preserve DOM event handler for link clicks */
|
|
@@ -242601,11 +242497,7 @@ function CanvasRichTextEditorContent({ editor, }) {
|
|
|
242601
242497
|
if (event.button !== 0)
|
|
242602
242498
|
return;
|
|
242603
242499
|
const target = event.target;
|
|
242604
|
-
const element = target instanceof Element
|
|
242605
|
-
? target
|
|
242606
|
-
: target instanceof Node
|
|
242607
|
-
? target.parentElement
|
|
242608
|
-
: null;
|
|
242500
|
+
const element = target instanceof Element ? target : target instanceof Node ? target.parentElement : null;
|
|
242609
242501
|
const link = element === null || element === void 0 ? void 0 : element.closest('a');
|
|
242610
242502
|
if (link) {
|
|
242611
242503
|
const rawHref = (_a = link.getAttribute('href')) !== null && _a !== void 0 ? _a : '';
|
|
@@ -242679,7 +242571,7 @@ const emojiPrompts = {
|
|
|
242679
242571
|
lists: 'Add emojis to lists for visual flair. Do not change the structure of the original text.',
|
|
242680
242572
|
remove: 'Remove emojis.',
|
|
242681
242573
|
};
|
|
242682
|
-
function CanvasControls({ sendFullArtifactUpdate
|
|
242574
|
+
function CanvasControls({ sendFullArtifactUpdate }) {
|
|
242683
242575
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
242684
242576
|
const [selectedOption, setSelectedOption] = useState(null);
|
|
242685
242577
|
const [isDragging, setIsDragging] = useState(false);
|
|
@@ -242692,8 +242584,7 @@ function CanvasControls({ sendFullArtifactUpdate, }) {
|
|
|
242692
242584
|
const containerRef = useRef(null);
|
|
242693
242585
|
useEffect(() => {
|
|
242694
242586
|
const handleClickOutside = (e) => {
|
|
242695
|
-
if (containerRef.current &&
|
|
242696
|
-
!containerRef.current.contains(e.target)) {
|
|
242587
|
+
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
242697
242588
|
setSelectedOption(null);
|
|
242698
242589
|
setShowSendOnIcon(null);
|
|
242699
242590
|
setIsExpanded(false);
|
|
@@ -242708,9 +242599,7 @@ function CanvasControls({ sendFullArtifactUpdate, }) {
|
|
|
242708
242599
|
if (!sliderRef.current)
|
|
242709
242600
|
return;
|
|
242710
242601
|
const sliderRect = sliderRef.current.getBoundingClientRect();
|
|
242711
|
-
const dotCount = selectedOption === 'length'
|
|
242712
|
-
? lengthLevels.length
|
|
242713
|
-
: readingLevels.length;
|
|
242602
|
+
const dotCount = selectedOption === 'length' ? lengthLevels.length : readingLevels.length;
|
|
242714
242603
|
const sliderHeight = sliderRect.height - 60; // Accounting for padding
|
|
242715
242604
|
const dotSpacing = sliderHeight / (dotCount - 1);
|
|
242716
242605
|
const relativeY = e.clientY - sliderRect.top - 30; // Offset for padding
|
|
@@ -242753,8 +242642,7 @@ function CanvasControls({ sendFullArtifactUpdate, }) {
|
|
|
242753
242642
|
setShowSendOnIcon(null); // Reset send button on mousedown to allow dragging again
|
|
242754
242643
|
setIsDragging(true);
|
|
242755
242644
|
startDragY.current = e.clientY;
|
|
242756
|
-
startPosition.current =
|
|
242757
|
-
selectedOption === 'length' ? lengthPosition : readingPosition;
|
|
242645
|
+
startPosition.current = selectedOption === 'length' ? lengthPosition : readingPosition;
|
|
242758
242646
|
};
|
|
242759
242647
|
const handleIconClick = (option) => {
|
|
242760
242648
|
if (option === 'polish') {
|
|
@@ -242818,9 +242706,7 @@ function CanvasControls({ sendFullArtifactUpdate, }) {
|
|
|
242818
242706
|
const isActive = selectedOption === 'length'
|
|
242819
242707
|
? lengthPosition === index
|
|
242820
242708
|
: readingPosition === index;
|
|
242821
|
-
return (jsxs("div", { className: "flex items-center justify-center", style: { position: 'relative' }, children: [jsx("div", { className: `absolute right-full mr-8 rounded bg-black px-3 py-1 text-xs whitespace-nowrap text-white transition-opacity duration-200 ${isActive ? 'opacity-100' : 'opacity-0'}`, children: level.label }), jsx("div", { className: `rounded-full transition-all duration-200 ${isActive
|
|
242822
|
-
? 'h-2 w-2 bg-gray-400'
|
|
242823
|
-
: 'h-2 w-2 bg-gray-300'}` })] }, index));
|
|
242709
|
+
return (jsxs("div", { className: "flex items-center justify-center", style: { position: 'relative' }, children: [jsx("div", { className: `absolute right-full mr-8 rounded bg-black px-3 py-1 text-xs whitespace-nowrap text-white transition-opacity duration-200 ${isActive ? 'opacity-100' : 'opacity-0'}`, children: level.label }), jsx("div", { className: `rounded-full transition-all duration-200 ${isActive ? 'h-2 w-2 bg-gray-400' : 'h-2 w-2 bg-gray-300'}` })] }, index));
|
|
242824
242710
|
}) }), jsx("div", { className: "absolute z-10", style: {
|
|
242825
242711
|
top: `${30 + ((selectedOption === 'length' ? lengthPosition : readingPosition) / ((selectedOption === 'length' ? lengthLevels.length : readingLevels.length) - 1)) * (300 - 60)}px`,
|
|
242826
242712
|
left: '50%',
|
|
@@ -243025,9 +242911,7 @@ const findValueByKey = (root, keyCandidates) => {
|
|
|
243025
242911
|
return value;
|
|
243026
242912
|
}
|
|
243027
242913
|
}
|
|
243028
|
-
if (typeof value === 'object' &&
|
|
243029
|
-
value !== null &&
|
|
243030
|
-
!Array.isArray(value)) {
|
|
242914
|
+
if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
|
|
243031
242915
|
queue.push(value);
|
|
243032
242916
|
}
|
|
243033
242917
|
}
|
|
@@ -243099,9 +242983,7 @@ const findTextInMarkdown = (searchText, markdown) => {
|
|
|
243099
242983
|
while (searchStart < markdown.length) {
|
|
243100
242984
|
// Look for the first word in remaining markdown
|
|
243101
242985
|
const strippedRemaining = stripMarkdownFormatting(markdown.slice(searchStart));
|
|
243102
|
-
const wordIndex = strippedRemaining
|
|
243103
|
-
.toLowerCase()
|
|
243104
|
-
.indexOf(firstWord.toLowerCase());
|
|
242986
|
+
const wordIndex = strippedRemaining.toLowerCase().indexOf(firstWord.toLowerCase());
|
|
243105
242987
|
if (wordIndex === -1)
|
|
243106
242988
|
break;
|
|
243107
242989
|
// Map back to original markdown position
|
|
@@ -243138,8 +243020,7 @@ const findTextInMarkdown = (searchText, markdown) => {
|
|
|
243138
243020
|
const selectionWords = cleanSearchText.split(/\s+/);
|
|
243139
243021
|
let matchedWords = 0;
|
|
243140
243022
|
let currentPos = candidateStart;
|
|
243141
|
-
while (currentPos < markdown.length &&
|
|
243142
|
-
matchedWords < selectionWords.length) {
|
|
243023
|
+
while (currentPos < markdown.length && matchedWords < selectionWords.length) {
|
|
243143
243024
|
// Skip whitespace and formatting in markdown
|
|
243144
243025
|
while (currentPos < markdown.length &&
|
|
243145
243026
|
(/\s/.test(markdown[currentPos]) ||
|
|
@@ -243215,9 +243096,7 @@ const calculateMarkdownIndices = (selectedTextStr, markdownContent) => {
|
|
|
243215
243096
|
const firstWord = words[0];
|
|
243216
243097
|
const lastWord = words[words.length - 1];
|
|
243217
243098
|
// Find first word
|
|
243218
|
-
const firstWordIndex = markdownContent
|
|
243219
|
-
.toLowerCase()
|
|
243220
|
-
.indexOf(firstWord.toLowerCase());
|
|
243099
|
+
const firstWordIndex = markdownContent.toLowerCase().indexOf(firstWord.toLowerCase());
|
|
243221
243100
|
if (firstWordIndex >= 0) {
|
|
243222
243101
|
// Find last word after first word
|
|
243223
243102
|
const searchAfter = firstWordIndex + firstWord.length;
|
|
@@ -243634,14 +243513,8 @@ const exportAsPDF = async (markdownSource, exportTitle) => {
|
|
|
243634
243513
|
if (buffer.byteLength < 4)
|
|
243635
243514
|
return false;
|
|
243636
243515
|
const header = new Uint8Array(buffer.slice(0, 4));
|
|
243637
|
-
const isTrueType = (header[0] === 0x00 &&
|
|
243638
|
-
header[1] ===
|
|
243639
|
-
header[2] === 0x00 &&
|
|
243640
|
-
header[3] === 0x00) ||
|
|
243641
|
-
(header[0] === 0x4f &&
|
|
243642
|
-
header[1] === 0x54 &&
|
|
243643
|
-
header[2] === 0x54 &&
|
|
243644
|
-
header[3] === 0x4f);
|
|
243516
|
+
const isTrueType = (header[0] === 0x00 && header[1] === 0x01 && header[2] === 0x00 && header[3] === 0x00) ||
|
|
243517
|
+
(header[0] === 0x4f && header[1] === 0x54 && header[2] === 0x54 && header[3] === 0x4f);
|
|
243645
243518
|
if (!isTrueType) {
|
|
243646
243519
|
return false;
|
|
243647
243520
|
}
|
|
@@ -243796,12 +243669,10 @@ const exportAsPDF = async (markdownSource, exportTitle) => {
|
|
|
243796
243669
|
};
|
|
243797
243670
|
return text.replace(/[^\x00-\xFF]/g, (char) => {
|
|
243798
243671
|
var _a;
|
|
243799
|
-
if (fontState.symbolFamily !== 'helvetica' &&
|
|
243800
|
-
SYMBOL_FONT_REGEX.test(char)) {
|
|
243672
|
+
if (fontState.symbolFamily !== 'helvetica' && SYMBOL_FONT_REGEX.test(char)) {
|
|
243801
243673
|
return char;
|
|
243802
243674
|
}
|
|
243803
|
-
if (fontState.mathFamily !== 'helvetica' &&
|
|
243804
|
-
MATH_FONT_REGEX.test(char)) {
|
|
243675
|
+
if (fontState.mathFamily !== 'helvetica' && MATH_FONT_REGEX.test(char)) {
|
|
243805
243676
|
return char;
|
|
243806
243677
|
}
|
|
243807
243678
|
return (_a = fallbackMap[char]) !== null && _a !== void 0 ? _a : '?';
|
|
@@ -243879,18 +243750,7 @@ const exportAsPDF = async (markdownSource, exportTitle) => {
|
|
|
243879
243750
|
return `${letters[(counter - 1) % 26]}. `;
|
|
243880
243751
|
}
|
|
243881
243752
|
// Roman numerals for depth 2+
|
|
243882
|
-
const romanNumerals = [
|
|
243883
|
-
'i',
|
|
243884
|
-
'ii',
|
|
243885
|
-
'iii',
|
|
243886
|
-
'iv',
|
|
243887
|
-
'v',
|
|
243888
|
-
'vi',
|
|
243889
|
-
'vii',
|
|
243890
|
-
'viii',
|
|
243891
|
-
'ix',
|
|
243892
|
-
'x',
|
|
243893
|
-
];
|
|
243753
|
+
const romanNumerals = ['i', 'ii', 'iii', 'iv', 'v', 'vi', 'vii', 'viii', 'ix', 'x'];
|
|
243894
243754
|
return `${romanNumerals[(counter - 1) % 10]}. `;
|
|
243895
243755
|
};
|
|
243896
243756
|
/* istanbul ignore next -- @preserve internal PDF page break management */
|
|
@@ -243974,9 +243834,7 @@ const exportAsPDF = async (markdownSource, exportTitle) => {
|
|
|
243974
243834
|
const extraSpace = availableTableWidth - totalMinWidth;
|
|
243975
243835
|
const widths = [];
|
|
243976
243836
|
for (let i = 0; i < numCols; i++) {
|
|
243977
|
-
const proportion = totalContentLength > 0
|
|
243978
|
-
? totalContentLengths[i] / totalContentLength
|
|
243979
|
-
: 1 / numCols;
|
|
243837
|
+
const proportion = totalContentLength > 0 ? totalContentLengths[i] / totalContentLength : 1 / numCols;
|
|
243980
243838
|
const extraWidth = extraSpace * proportion;
|
|
243981
243839
|
widths.push(minWidths[i] + extraWidth);
|
|
243982
243840
|
}
|
|
@@ -244153,8 +244011,7 @@ const exportAsPDF = async (markdownSource, exportTitle) => {
|
|
|
244153
244011
|
return;
|
|
244154
244012
|
}
|
|
244155
244013
|
// Handle KaTeX math elements: extract readable math text
|
|
244156
|
-
if (element.classList.contains('katex-display') ||
|
|
244157
|
-
element.classList.contains('katex')) {
|
|
244014
|
+
if (element.classList.contains('katex-display') || element.classList.contains('katex')) {
|
|
244158
244015
|
// Skip inner .katex when already handled by .katex-display parent
|
|
244159
244016
|
if (element.classList.contains('katex') &&
|
|
244160
244017
|
((_b = element.parentElement) === null || _b === void 0 ? void 0 : _b.classList.contains('katex-display'))) {
|
|
@@ -244257,14 +244114,12 @@ const exportAsPDF = async (markdownSource, exportTitle) => {
|
|
|
244257
244114
|
const renderSegment = (segmentText, kind) => {
|
|
244258
244115
|
var _a, _b, _c;
|
|
244259
244116
|
let needsEmbolden = false;
|
|
244260
|
-
if (kind === 'symbol' &&
|
|
244261
|
-
fontState.symbolFamily !== fontState.family) {
|
|
244117
|
+
if (kind === 'symbol' && fontState.symbolFamily !== fontState.family) {
|
|
244262
244118
|
pdf.setFont(fontState.symbolFamily, 'normal');
|
|
244263
244119
|
pdf.setFontSize(scriptFontSize);
|
|
244264
244120
|
needsEmbolden = isBoldStyle((_a = part.style) !== null && _a !== void 0 ? _a : 'normal');
|
|
244265
244121
|
}
|
|
244266
|
-
else if (kind === 'math' &&
|
|
244267
|
-
fontState.mathFamily !== fontState.family) {
|
|
244122
|
+
else if (kind === 'math' && fontState.mathFamily !== fontState.family) {
|
|
244268
244123
|
pdf.setFont(fontState.mathFamily, 'normal');
|
|
244269
244124
|
pdf.setFontSize(scriptFontSize);
|
|
244270
244125
|
needsEmbolden = isBoldStyle((_b = part.style) !== null && _b !== void 0 ? _b : 'normal');
|
|
@@ -244298,10 +244153,8 @@ const exportAsPDF = async (markdownSource, exportTitle) => {
|
|
|
244298
244153
|
currentX += segmentWidth;
|
|
244299
244154
|
didDraw = true;
|
|
244300
244155
|
};
|
|
244301
|
-
const shouldSplit = (fontState.symbolFamily !== fontState.family &&
|
|
244302
|
-
|
|
244303
|
-
(fontState.mathFamily !== fontState.family &&
|
|
244304
|
-
MATH_FONT_REGEX.test(scriptText));
|
|
244156
|
+
const shouldSplit = (fontState.symbolFamily !== fontState.family && SYMBOL_FONT_REGEX.test(scriptText)) ||
|
|
244157
|
+
(fontState.mathFamily !== fontState.family && MATH_FONT_REGEX.test(scriptText));
|
|
244305
244158
|
if (shouldSplit) {
|
|
244306
244159
|
const segments = splitFontRuns(scriptText);
|
|
244307
244160
|
segments.forEach((segment) => renderSegment(segment.text, segment.kind));
|
|
@@ -244328,16 +244181,12 @@ const exportAsPDF = async (markdownSource, exportTitle) => {
|
|
|
244328
244181
|
const renderSegment = (segmentText, kind) => {
|
|
244329
244182
|
var _a, _b, _c;
|
|
244330
244183
|
let needsEmbolden = false;
|
|
244331
|
-
if (kind === 'symbol' &&
|
|
244332
|
-
fontState.symbolFamily !== fontState.family &&
|
|
244333
|
-
!isCode) {
|
|
244184
|
+
if (kind === 'symbol' && fontState.symbolFamily !== fontState.family && !isCode) {
|
|
244334
244185
|
pdf.setFont(fontState.symbolFamily, 'normal');
|
|
244335
244186
|
pdf.setFontSize(fontSize);
|
|
244336
244187
|
needsEmbolden = isBoldStyle((_a = part.style) !== null && _a !== void 0 ? _a : 'normal');
|
|
244337
244188
|
}
|
|
244338
|
-
else if (kind === 'math' &&
|
|
244339
|
-
fontState.mathFamily !== fontState.family &&
|
|
244340
|
-
!isCode) {
|
|
244189
|
+
else if (kind === 'math' && fontState.mathFamily !== fontState.family && !isCode) {
|
|
244341
244190
|
pdf.setFont(fontState.mathFamily, 'normal');
|
|
244342
244191
|
pdf.setFontSize(fontSize);
|
|
244343
244192
|
needsEmbolden = isBoldStyle((_b = part.style) !== null && _b !== void 0 ? _b : 'normal');
|
|
@@ -244372,10 +244221,8 @@ const exportAsPDF = async (markdownSource, exportTitle) => {
|
|
|
244372
244221
|
didDraw = true;
|
|
244373
244222
|
};
|
|
244374
244223
|
if (!isCode) {
|
|
244375
|
-
const shouldSplit = (fontState.symbolFamily !== fontState.family &&
|
|
244376
|
-
|
|
244377
|
-
(fontState.mathFamily !== fontState.family &&
|
|
244378
|
-
MATH_FONT_REGEX.test(token));
|
|
244224
|
+
const shouldSplit = (fontState.symbolFamily !== fontState.family && SYMBOL_FONT_REGEX.test(token)) ||
|
|
244225
|
+
(fontState.mathFamily !== fontState.family && MATH_FONT_REGEX.test(token));
|
|
244379
244226
|
if (shouldSplit) {
|
|
244380
244227
|
const segments = splitFontRuns(token);
|
|
244381
244228
|
segments.forEach((segment) => renderSegment(segment.text, segment.kind));
|
|
@@ -244658,17 +244505,7 @@ const exportAsPDF = async (markdownSource, exportTitle) => {
|
|
|
244658
244505
|
setPdfFont('normal');
|
|
244659
244506
|
}
|
|
244660
244507
|
// Process children for elements that weren't handled specially
|
|
244661
|
-
if (![
|
|
244662
|
-
'ul',
|
|
244663
|
-
'ol',
|
|
244664
|
-
'li',
|
|
244665
|
-
'table',
|
|
244666
|
-
'a',
|
|
244667
|
-
'pre',
|
|
244668
|
-
'blockquote',
|
|
244669
|
-
'hr',
|
|
244670
|
-
'br',
|
|
244671
|
-
].includes(tagName)) {
|
|
244508
|
+
if (!['ul', 'ol', 'li', 'table', 'a', 'pre', 'blockquote', 'hr', 'br'].includes(tagName)) {
|
|
244672
244509
|
Array.from(element.childNodes).forEach((child) => processNode(child, currentMargin, availableWidth));
|
|
244673
244510
|
}
|
|
244674
244511
|
if (['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(tagName)) {
|
|
@@ -244899,10 +244736,7 @@ function useCanvasVersionNavigation({ artifactId, org, userId, metadataVersionNu
|
|
|
244899
244736
|
}, [artifactId]);
|
|
244900
244737
|
// Computed values
|
|
244901
244738
|
const isViewingCurrentVersion = activeVersionIsCurrent;
|
|
244902
|
-
const isVersionNavDisabled = isStreamingArtifact ||
|
|
244903
|
-
isContentUpdating ||
|
|
244904
|
-
isInitialLoading ||
|
|
244905
|
-
isVersionLoading;
|
|
244739
|
+
const isVersionNavDisabled = isStreamingArtifact || isContentUpdating || isInitialLoading || isVersionLoading;
|
|
244906
244740
|
// Update version history from API data
|
|
244907
244741
|
useEffect(() => {
|
|
244908
244742
|
if (versionsData && versionsData.length > 0) {
|
|
@@ -244951,11 +244785,7 @@ function useCanvasVersionNavigation({ artifactId, org, userId, metadataVersionNu
|
|
|
244951
244785
|
const docSize = currentEditor.state.doc.content.size;
|
|
244952
244786
|
const from = Math.min(selectionRange.from, docSize);
|
|
244953
244787
|
const to = Math.min(selectionRange.to, docSize);
|
|
244954
|
-
currentEditor
|
|
244955
|
-
.chain()
|
|
244956
|
-
.focus()
|
|
244957
|
-
.setTextSelection({ from, to })
|
|
244958
|
-
.run();
|
|
244788
|
+
currentEditor.chain().focus().setTextSelection({ from, to }).run();
|
|
244959
244789
|
});
|
|
244960
244790
|
}
|
|
244961
244791
|
}
|
|
@@ -244986,9 +244816,7 @@ function useCanvasVersionNavigation({ artifactId, org, userId, metadataVersionNu
|
|
|
244986
244816
|
return -1;
|
|
244987
244817
|
const foundIndex = versionHistory.findIndex((v) => v.id === targetId);
|
|
244988
244818
|
// If we're viewing the current version but can't find it, assume we're at the end
|
|
244989
|
-
if (foundIndex === -1 &&
|
|
244990
|
-
activeVersionIsCurrent &&
|
|
244991
|
-
versionHistory.length > 0) {
|
|
244819
|
+
if (foundIndex === -1 && activeVersionIsCurrent && versionHistory.length > 0) {
|
|
244992
244820
|
return versionHistory.length - 1;
|
|
244993
244821
|
}
|
|
244994
244822
|
return foundIndex;
|
|
@@ -245022,8 +244850,7 @@ function useCanvasVersionNavigation({ artifactId, org, userId, metadataVersionNu
|
|
|
245022
244850
|
if (hasUserNavigatedVersionRef.current)
|
|
245023
244851
|
return;
|
|
245024
244852
|
// Determine target version: metadata version if provided and valid, otherwise current version
|
|
245025
|
-
const targetVersionNumber = metadataVersionNumber &&
|
|
245026
|
-
versionsData.find((v) => v.version_number === metadataVersionNumber)
|
|
244853
|
+
const targetVersionNumber = metadataVersionNumber && versionsData.find((v) => v.version_number === metadataVersionNumber)
|
|
245027
244854
|
? metadataVersionNumber
|
|
245028
244855
|
: (_a = versionsData.find((v) => v.is_current)) === null || _a === void 0 ? void 0 : _a.version_number;
|
|
245029
244856
|
if (!targetVersionNumber)
|
|
@@ -245094,8 +244921,7 @@ function useCanvasVersionNavigation({ artifactId, org, userId, metadataVersionNu
|
|
|
245094
244921
|
}).unwrap();
|
|
245095
244922
|
const nextContent = normalizeContentToMarkdown((_b = (_a = fetchedVersion.content) !== null && _a !== void 0 ? _a : version.content) !== null && _b !== void 0 ? _b : '');
|
|
245096
244923
|
const isCurrent = !!fetchedVersion.is_current;
|
|
245097
|
-
const nextId = `v${(_d = (_c = fetchedVersion.version_number) !== null && _c !== void 0 ? _c : version.versionNumber) !== null && _d !== void 0 ? _d : ''}` ||
|
|
245098
|
-
versionId;
|
|
244924
|
+
const nextId = `v${(_d = (_c = fetchedVersion.version_number) !== null && _c !== void 0 ? _c : version.versionNumber) !== null && _d !== void 0 ? _d : ''}` || versionId;
|
|
245099
244925
|
setActiveVersionId(nextId);
|
|
245100
244926
|
setActiveVersionIsCurrent(isCurrent);
|
|
245101
244927
|
setCurrentVersion(nextId);
|
|
@@ -245240,9 +245066,7 @@ function useCanvasVersionNavigation({ artifactId, org, userId, metadataVersionNu
|
|
|
245240
245066
|
const withoutCurrent = prev.map((v) => v.id === nextVersionId ? v : { ...v, isCurrent: false });
|
|
245241
245067
|
const existingIndex = withoutCurrent.findIndex((v) => v.id === nextVersionId);
|
|
245242
245068
|
const normalizedContent = normalizeContentToMarkdown(startIndex !== undefined && endIndex !== undefined && previousContent
|
|
245243
|
-
? previousContent.slice(0, startIndex) +
|
|
245244
|
-
content +
|
|
245245
|
-
previousContent.slice(endIndex)
|
|
245069
|
+
? previousContent.slice(0, startIndex) + content + previousContent.slice(endIndex)
|
|
245246
245070
|
: content);
|
|
245247
245071
|
const nextEntry = {
|
|
245248
245072
|
id: nextVersionId,
|
|
@@ -245526,12 +245350,7 @@ function CanvasComponent({ title = 'Untitled Artifact', content = '', onClose, i
|
|
|
245526
245350
|
}, [_metadata]);
|
|
245527
245351
|
const resolvedSessionId = useMemo(() => {
|
|
245528
245352
|
var _a;
|
|
245529
|
-
return ((_a = coerceString(_sessionId)) !== null && _a !== void 0 ? _a : coerceString(findValueByKey(metadataRecord, [
|
|
245530
|
-
'sessionId',
|
|
245531
|
-
'session_id',
|
|
245532
|
-
'session',
|
|
245533
|
-
'chat_session_id',
|
|
245534
|
-
])));
|
|
245353
|
+
return ((_a = coerceString(_sessionId)) !== null && _a !== void 0 ? _a : coerceString(findValueByKey(metadataRecord, ['sessionId', 'session_id', 'session', 'chat_session_id'])));
|
|
245535
245354
|
}, [_sessionId, metadataRecord]);
|
|
245536
245355
|
const resolvedArtifactId = useMemo(() => {
|
|
245537
245356
|
// Priority order for finding artifact ID in metadata:
|
|
@@ -245539,12 +245358,7 @@ function CanvasComponent({ title = 'Untitled Artifact', content = '', onClose, i
|
|
|
245539
245358
|
// 2. 'artifact' key (used in ArtifactVersion objects where 'id' is the version's ID)
|
|
245540
245359
|
// IMPORTANT: We avoid using generic 'id' key as it can be confused with version ID
|
|
245541
245360
|
// when metadata contains ArtifactVersion data (version.id vs artifact.id)
|
|
245542
|
-
const metadataId = coerceNumber(findValueByKey(metadataRecord, [
|
|
245543
|
-
'artifactId',
|
|
245544
|
-
'artifact_id',
|
|
245545
|
-
'artifactID',
|
|
245546
|
-
'artifact',
|
|
245547
|
-
]));
|
|
245361
|
+
const metadataId = coerceNumber(findValueByKey(metadataRecord, ['artifactId', 'artifact_id', 'artifactID', 'artifact']));
|
|
245548
245362
|
return resolveArtifactIdFromSources(artifactId, metadataId, currentArtifact === null || currentArtifact === void 0 ? void 0 : currentArtifact.id);
|
|
245549
245363
|
}, [artifactId, metadataRecord, currentArtifact === null || currentArtifact === void 0 ? void 0 : currentArtifact.id]);
|
|
245550
245364
|
const resolvedOrg = useMemo(() => {
|
|
@@ -245560,20 +245374,10 @@ function CanvasComponent({ title = 'Untitled Artifact', content = '', onClose, i
|
|
|
245560
245374
|
}, [metadataRecord, org]);
|
|
245561
245375
|
const resolvedUserId = useMemo(() => {
|
|
245562
245376
|
var _a;
|
|
245563
|
-
return ((_a = coerceString(userId)) !== null && _a !== void 0 ? _a : coerceString(findValueByKey(metadataRecord, [
|
|
245564
|
-
'user_id',
|
|
245565
|
-
'userId',
|
|
245566
|
-
'username',
|
|
245567
|
-
'user',
|
|
245568
|
-
'owner',
|
|
245569
|
-
])));
|
|
245377
|
+
return ((_a = coerceString(userId)) !== null && _a !== void 0 ? _a : coerceString(findValueByKey(metadataRecord, ['user_id', 'userId', 'username', 'user', 'owner'])));
|
|
245570
245378
|
}, [metadataRecord, userId]);
|
|
245571
245379
|
const metadataVersionNumber = useMemo(() => {
|
|
245572
|
-
const val = findValueByKey(metadataRecord, [
|
|
245573
|
-
'versionNumber',
|
|
245574
|
-
'version_number',
|
|
245575
|
-
'version',
|
|
245576
|
-
]);
|
|
245380
|
+
const val = findValueByKey(metadataRecord, ['versionNumber', 'version_number', 'version']);
|
|
245577
245381
|
return coerceNumber(val);
|
|
245578
245382
|
}, [metadataRecord]);
|
|
245579
245383
|
// Check if canvas was opened during streaming
|
|
@@ -245592,8 +245396,7 @@ function CanvasComponent({ title = 'Untitled Artifact', content = '', onClose, i
|
|
|
245592
245396
|
editorContentValueRef.current = normalized;
|
|
245593
245397
|
streamingContentBufferRef.current.lastAppliedContent = normalized;
|
|
245594
245398
|
streamingContentBufferRef.current.lastAppliedLength = normalized.length;
|
|
245595
|
-
streamingContentBufferRef.current.lastAppliedParagraphs =
|
|
245596
|
-
countStreamingParagraphs(normalized);
|
|
245399
|
+
streamingContentBufferRef.current.lastAppliedParagraphs = countStreamingParagraphs(normalized);
|
|
245597
245400
|
const currentEditor = editorRef.current;
|
|
245598
245401
|
if ((_a = currentEditor === null || currentEditor === void 0 ? void 0 : currentEditor.commands) === null || _a === void 0 ? void 0 : _a.setContent) {
|
|
245599
245402
|
const htmlContent = markdownToHtml(normalized);
|
|
@@ -245685,7 +245488,7 @@ function CanvasComponent({ title = 'Untitled Artifact', content = '', onClose, i
|
|
|
245685
245488
|
const normalizedContent = normalizeContentToMarkdown(newContent);
|
|
245686
245489
|
setEditorContent(normalizedContent);
|
|
245687
245490
|
lastSavedMarkdownRef.current = normalizedContent;
|
|
245688
|
-
setCurrentArtifact((prev) => prev ? { ...prev, content: normalizedContent } : prev);
|
|
245491
|
+
setCurrentArtifact((prev) => (prev ? { ...prev, content: normalizedContent } : prev));
|
|
245689
245492
|
// Reset editor's user edit tracking since this is a programmatic update
|
|
245690
245493
|
if (editorRef.current) {
|
|
245691
245494
|
editorRef.current.__hasUserEdited = false;
|
|
@@ -245703,7 +245506,7 @@ function CanvasComponent({ title = 'Untitled Artifact', content = '', onClose, i
|
|
|
245703
245506
|
const range = savedSelectionRef.current.cloneRange();
|
|
245704
245507
|
const rect = range.getBoundingClientRect();
|
|
245705
245508
|
const rects = Array.from(range.getClientRects());
|
|
245706
|
-
setSelectedText((prev) => prev ? { ...prev, rect } : { text: range.toString(), rect });
|
|
245509
|
+
setSelectedText((prev) => (prev ? { ...prev, rect } : { text: range.toString(), rect }));
|
|
245707
245510
|
setHighlightRects(rects);
|
|
245708
245511
|
}, [showHighlightPopup]);
|
|
245709
245512
|
// Streaming event handlers
|
|
@@ -245737,18 +245540,14 @@ function CanvasComponent({ title = 'Untitled Artifact', content = '', onClose, i
|
|
|
245737
245540
|
// Match artifact: check current artifact, resolved artifact ID, or the artifact ID prop
|
|
245738
245541
|
// For new artifacts during streaming, resolvedArtifactId should be set from props
|
|
245739
245542
|
const matchesArtifact = !!eventArtifactId &&
|
|
245740
|
-
((currentArtifact &&
|
|
245741
|
-
Number(eventArtifactId) === Number(
|
|
245742
|
-
(resolvedArtifactId &&
|
|
245743
|
-
Number(eventArtifactId) === Number(resolvedArtifactId)) ||
|
|
245543
|
+
((currentArtifact && Number(eventArtifactId) === Number(currentArtifact.id)) ||
|
|
245544
|
+
(resolvedArtifactId && Number(eventArtifactId) === Number(resolvedArtifactId)) ||
|
|
245744
245545
|
(artifactId && Number(eventArtifactId) === Number(artifactId)));
|
|
245745
245546
|
if (matchesArtifact) {
|
|
245746
245547
|
if (streamingContentBufferRef.current.updateTimer) {
|
|
245747
245548
|
clearTimeout(streamingContentBufferRef.current.updateTimer);
|
|
245748
245549
|
}
|
|
245749
|
-
const initialContent = isUpdate
|
|
245750
|
-
? ((_a = editorContentValueRef.current) !== null && _a !== void 0 ? _a : '')
|
|
245751
|
-
: '';
|
|
245550
|
+
const initialContent = isUpdate ? ((_a = editorContentValueRef.current) !== null && _a !== void 0 ? _a : '') : '';
|
|
245752
245551
|
streamingContentBufferRef.current = {
|
|
245753
245552
|
content: '',
|
|
245754
245553
|
lastUpdateTime: Date.now(),
|
|
@@ -245767,13 +245566,11 @@ function CanvasComponent({ title = 'Untitled Artifact', content = '', onClose, i
|
|
|
245767
245566
|
};
|
|
245768
245567
|
const handleArtifactStreamContent = (event) => {
|
|
245769
245568
|
var _a;
|
|
245770
|
-
const { artifactId: eventArtifactId, accumulatedContent, isPartial
|
|
245569
|
+
const { artifactId: eventArtifactId, accumulatedContent, isPartial } = event.detail;
|
|
245771
245570
|
// Match artifact: check current artifact, resolved artifact ID, or the artifact ID prop
|
|
245772
245571
|
const matchesArtifact = !!eventArtifactId &&
|
|
245773
|
-
((currentArtifact &&
|
|
245774
|
-
Number(eventArtifactId) === Number(
|
|
245775
|
-
(resolvedArtifactId &&
|
|
245776
|
-
Number(eventArtifactId) === Number(resolvedArtifactId)) ||
|
|
245572
|
+
((currentArtifact && Number(eventArtifactId) === Number(currentArtifact.id)) ||
|
|
245573
|
+
(resolvedArtifactId && Number(eventArtifactId) === Number(resolvedArtifactId)) ||
|
|
245777
245574
|
(artifactId && Number(eventArtifactId) === Number(artifactId)));
|
|
245778
245575
|
// Accept streaming content if artifact matches and we're streaming or updating
|
|
245779
245576
|
// Also accept if isStreamingArtifact is true (set at stream start)
|
|
@@ -245811,10 +245608,8 @@ function CanvasComponent({ title = 'Untitled Artifact', content = '', onClose, i
|
|
|
245811
245608
|
const { artifactId: eventArtifactId, content: streamContent, isUpdate, isPartial, startIndex, endIndex, versionNumber, title: streamTitle, fileExtension, } = event.detail;
|
|
245812
245609
|
// Match artifact: check current artifact, resolved artifact ID, or the artifact ID prop
|
|
245813
245610
|
const matchesArtifact = !!eventArtifactId &&
|
|
245814
|
-
((currentArtifact &&
|
|
245815
|
-
Number(eventArtifactId) === Number(
|
|
245816
|
-
(resolvedArtifactId &&
|
|
245817
|
-
Number(eventArtifactId) === Number(resolvedArtifactId)) ||
|
|
245611
|
+
((currentArtifact && Number(eventArtifactId) === Number(currentArtifact.id)) ||
|
|
245612
|
+
(resolvedArtifactId && Number(eventArtifactId) === Number(resolvedArtifactId)) ||
|
|
245818
245613
|
(artifactId && Number(eventArtifactId) === Number(artifactId)));
|
|
245819
245614
|
if (matchesArtifact) {
|
|
245820
245615
|
if (streamingContentBufferRef.current.updateTimer) {
|
|
@@ -245824,10 +245619,7 @@ function CanvasComponent({ title = 'Untitled Artifact', content = '', onClose, i
|
|
|
245824
245619
|
streamingContentBufferRef.current.content = '';
|
|
245825
245620
|
if (isUpdate) {
|
|
245826
245621
|
setShowUpdateAnimation(true);
|
|
245827
|
-
if (isPartial &&
|
|
245828
|
-
startIndex !== undefined &&
|
|
245829
|
-
endIndex !== undefined &&
|
|
245830
|
-
previousContent) {
|
|
245622
|
+
if (isPartial && startIndex !== undefined && endIndex !== undefined && previousContent) {
|
|
245831
245623
|
const newContent = previousContent.slice(0, startIndex) +
|
|
245832
245624
|
streamContent +
|
|
245833
245625
|
previousContent.slice(endIndex);
|
|
@@ -245910,7 +245702,7 @@ function CanvasComponent({ title = 'Untitled Artifact', content = '', onClose, i
|
|
|
245910
245702
|
}
|
|
245911
245703
|
}
|
|
245912
245704
|
if (streamTitle && (currentArtifact === null || currentArtifact === void 0 ? void 0 : currentArtifact.title) !== streamTitle) {
|
|
245913
|
-
setCurrentArtifact((prev) => prev ? { ...prev, title: streamTitle } : prev);
|
|
245705
|
+
setCurrentArtifact((prev) => (prev ? { ...prev, title: streamTitle } : prev));
|
|
245914
245706
|
}
|
|
245915
245707
|
}
|
|
245916
245708
|
console.log('artifact-stream-end new version ', {
|
|
@@ -246000,8 +245792,7 @@ function CanvasComponent({ title = 'Untitled Artifact', content = '', onClose, i
|
|
|
246000
245792
|
// Initialize streaming state from metadata (when canvas opens during streaming)
|
|
246001
245793
|
// Only run once on mount - don't keep re-setting after streaming ends
|
|
246002
245794
|
useEffect(() => {
|
|
246003
|
-
if (metadataIsStreaming &&
|
|
246004
|
-
!hasInitializedStreamingFromMetadataRef.current) {
|
|
245795
|
+
if (metadataIsStreaming && !hasInitializedStreamingFromMetadataRef.current) {
|
|
246005
245796
|
console.log('[Canvas] Initializing streaming state from metadata');
|
|
246006
245797
|
hasInitializedStreamingFromMetadataRef.current = true;
|
|
246007
245798
|
setIsStreamingArtifact(true);
|
|
@@ -246040,9 +245831,7 @@ function CanvasComponent({ title = 'Untitled Artifact', content = '', onClose, i
|
|
|
246040
245831
|
return;
|
|
246041
245832
|
let artifactToLoad = null;
|
|
246042
245833
|
if (resolvedArtifactId && artifactsResponse.results.length > 0) {
|
|
246043
|
-
artifactToLoad =
|
|
246044
|
-
artifactsResponse.results.find((a) => a.id === resolvedArtifactId) ||
|
|
246045
|
-
null;
|
|
245834
|
+
artifactToLoad = artifactsResponse.results.find((a) => a.id === resolvedArtifactId) || null;
|
|
246046
245835
|
}
|
|
246047
245836
|
else if (artifactsResponse.results.length > 0) {
|
|
246048
245837
|
artifactToLoad = artifactsResponse.results[0];
|
|
@@ -246057,8 +245846,7 @@ function CanvasComponent({ title = 'Untitled Artifact', content = '', onClose, i
|
|
|
246057
245846
|
return;
|
|
246058
245847
|
setCurrentArtifact(fullArtifact);
|
|
246059
245848
|
lastSavedMarkdownRef.current = normalizeContentToMarkdown(fullArtifact.content);
|
|
246060
|
-
lastKnownVersionRef.current =
|
|
246061
|
-
fullArtifact.current_version_number || 1;
|
|
245849
|
+
lastKnownVersionRef.current = fullArtifact.current_version_number || 1;
|
|
246062
245850
|
resetVersionNavigation();
|
|
246063
245851
|
if (fullArtifact.content) {
|
|
246064
245852
|
applyProgrammaticContent(fullArtifact.content);
|
|
@@ -246112,13 +245900,7 @@ function CanvasComponent({ title = 'Untitled Artifact', content = '', onClose, i
|
|
|
246112
245900
|
await loadArtifacts();
|
|
246113
245901
|
};
|
|
246114
245902
|
initializeCanvas();
|
|
246115
|
-
}, [
|
|
246116
|
-
loadArtifacts,
|
|
246117
|
-
resolvedSessionId,
|
|
246118
|
-
resolvedOrg,
|
|
246119
|
-
resolvedUserId,
|
|
246120
|
-
editSession,
|
|
246121
|
-
]);
|
|
245903
|
+
}, [loadArtifacts, resolvedSessionId, resolvedOrg, resolvedUserId, editSession]);
|
|
246122
245904
|
// Notify chat system when canvas is active
|
|
246123
245905
|
/* istanbul ignore next -- @preserve canvas active/inactive event dispatch */
|
|
246124
245906
|
useEffect(() => {
|
|
@@ -246251,11 +246033,7 @@ function CanvasComponent({ title = 'Untitled Artifact', content = '', onClose, i
|
|
|
246251
246033
|
const shouldRestoreFocus = savedCursor.wasFocused && !currentEditor.isFocused;
|
|
246252
246034
|
if (shouldRestoreFocus) {
|
|
246253
246035
|
// Restore focus and cursor position smoothly
|
|
246254
|
-
currentEditor
|
|
246255
|
-
.chain()
|
|
246256
|
-
.focus()
|
|
246257
|
-
.setTextSelection({ from, to })
|
|
246258
|
-
.run();
|
|
246036
|
+
currentEditor.chain().focus().setTextSelection({ from, to }).run();
|
|
246259
246037
|
}
|
|
246260
246038
|
}
|
|
246261
246039
|
catch (e) {
|
|
@@ -246396,14 +246174,7 @@ function CanvasComponent({ title = 'Untitled Artifact', content = '', onClose, i
|
|
|
246396
246174
|
const markdownSource = (_b = (_a = editorContent !== null && editorContent !== void 0 ? editorContent : currentArtifact === null || currentArtifact === void 0 ? void 0 : currentArtifact.content) !== null && _a !== void 0 ? _a : content) !== null && _b !== void 0 ? _b : '';
|
|
246397
246175
|
const exportTitle = (_d = (_c = metadataTitle !== null && metadataTitle !== void 0 ? metadataTitle : currentArtifact === null || currentArtifact === void 0 ? void 0 : currentArtifact.title) !== null && _c !== void 0 ? _c : title) !== null && _d !== void 0 ? _d : 'Untitled Artifact';
|
|
246398
246176
|
return { markdownSource, exportTitle };
|
|
246399
|
-
}, [
|
|
246400
|
-
flushSave,
|
|
246401
|
-
currentArtifact,
|
|
246402
|
-
editorContent,
|
|
246403
|
-
content,
|
|
246404
|
-
metadataTitle,
|
|
246405
|
-
title,
|
|
246406
|
-
]);
|
|
246177
|
+
}, [flushSave, currentArtifact, editorContent, content, metadataTitle, title]);
|
|
246407
246178
|
/* istanbul ignore next -- @preserve PDF export callback */
|
|
246408
246179
|
const handleExportPDF = useCallback(async () => {
|
|
246409
246180
|
try {
|
|
@@ -246462,10 +246233,7 @@ function CanvasComponent({ title = 'Untitled Artifact', content = '', onClose, i
|
|
|
246462
246233
|
/* istanbul ignore next -- @preserve rename title callback */
|
|
246463
246234
|
const handleRenameTitle = useCallback(async () => {
|
|
246464
246235
|
var _a, _b;
|
|
246465
|
-
if (!effectiveArtifactId ||
|
|
246466
|
-
!resolvedOrg ||
|
|
246467
|
-
!resolvedUserId ||
|
|
246468
|
-
!renameTitle.trim())
|
|
246236
|
+
if (!effectiveArtifactId || !resolvedOrg || !resolvedUserId || !renameTitle.trim())
|
|
246469
246237
|
return;
|
|
246470
246238
|
const trimmedTitle = renameTitle.trim();
|
|
246471
246239
|
if (trimmedTitle === ((_a = currentArtifact === null || currentArtifact === void 0 ? void 0 : currentArtifact.title) !== null && _a !== void 0 ? _a : title)) {
|
|
@@ -246616,10 +246384,7 @@ function CanvasComponent({ title = 'Untitled Artifact', content = '', onClose, i
|
|
|
246616
246384
|
}
|
|
246617
246385
|
const fileExt = metadataRecord === null || metadataRecord === void 0 ? void 0 : metadataRecord.fileExtension;
|
|
246618
246386
|
const artifactPayload = {
|
|
246619
|
-
title: currentArtifact.title ||
|
|
246620
|
-
metadataTitle ||
|
|
246621
|
-
title ||
|
|
246622
|
-
'Untitled Artifact',
|
|
246387
|
+
title: currentArtifact.title || metadataTitle || title || 'Untitled Artifact',
|
|
246623
246388
|
file_extension: currentArtifact.file_extension || fileExt || 'txt',
|
|
246624
246389
|
id: String(currentArtifact.id),
|
|
246625
246390
|
is_partial: true,
|
|
@@ -246704,28 +246469,17 @@ function CanvasComponent({ title = 'Untitled Artifact', content = '', onClose, i
|
|
|
246704
246469
|
var _a, _b;
|
|
246705
246470
|
setRenameTitle((_b = (_a = currentArtifact === null || currentArtifact === void 0 ? void 0 : currentArtifact.title) !== null && _a !== void 0 ? _a : title) !== null && _b !== void 0 ? _b : 'Untitled Artifact');
|
|
246706
246471
|
setIsRenameModalOpen(true);
|
|
246707
|
-
}, disabled: isEditingDisabled, className: cn('block cursor-pointer truncate text-left text-xs font-medium text-gray-900 transition-colors hover:text-blue-600 sm:text-sm md:text-base', isEditingDisabled &&
|
|
246708
|
-
'cursor-not-allowed text-gray-500 hover:text-gray-500'), title: "Click to rename", children: displayTitle || 'Untitled Artifact' }), versionsData && versionsData.length > 1 && currentVersion && (jsxs(DropdownMenu, { children: [jsx(DropdownMenuTrigger, { asChild: true, children: jsx(Button$1, { variant: "ghost", size: "sm", className: "h-7 w-7 p-0 text-gray-500 hover:text-gray-700", disabled: isVersionNavDisabled, children: jsx(EllipsisVertical, { className: "h-4 w-4" }) }) }), jsxs(DropdownMenuContent, { align: "start", className: "w-48", children: [jsxs(DropdownMenuItem, { onClick: handlePreviousVersion, disabled: !canGoPrevious || isVersionNavDisabled, className: !canGoPrevious || isVersionNavDisabled
|
|
246472
|
+
}, disabled: isEditingDisabled, className: cn('block cursor-pointer truncate text-left text-xs font-medium text-gray-900 transition-colors hover:text-blue-600 sm:text-sm md:text-base', isEditingDisabled && 'cursor-not-allowed text-gray-500 hover:text-gray-500'), title: "Click to rename", children: displayTitle || 'Untitled Artifact' }), versionsData && versionsData.length > 1 && currentVersion && (jsxs(DropdownMenu, { children: [jsx(DropdownMenuTrigger, { asChild: true, children: jsx(Button$1, { variant: "ghost", size: "sm", className: "h-7 w-7 p-0 text-gray-500 hover:text-gray-700", disabled: isVersionNavDisabled, children: jsx(EllipsisVertical, { className: "h-4 w-4" }) }) }), jsxs(DropdownMenuContent, { align: "start", className: "w-48", children: [jsxs(DropdownMenuItem, { onClick: handlePreviousVersion, disabled: !canGoPrevious || isVersionNavDisabled, className: !canGoPrevious || isVersionNavDisabled
|
|
246709
246473
|
? 'cursor-not-allowed opacity-50'
|
|
246710
246474
|
: 'cursor-pointer', children: [jsx(ChevronLeft, { className: "mr-2 h-4 w-4" }), "Previous Version"] }), jsxs(DropdownMenuItem, { onClick: handleNextVersion, disabled: !canGoNext || isVersionNavDisabled, className: !canGoNext || isVersionNavDisabled
|
|
246711
246475
|
? 'cursor-not-allowed opacity-50'
|
|
246712
|
-
: 'cursor-pointer', children: [jsx(ChevronRight, { className: "mr-2 h-4 w-4" }), "Next Version"] }), jsx(DropdownMenuSeparator, {}), jsxs("div", { className: "px-2 py-1.5 text-xs text-gray-500", children: ["Version ", currentVersionIndex + 1, " of ", versionHistory.length] })] })] }))] }), jsx("div", { className: cn('flex flex-shrink-0 flex-wrap items-center gap-0.5', (!isViewingCurrentVersion ||
|
|
246713
|
-
|
|
246714
|
-
isContentUpdating) &&
|
|
246715
|
-
'pointer-events-none opacity-60'), children: jsx(CanvasRichTextEditorToolbar, { editor: editor }) }), jsxs("div", { className: "ml-1 flex flex-shrink-0 items-center gap-1 sm:gap-2", children: [saveStatusLabel && (jsx("span", { className: `${saveStatusClass} hidden sm:inline`, children: saveStatusLabel })), jsxs(DropdownMenu, { children: [jsx(DropdownMenuTrigger, { asChild: true, children: jsx(Button$1, { variant: "outline", size: "sm", className: "flex items-center gap-1 border-blue-200 bg-transparent px-1 text-xs whitespace-nowrap text-blue-600 sm:px-2 md:px-3", disabled: isExporting || saveState === 'saving', children: isExporting ? (jsxs(Fragment$1, { children: [jsx("span", { className: "h-3 w-3 animate-spin rounded-full border-[2px] border-blue-400 border-t-transparent" }), jsx("span", { className: "hidden sm:inline", children: "Exporting\u2026" }), jsx("span", { className: "sm:hidden", children: "Export" })] })) : (jsxs(Fragment$1, { children: [jsx(Download, { className: "h-3.5 w-3.5 sm:mr-1" }), jsx("span", { className: "hidden sm:inline", children: "Export" })] })) }) }), jsxs(DropdownMenuContent, { align: "end", className: "w-56", children: [jsxs(DropdownMenuItem, { onClick:
|
|
246716
|
-
/* istanbul ignore next -- @preserve */ () => void handleExportPDF(), className: "cursor-pointer", children: [jsx(File$1, { className: "mr-2 h-4 w-4 text-red-500" }), jsxs("div", { className: "flex flex-col", children: [jsx("span", { children: "PDF Document" }), jsx("span", { className: "text-xs text-gray-500", children: ".pdf" })] })] }), jsxs(DropdownMenuItem, { onClick:
|
|
246717
|
-
/* istanbul ignore next -- @preserve */ () => void handleExportDOCX(), className: "cursor-pointer", children: [jsx(FileText, { className: "mr-2 h-4 w-4 text-blue-500" }), jsxs("div", { className: "flex flex-col", children: [jsx("span", { children: "Microsoft Word" }), jsx("span", { className: "text-xs text-gray-500", children: ".docx" })] })] }), jsxs(DropdownMenuItem, { onClick:
|
|
246718
|
-
/* istanbul ignore next -- @preserve */ () => void handleExportMarkdown(), className: "cursor-pointer", children: [jsx(FileCode, { className: "mr-2 h-4 w-4 text-gray-600" }), jsxs("div", { className: "flex flex-col", children: [jsx("span", { children: "Markdown Document" }), jsx("span", { className: "text-xs text-gray-500", children: ".md" })] })] })] })] }), onClose && (jsx(Button$1, { variant: "ghost", size: "sm", className: "h-8 w-8 p-0", onClick: () => {
|
|
246476
|
+
: 'cursor-pointer', children: [jsx(ChevronRight, { className: "mr-2 h-4 w-4" }), "Next Version"] }), jsx(DropdownMenuSeparator, {}), jsxs("div", { className: "px-2 py-1.5 text-xs text-gray-500", children: ["Version ", currentVersionIndex + 1, " of ", versionHistory.length] })] })] }))] }), jsx("div", { className: cn('flex flex-shrink-0 flex-wrap items-center gap-0.5', (!isViewingCurrentVersion || isStreamingArtifact || isContentUpdating) &&
|
|
246477
|
+
'pointer-events-none opacity-60'), children: jsx(CanvasRichTextEditorToolbar, { editor: editor }) }), jsxs("div", { className: "ml-1 flex flex-shrink-0 items-center gap-1 sm:gap-2", children: [saveStatusLabel && (jsx("span", { className: `${saveStatusClass} hidden sm:inline`, children: saveStatusLabel })), jsxs(DropdownMenu, { children: [jsx(DropdownMenuTrigger, { asChild: true, children: jsx(Button$1, { variant: "outline", size: "sm", className: "flex items-center gap-1 border-blue-200 bg-transparent px-1 text-xs whitespace-nowrap text-blue-600 sm:px-2 md:px-3", disabled: isExporting || saveState === 'saving', children: isExporting ? (jsxs(Fragment$1, { children: [jsx("span", { className: "h-3 w-3 animate-spin rounded-full border-[2px] border-blue-400 border-t-transparent" }), jsx("span", { className: "hidden sm:inline", children: "Exporting\u2026" }), jsx("span", { className: "sm:hidden", children: "Export" })] })) : (jsxs(Fragment$1, { children: [jsx(Download, { className: "h-3.5 w-3.5 sm:mr-1" }), jsx("span", { className: "hidden sm:inline", children: "Export" })] })) }) }), jsxs(DropdownMenuContent, { align: "end", className: "w-56", children: [jsxs(DropdownMenuItem, { onClick: /* istanbul ignore next -- @preserve */ () => void handleExportPDF(), className: "cursor-pointer", children: [jsx(File$1, { className: "mr-2 h-4 w-4 text-red-500" }), jsxs("div", { className: "flex flex-col", children: [jsx("span", { children: "PDF Document" }), jsx("span", { className: "text-xs text-gray-500", children: ".pdf" })] })] }), jsxs(DropdownMenuItem, { onClick: /* istanbul ignore next -- @preserve */ () => void handleExportDOCX(), className: "cursor-pointer", children: [jsx(FileText, { className: "mr-2 h-4 w-4 text-blue-500" }), jsxs("div", { className: "flex flex-col", children: [jsx("span", { children: "Microsoft Word" }), jsx("span", { className: "text-xs text-gray-500", children: ".docx" })] })] }), jsxs(DropdownMenuItem, { onClick: /* istanbul ignore next -- @preserve */ () => void handleExportMarkdown(), className: "cursor-pointer", children: [jsx(FileCode, { className: "mr-2 h-4 w-4 text-gray-600" }), jsxs("div", { className: "flex flex-col", children: [jsx("span", { children: "Markdown Document" }), jsx("span", { className: "text-xs text-gray-500", children: ".md" })] })] })] })] }), onClose && (jsx(Button$1, { variant: "ghost", size: "sm", className: "h-8 w-8 p-0", onClick: () => {
|
|
246719
246478
|
void handleClose();
|
|
246720
|
-
}, children: jsx(X$2, { className: "h-4 w-4 text-gray-600" }) }))] })] }), !isViewingCurrentVersion && (jsxs("div", { className: "flex flex-col gap-2 border-b border-gray-200 bg-gray-50 px-3 py-2 sm:flex-row sm:items-center sm:justify-between sm:gap-3 sm:px-4 sm:py-3", children: [jsxs("div", { className: "min-w-0", children: [jsx("div", { className: "text-xs font-semibold text-gray-900 sm:text-sm", children: "You are viewing a previous version" }), jsx("div", { className: "hidden text-xs text-gray-600 sm:block", children: "Restore this version to make edits" })] }), jsxs("div", { className: "flex flex-shrink-0 items-center gap-2", children: [jsx(Button$1, { onClick: handleRestoreVersion, className: "rounded-md bg-gradient-to-r from-[#2563EB] to-[#93C5FD] px-2 text-xs text-white hover:opacity-90 sm:px-4 sm:text-sm", size: "sm", children: "Restore this version" }), jsxs(Button$1, { variant: "outline", onClick: handleBackToLatest, className: "rounded-md px-2 text-xs sm:px-4 sm:text-sm", size: "sm", children: [jsx("span", { className: "sm:hidden", children: "Latest" }), jsx("span", { className: "hidden sm:inline", children: "Back to latest version" })] })] })] })), jsxs("div", { className: "relative flex-1 overflow-x-hidden overflow-y-auto", style: { minHeight: 0 }, children: [isInitialLoading && (jsx("div", { className: "absolute inset-0 z-50 bg-white", children: jsx("div", { className: "w-full max-w-full px-6 py-4 sm:px-10 sm:py-6 md:px-16 md:py-8 lg:px-24", children: jsxs("div", { className: "animate-pulse space-y-4", children: [jsx("div", { className: "h-8 w-3/4 rounded bg-gray-200" }), jsx("div", { className: "h-4 w-full rounded bg-gray-200" }), jsx("div", { className: "h-4 w-5/6 rounded bg-gray-200" }), jsx("div", { className: "h-4 w-full rounded bg-gray-200" }), jsx("div", { className: "h-4 w-4/5 rounded bg-gray-200" }), jsxs("div", { className: "mt-6 space-y-2", children: [jsx("div", { className: "h-4 w-full rounded bg-gray-200" }), jsx("div", { className: "h-4 w-full rounded bg-gray-200" }), jsx("div", { className: "h-4 w-3/4 rounded bg-gray-200" })] }), jsx("div", { className: "mt-6 h-6 w-1/2 rounded bg-gray-200" }), jsx("div", { className: "h-4 w-full rounded bg-gray-200" }), jsx("div", { className: "h-4 w-5/6 rounded bg-gray-200" }), jsx("div", { className: "h-4 w-full rounded bg-gray-200" })] }) }) })), jsx("div", { ref: editorContentRef, className: "w-full max-w-full px-6 py-4 sm:px-10 sm:py-6 md:px-16 md:py-8 lg:px-24", children: jsx(CanvasRichTextEditorContent, { editor: editor }) }), !isMobile &&
|
|
246721
|
-
isViewingCurrentVersion &&
|
|
246722
|
-
!isStreamingArtifact &&
|
|
246723
|
-
!isContentUpdating && (jsx(CanvasControls, { sendFullArtifactUpdate: sendFullArtifactUpdate }))] }), showHighlightPopup && selectedText && (jsx("div", { className: "highlight-popup fixed z-[9999]", "data-testid": "canvas-highlight-popup", style: {
|
|
246479
|
+
}, children: jsx(X$2, { className: "h-4 w-4 text-gray-600" }) }))] })] }), !isViewingCurrentVersion && (jsxs("div", { className: "flex flex-col gap-2 border-b border-gray-200 bg-gray-50 px-3 py-2 sm:flex-row sm:items-center sm:justify-between sm:gap-3 sm:px-4 sm:py-3", children: [jsxs("div", { className: "min-w-0", children: [jsx("div", { className: "text-xs font-semibold text-gray-900 sm:text-sm", children: "You are viewing a previous version" }), jsx("div", { className: "hidden text-xs text-gray-600 sm:block", children: "Restore this version to make edits" })] }), jsxs("div", { className: "flex flex-shrink-0 items-center gap-2", children: [jsx(Button$1, { onClick: handleRestoreVersion, className: "rounded-md bg-gradient-to-r from-[#2563EB] to-[#93C5FD] px-2 text-xs text-white hover:opacity-90 sm:px-4 sm:text-sm", size: "sm", children: "Restore this version" }), jsxs(Button$1, { variant: "outline", onClick: handleBackToLatest, className: "rounded-md px-2 text-xs sm:px-4 sm:text-sm", size: "sm", children: [jsx("span", { className: "sm:hidden", children: "Latest" }), jsx("span", { className: "hidden sm:inline", children: "Back to latest version" })] })] })] })), jsxs("div", { className: "relative flex-1 overflow-x-hidden overflow-y-auto", style: { minHeight: 0 }, children: [isInitialLoading && (jsx("div", { className: "absolute inset-0 z-50 bg-white", children: jsx("div", { className: "w-full max-w-full px-6 py-4 sm:px-10 sm:py-6 md:px-16 md:py-8 lg:px-24", children: jsxs("div", { className: "animate-pulse space-y-4", children: [jsx("div", { className: "h-8 w-3/4 rounded bg-gray-200" }), jsx("div", { className: "h-4 w-full rounded bg-gray-200" }), jsx("div", { className: "h-4 w-5/6 rounded bg-gray-200" }), jsx("div", { className: "h-4 w-full rounded bg-gray-200" }), jsx("div", { className: "h-4 w-4/5 rounded bg-gray-200" }), jsxs("div", { className: "mt-6 space-y-2", children: [jsx("div", { className: "h-4 w-full rounded bg-gray-200" }), jsx("div", { className: "h-4 w-full rounded bg-gray-200" }), jsx("div", { className: "h-4 w-3/4 rounded bg-gray-200" })] }), jsx("div", { className: "mt-6 h-6 w-1/2 rounded bg-gray-200" }), jsx("div", { className: "h-4 w-full rounded bg-gray-200" }), jsx("div", { className: "h-4 w-5/6 rounded bg-gray-200" }), jsx("div", { className: "h-4 w-full rounded bg-gray-200" })] }) }) })), jsx("div", { ref: editorContentRef, className: "w-full max-w-full px-6 py-4 sm:px-10 sm:py-6 md:px-16 md:py-8 lg:px-24", children: jsx(CanvasRichTextEditorContent, { editor: editor }) }), !isMobile && isViewingCurrentVersion && !isStreamingArtifact && !isContentUpdating && (jsx(CanvasControls, { sendFullArtifactUpdate: sendFullArtifactUpdate }))] }), showHighlightPopup && selectedText && (jsx("div", { className: "highlight-popup fixed z-[9999]", "data-testid": "canvas-highlight-popup", style: {
|
|
246724
246480
|
left: `${selectedText.rect.left}px`,
|
|
246725
246481
|
top: `${selectedText.rect.bottom + 8}px`,
|
|
246726
|
-
}, onMouseDown:
|
|
246727
|
-
/* istanbul ignore next -- @preserve */ (e) => e.stopPropagation(), onMouseUp:
|
|
246728
|
-
/* istanbul ignore next -- @preserve */ (e) => e.stopPropagation(), children: jsxs("div", { className: "flex w-[min(90vw,420px)] max-w-[420px] items-center gap-2.5 rounded-xl border border-gray-200/70 bg-white px-3.5 py-2.5 shadow-md", children: [jsx(Image$4, { src: "/icons/my-mentors.svg", alt: "Ask Anything", width: 20, height: 20 }), jsx("input", { id: "partial-update-input", ref: highlightInputRef, type: "text", value: highlightInput, onChange:
|
|
246482
|
+
}, onMouseDown: /* istanbul ignore next -- @preserve */ (e) => e.stopPropagation(), onMouseUp: /* istanbul ignore next -- @preserve */ (e) => e.stopPropagation(), children: jsxs("div", { className: "flex w-[min(90vw,420px)] max-w-[420px] items-center gap-2.5 rounded-xl border border-gray-200/70 bg-white px-3.5 py-2.5 shadow-md", children: [jsx(Image$4, { src: "/icons/my-mentors.svg", alt: "Ask Anything", width: 20, height: 20 }), jsx("input", { id: "partial-update-input", ref: highlightInputRef, type: "text", value: highlightInput, onChange:
|
|
246729
246483
|
/* istanbul ignore next -- @preserve DOM event */ (e) => setHighlightInput(e.target.value), onKeyDown:
|
|
246730
246484
|
/* istanbul ignore next -- @preserve DOM event */ (e) => {
|
|
246731
246485
|
const keyAction = getHighlightInputKeyAction(e.key);
|
|
@@ -247058,9 +246812,7 @@ metadata, sessionId, tenantKey, sendMessage, refreshTrigger, }) {
|
|
|
247058
246812
|
// Update refresh key when trigger changes OR artifactId changes to force component remount
|
|
247059
246813
|
useEffect(() => {
|
|
247060
246814
|
const artifactIdChanged = artifactId !== prevArtifactIdRef.current;
|
|
247061
|
-
const triggerChanged = refreshTrigger &&
|
|
247062
|
-
refreshTrigger > 0 &&
|
|
247063
|
-
refreshTrigger !== prevRefreshTriggerRef.current;
|
|
246815
|
+
const triggerChanged = refreshTrigger && refreshTrigger > 0 && refreshTrigger !== prevRefreshTriggerRef.current;
|
|
247064
246816
|
if (triggerChanged || artifactIdChanged) {
|
|
247065
246817
|
if (triggerChanged) {
|
|
247066
246818
|
refreshKeyRef.current = refreshTrigger;
|
|
@@ -247819,12 +247571,10 @@ var Corner = ScrollAreaCorner;
|
|
|
247819
247571
|
|
|
247820
247572
|
const ScrollArea = React.forwardRef(({ className, children, ...props }, ref) => (jsxs(Root, { ref: ref, className: cn('relative overflow-hidden', className), ...props, children: [jsx(Viewport, { className: "h-full w-full rounded-[inherit]", children: children }), jsx(ScrollBar, {}), jsx(Corner, {})] })));
|
|
247821
247573
|
ScrollArea.displayName = Root.displayName;
|
|
247822
|
-
const ScrollBar = React.forwardRef(({ className, orientation = 'vertical', ...props }, ref) => (jsx(ScrollAreaScrollbar, { ref: ref, orientation: orientation, className: cn('flex touch-none transition-colors select-none', orientation === 'vertical' &&
|
|
247823
|
-
'h-full w-2.5 border-l border-l-transparent p-[1px]', orientation === 'horizontal' &&
|
|
247824
|
-
'h-2.5 flex-col border-t border-t-transparent p-[1px]', className), ...props, children: jsx(ScrollAreaThumb, { className: "bg-border relative flex-1 rounded-full" }) })));
|
|
247574
|
+
const ScrollBar = React.forwardRef(({ className, orientation = 'vertical', ...props }, ref) => (jsx(ScrollAreaScrollbar, { ref: ref, orientation: orientation, className: cn('flex touch-none transition-colors select-none', orientation === 'vertical' && 'h-full w-2.5 border-l border-l-transparent p-[1px]', orientation === 'horizontal' && 'h-2.5 flex-col border-t border-t-transparent p-[1px]', className), ...props, children: jsx(ScrollAreaThumb, { className: "bg-border relative flex-1 rounded-full" }) })));
|
|
247825
247575
|
ScrollBar.displayName = ScrollAreaScrollbar.displayName;
|
|
247826
247576
|
|
|
247827
|
-
function DisclaimerModal({ isOpen, onAgree, isAgreeing, content
|
|
247577
|
+
function DisclaimerModal({ isOpen, onAgree, isAgreeing, content }) {
|
|
247828
247578
|
return (jsx(Dialog, { open: isOpen, children: jsxs(DialogContent, { className: "max-h-[90vh] max-w-2xl gap-0 p-0", showCloseButton: false, children: [jsxs(DialogHeader, { className: "p-6 pb-4", children: [jsx(DialogTitle, { className: "text-left text-xl font-semibold", children: "User Agreement" }), jsx(Separator, { className: "mt-4" })] }), jsxs("div", { className: "flex h-full flex-col", children: [jsx(ScrollArea, { className: "max-h-[60vh] flex-1 px-6", children: jsx("div", { className: "space-y-4 pb-4 text-sm leading-relaxed", children: jsx("div", { className: "text-gray-700", children: jsx(Markdown, { children: parsePrompt(content !== null && content !== void 0 ? content : '') }) }) }) }), jsx("div", { className: "border-t p-6 pt-4", children: jsx(Button$1, { onClick: onAgree, className: "ibl-button-primary w-full", disabled: isAgreeing, children: isAgreeing ? 'Submitting...' : 'I Accept' }) })] })] }) }));
|
|
247829
247579
|
}
|
|
247830
247580
|
|