@promptbook/components 0.104.0-0 → 0.104.0-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/esm/index.es.js +386 -145
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/types.index.d.ts +6 -2
  4. package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +6 -1
  5. package/esm/typings/src/book-components/Chat/Chat/ChatMessageItem.d.ts +5 -1
  6. package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +5 -0
  7. package/esm/typings/src/book-components/Chat/CodeBlock/CodeBlock.d.ts +13 -0
  8. package/esm/typings/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +1 -0
  9. package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +2 -2
  10. package/esm/typings/src/book-components/_common/MenuHoisting/MenuHoistingContext.d.ts +56 -0
  11. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +13 -7
  12. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +6 -0
  13. package/esm/typings/src/commitments/DICTIONARY/DICTIONARY.d.ts +46 -0
  14. package/esm/typings/src/commitments/index.d.ts +2 -1
  15. package/esm/typings/src/llm-providers/ollama/OllamaExecutionTools.d.ts +1 -1
  16. package/esm/typings/src/llm-providers/openai/createOpenAiCompatibleExecutionTools.d.ts +1 -1
  17. package/esm/typings/src/types/typeAliases.d.ts +12 -0
  18. package/esm/typings/src/utils/environment/$detectRuntimeEnvironment.d.ts +4 -4
  19. package/esm/typings/src/utils/environment/$isRunningInBrowser.d.ts +1 -1
  20. package/esm/typings/src/utils/environment/$isRunningInJest.d.ts +1 -1
  21. package/esm/typings/src/utils/environment/$isRunningInNode.d.ts +1 -1
  22. package/esm/typings/src/utils/environment/$isRunningInWebWorker.d.ts +1 -1
  23. package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +2 -2
  24. package/esm/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +2 -2
  25. package/esm/typings/src/utils/random/$randomBase58.d.ts +12 -0
  26. package/esm/typings/src/version.d.ts +1 -1
  27. package/package.json +1 -2
  28. package/umd/index.umd.js +394 -154
  29. package/umd/index.umd.js.map +1 -1
package/esm/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
- import { useMemo, useEffect, useState, useRef, useCallback, forwardRef, memo } from 'react';
2
+ import { useMemo, useEffect, useState, useRef, createContext, useContext, useCallback, forwardRef, memo } from 'react';
3
3
  import spaceTrim$2, { spaceTrim as spaceTrim$1 } from 'spacetrim';
4
4
  import { SHA256 } from 'crypto-js';
5
5
  import hexEncoder from 'crypto-js/enc-hex';
@@ -8,8 +8,8 @@ import { randomBytes } from 'crypto';
8
8
  import { createPortal } from 'react-dom';
9
9
  import Editor, { useMonaco } from '@monaco-editor/react';
10
10
  import { Registration } from 'destroyable';
11
- import hljs from 'highlight.js';
12
11
  import katex from 'katex';
12
+ import { createRoot } from 'react-dom/client';
13
13
  import { Converter } from 'showdown';
14
14
  import { BehaviorSubject, Subject } from 'rxjs';
15
15
  import { forTime } from 'waitasecond';
@@ -35,7 +35,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
35
35
  * @generated
36
36
  * @see https://github.com/webgptorg/promptbook
37
37
  */
38
- const PROMPTBOOK_ENGINE_VERSION = '0.104.0-0';
38
+ const PROMPTBOOK_ENGINE_VERSION = '0.104.0-2';
39
39
  /**
40
40
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
41
41
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -84,9 +84,9 @@ function styleInject(css, ref) {
84
84
  }
85
85
  }
86
86
 
87
- var css_248z$9 = ".AvatarChip-module_AvatarChip__4sA0u{align-items:center;background:#e0e7ef;border:1px solid #b3c2d1;border-radius:16px;color:#2a3b4d;cursor:pointer;display:inline-flex;font-size:.95em;font-weight:500;margin:2px;padding:4px 12px}.AvatarChip-module_Avatar__mN2sc{border-radius:50%;height:24px;margin-right:8px;object-fit:cover;width:24px}.AvatarChip-module_TemplateLabel__-7vVI{background:#f0f4f8;border-radius:12px;color:#3a4752;font-size:.8em;margin-left:8px;margin-right:0;padding:2px 6px;text-transform:uppercase}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkF2YXRhckNoaXAubW9kdWxlLmNzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxxQ0FFSSxrQkFBbUIsQ0FHbkIsa0JBQW1CLENBS25CLHdCQUF5QixDQU56QixrQkFBbUIsQ0FFbkIsYUFBYyxDQU1kLGNBQWUsQ0FYZixtQkFBb0IsQ0FPcEIsZUFBaUIsQ0FEakIsZUFBZ0IsQ0FFaEIsVUFBVyxDQU5YLGdCQVVKLENBRUEsaUNBR0ksaUJBQWtCLENBRGxCLFdBQVksQ0FHWixnQkFBaUIsQ0FEakIsZ0JBQWlCLENBSGpCLFVBS0osQ0FFQSx3Q0FDSSxrQkFBbUIsQ0FJbkIsa0JBQW1CLENBSG5CLGFBQWMsQ0FDZCxjQUFnQixDQUdoQixlQUFnQixDQUNoQixjQUFlLENBSGYsZUFBZ0IsQ0FJaEIsd0JBQ0oiLCJmaWxlIjoiQXZhdGFyQ2hpcC5tb2R1bGUuY3NzIiwic291cmNlc0NvbnRlbnQiOlsiLkF2YXRhckNoaXAge1xuICAgIGRpc3BsYXk6IGlubGluZS1mbGV4O1xuICAgIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gICAgcGFkZGluZzogNHB4IDEycHg7XG4gICAgYm9yZGVyLXJhZGl1czogMTZweDtcbiAgICBiYWNrZ3JvdW5kOiAjZTBlN2VmO1xuICAgIGNvbG9yOiAjMmEzYjRkO1xuICAgIGZvbnQtd2VpZ2h0OiA1MDA7XG4gICAgZm9udC1zaXplOiAwLjk1ZW07XG4gICAgbWFyZ2luOiAycHg7XG4gICAgYm9yZGVyOiAxcHggc29saWQgI2IzYzJkMTtcblxuICAgIGN1cnNvcjogcG9pbnRlcjtcbn1cblxuLkF2YXRhciB7XG4gICAgd2lkdGg6IDI0cHg7XG4gICAgaGVpZ2h0OiAyNHB4O1xuICAgIGJvcmRlci1yYWRpdXM6IDUwJTtcbiAgICBvYmplY3QtZml0OiBjb3ZlcjtcbiAgICBtYXJnaW4tcmlnaHQ6IDhweDtcbn1cblxuLlRlbXBsYXRlTGFiZWwge1xuICAgIGJhY2tncm91bmQ6ICNmMGY0Zjg7XG4gICAgY29sb3I6ICMzYTQ3NTI7XG4gICAgZm9udC1zaXplOiAwLjhlbTtcbiAgICBwYWRkaW5nOiAycHggNnB4O1xuICAgIGJvcmRlci1yYWRpdXM6IDEycHg7XG4gICAgbWFyZ2luLWxlZnQ6IDhweDtcbiAgICBtYXJnaW4tcmlnaHQ6IDA7XG4gICAgdGV4dC10cmFuc2Zvcm06IHVwcGVyY2FzZTtcbn1cbiJdfQ== */";
88
- var styles$8 = {"AvatarChip":"AvatarChip-module_AvatarChip__4sA0u","Avatar":"AvatarChip-module_Avatar__mN2sc","TemplateLabel":"AvatarChip-module_TemplateLabel__-7vVI"};
89
- styleInject(css_248z$9);
87
+ var css_248z$a = ".AvatarChip-module_AvatarChip__4sA0u{align-items:center;background:#e0e7ef;border:1px solid #b3c2d1;border-radius:16px;color:#2a3b4d;cursor:pointer;display:inline-flex;font-size:.95em;font-weight:500;margin:2px;padding:4px 12px}.AvatarChip-module_Avatar__mN2sc{border-radius:50%;height:24px;margin-right:8px;object-fit:cover;width:24px}.AvatarChip-module_TemplateLabel__-7vVI{background:#f0f4f8;border-radius:12px;color:#3a4752;font-size:.8em;margin-left:8px;margin-right:0;padding:2px 6px;text-transform:uppercase}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkF2YXRh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DhweDtcbn1cblxuLlRlbXBsYXRlTGFiZWwge1xuICAgIGJhY2tncm91bmQ6ICNmMGY0Zjg7XG4gICAgY29sb3I6ICMzYTQ3NTI7XG4gICAgZm9udC1zaXplOiAwLjhlbTtcbiAgICBwYWRkaW5nOiAycHggNnB4O1xuICAgIGJvcmRlci1yYWRpdXM6IDEycHg7XG4gICAgbWFyZ2luLWxlZnQ6IDhweDtcbiAgICBtYXJnaW4tcmlnaHQ6IDA7XG4gICAgdGV4dC10cmFuc2Zvcm06IHVwcGVyY2FzZTtcbn1cbiJdfQ== */";
88
+ var styles$9 = {"AvatarChip":"AvatarChip-module_AvatarChip__4sA0u","Avatar":"AvatarChip-module_Avatar__mN2sc","TemplateLabel":"AvatarChip-module_TemplateLabel__-7vVI"};
89
+ styleInject(css_248z$a);
90
90
 
91
91
  /**
92
92
  * Shows a chip with avatar's avatar and name
@@ -96,7 +96,7 @@ styleInject(css_248z$9);
96
96
  function AvatarChip(props) {
97
97
  const { avatarBasicInformation, className, onSelect, isSelected, isTemplate } = props;
98
98
  const { agentName, meta } = avatarBasicInformation;
99
- return (jsxs("div", { className: classNames(styles$8.AvatarChip, className, isSelected ? styles$8.Selected : undefined), onClick: () => onSelect === null || onSelect === void 0 ? void 0 : onSelect(avatarBasicInformation), style: { cursor: onSelect ? 'pointer' : undefined }, children: [jsx("img", { src: meta.image, alt: agentName || '', className: styles$8.Avatar }), meta.fullname || agentName, isTemplate && jsx("span", { className: styles$8.TemplateLabel, children: "Template" })] }));
99
+ return (jsxs("div", { className: classNames(styles$9.AvatarChip, className, isSelected ? styles$9.Selected : undefined), onClick: () => onSelect === null || onSelect === void 0 ? void 0 : onSelect(avatarBasicInformation), style: { cursor: onSelect ? 'pointer' : undefined }, children: [jsx("img", { src: meta.image, alt: agentName || '', className: styles$9.Avatar }), meta.fullname || agentName, isTemplate && jsx("span", { className: styles$9.TemplateLabel, children: "Template" })] }));
100
100
  }
101
101
 
102
102
  /**
@@ -3047,13 +3047,14 @@ function prompt(strings, ...values) {
3047
3047
  *
3048
3048
  * @public exported from `@promptbook/utils`
3049
3049
  */
3050
- const $isRunningInBrowser = new Function(`
3050
+ function $isRunningInBrowser() {
3051
3051
  try {
3052
- return this === window;
3053
- } catch (e) {
3052
+ return typeof window !== 'undefined' && typeof window.document !== 'undefined';
3053
+ }
3054
+ catch (e) {
3054
3055
  return false;
3055
3056
  }
3056
- `);
3057
+ }
3057
3058
  /**
3058
3059
  * TODO: [🎺]
3059
3060
  */
@@ -3065,13 +3066,15 @@ const $isRunningInBrowser = new Function(`
3065
3066
  *
3066
3067
  * @public exported from `@promptbook/utils`
3067
3068
  */
3068
- const $isRunningInJest = new Function(`
3069
+ function $isRunningInJest() {
3070
+ var _a;
3069
3071
  try {
3070
- return process.env.JEST_WORKER_ID !== undefined;
3071
- } catch (e) {
3072
+ return typeof process !== 'undefined' && ((_a = process.env) === null || _a === void 0 ? void 0 : _a.JEST_WORKER_ID) !== undefined;
3073
+ }
3074
+ catch (e) {
3072
3075
  return false;
3073
3076
  }
3074
- `);
3077
+ }
3075
3078
  /**
3076
3079
  * TODO: [🎺]
3077
3080
  */
@@ -3083,13 +3086,14 @@ const $isRunningInJest = new Function(`
3083
3086
  *
3084
3087
  * @public exported from `@promptbook/utils`
3085
3088
  */
3086
- const $isRunningInNode = new Function(`
3089
+ function $isRunningInNode() {
3087
3090
  try {
3088
- return this === global;
3089
- } catch (e) {
3091
+ return typeof process !== 'undefined' && process.versions != null && process.versions.node != null;
3092
+ }
3093
+ catch (e) {
3090
3094
  return false;
3091
3095
  }
3092
- `);
3096
+ }
3093
3097
  /**
3094
3098
  * TODO: [🎺]
3095
3099
  */
@@ -3101,17 +3105,17 @@ const $isRunningInNode = new Function(`
3101
3105
  *
3102
3106
  * @public exported from `@promptbook/utils`
3103
3107
  */
3104
- const $isRunningInWebWorker = new Function(`
3108
+ function $isRunningInWebWorker() {
3105
3109
  try {
3106
- if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {
3107
- return true;
3108
- } else {
3109
- return false;
3110
- }
3111
- } catch (e) {
3110
+ // Note: Check for importScripts which is specific to workers
3111
+ // and not available in the main browser thread
3112
+ return (typeof self !== 'undefined' &&
3113
+ typeof self.importScripts === 'function');
3114
+ }
3115
+ catch (e) {
3112
3116
  return false;
3113
3117
  }
3114
- `);
3118
+ }
3115
3119
  /**
3116
3120
  * TODO: [🎺]
3117
3121
  */
@@ -4127,6 +4131,114 @@ class DeleteCommitmentDefinition extends BaseCommitmentDefinition {
4127
4131
  * Note: [💞] Ignore a discrepancy between file name and entity name
4128
4132
  */
4129
4133
 
4134
+ /**
4135
+ * DICTIONARY commitment definition
4136
+ *
4137
+ * The DICTIONARY commitment defines specific terms and their meanings that the agent should use correctly
4138
+ * in its reasoning and responses. This ensures consistent terminology usage.
4139
+ *
4140
+ * Key features:
4141
+ * - Multiple DICTIONARY commitments are automatically merged into one
4142
+ * - Content is placed in a dedicated section of the system message
4143
+ * - Terms and definitions are stored in metadata.DICTIONARY for debugging
4144
+ * - Agent should use the defined terms correctly in responses
4145
+ *
4146
+ * Example usage in agent source:
4147
+ *
4148
+ * ```book
4149
+ * Legal Assistant
4150
+ *
4151
+ * PERSONA You are a knowledgeable legal assistant
4152
+ * DICTIONARY Misdemeanor is a minor wrongdoing or criminal offense
4153
+ * DICTIONARY Felony is a serious crime usually punishable by imprisonment for more than one year
4154
+ * DICTIONARY Tort is a civil wrong that causes harm or loss to another person, leading to legal liability
4155
+ * ```
4156
+ *
4157
+ * @private [🪔] Maybe export the commitments through some package
4158
+ */
4159
+ class DictionaryCommitmentDefinition extends BaseCommitmentDefinition {
4160
+ constructor() {
4161
+ super('DICTIONARY');
4162
+ }
4163
+ /**
4164
+ * Short one-line description of DICTIONARY.
4165
+ */
4166
+ get description() {
4167
+ return 'Define terms and their meanings for consistent terminology usage.';
4168
+ }
4169
+ /**
4170
+ * Icon for this commitment.
4171
+ */
4172
+ get icon() {
4173
+ return '📚';
4174
+ }
4175
+ /**
4176
+ * Markdown documentation for DICTIONARY commitment.
4177
+ */
4178
+ get documentation() {
4179
+ return spaceTrim$1(`
4180
+ # DICTIONARY
4181
+
4182
+ Defines specific terms and their meanings that the agent should use correctly in reasoning and responses.
4183
+
4184
+ ## Key aspects
4185
+
4186
+ - Multiple \`DICTIONARY\` commitments are merged together.
4187
+ - Terms are defined in the format: "Term is definition"
4188
+ - The agent should use these terms consistently in responses.
4189
+ - Definitions help ensure accurate and consistent terminology.
4190
+
4191
+ ## Examples
4192
+
4193
+ \`\`\`book
4194
+ Legal Assistant
4195
+
4196
+ PERSONA You are a knowledgeable legal assistant specializing in criminal law
4197
+ DICTIONARY Misdemeanor is a minor wrongdoing or criminal offense
4198
+ DICTIONARY Felony is a serious crime usually punishable by imprisonment for more than one year
4199
+ DICTIONARY Tort is a civil wrong that causes harm or loss to another person, leading to legal liability
4200
+ \`\`\`
4201
+
4202
+ \`\`\`book
4203
+ Medical Assistant
4204
+
4205
+ PERSONA You are a helpful medical assistant
4206
+ DICTIONARY Hypertension is persistently high blood pressure
4207
+ DICTIONARY Diabetes is a chronic condition that affects how the body processes blood sugar
4208
+ DICTIONARY Vaccine is a biological preparation that provides active immunity to a particular disease
4209
+ \`\`\`
4210
+ `);
4211
+ }
4212
+ applyToAgentModelRequirements(requirements, content) {
4213
+ var _a;
4214
+ const trimmedContent = content.trim();
4215
+ if (!trimmedContent) {
4216
+ return requirements;
4217
+ }
4218
+ // Get existing dictionary entries from metadata
4219
+ const existingDictionary = ((_a = requirements.metadata) === null || _a === void 0 ? void 0 : _a.DICTIONARY) || '';
4220
+ // Merge the new dictionary entry with existing entries
4221
+ const mergedDictionary = existingDictionary
4222
+ ? `${existingDictionary}\n${trimmedContent}`
4223
+ : trimmedContent;
4224
+ // Store the merged dictionary in metadata for debugging and inspection
4225
+ const updatedMetadata = {
4226
+ ...requirements.metadata,
4227
+ DICTIONARY: mergedDictionary,
4228
+ };
4229
+ // Create the dictionary section for the system message
4230
+ // Format: "# DICTIONARY\nTerm: definition\nTerm: definition..."
4231
+ const dictionarySection = `# DICTIONARY\n${mergedDictionary}`;
4232
+ return {
4233
+ ...this.appendToSystemMessage(requirements, dictionarySection),
4234
+ metadata: updatedMetadata,
4235
+ };
4236
+ }
4237
+ }
4238
+ /**
4239
+ * Note: [💞] Ignore a discrepancy between file name and entity name
4240
+ */
4241
+
4130
4242
  /**
4131
4243
  * FORMAT commitment definition
4132
4244
  *
@@ -6947,6 +7059,7 @@ const COMMITMENT_REGISTRY = [
6947
7059
  new DeleteCommitmentDefinition('CANCEL'),
6948
7060
  new DeleteCommitmentDefinition('DISCARD'),
6949
7061
  new DeleteCommitmentDefinition('REMOVE'),
7062
+ new DictionaryCommitmentDefinition(),
6950
7063
  new OpenCommitmentDefinition(),
6951
7064
  new ClosedCommitmentDefinition(),
6952
7065
  new UseBrowserCommitmentDefinition(),
@@ -7238,6 +7351,7 @@ function parseAgentSource(agentSource) {
7238
7351
  return {
7239
7352
  agentName: normalizeAgentName(parseResult.agentName || createDefaultAgentName(agentSource)),
7240
7353
  agentHash,
7354
+ permanentId: meta.id,
7241
7355
  personaDescription,
7242
7356
  initialMessage,
7243
7357
  meta,
@@ -7277,9 +7391,9 @@ function AvatarChipFromSource(props) {
7277
7391
  return jsx(AvatarChip, { avatarBasicInformation: avatarBasicInformation, ...props });
7278
7392
  }
7279
7393
 
7280
- var css_248z$8 = ".Modal-module_scrim__jKO-A{align-items:center;background-color:rgba(0,0,0,.5);display:flex;height:100%;justify-content:center;left:0;position:fixed;top:0;width:100%;z-index:9000000}.Modal-module_Modal__k49dY{background:#fff;border-radius:8px;max-height:90%;max-width:90%;min-height:30vh;min-width:50vw;overflow:auto;padding:20px;position:relative}.Modal-module_closeButton__dzf6l{background:transparent;border:none;cursor:pointer;font-size:24px;position:absolute;right:10px;top:10px}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIk1vZGFsLm1vZHVsZS5jc3MiXSwibmF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hdXRvO1xufVxuXG4uY2xvc2VCdXR0b24ge1xuICAgIHBvc2l0aW9uOiBhYnNvbHV0ZTtcbiAgICB0b3A6IDEwcHg7XG4gICAgcmlnaHQ6IDEwcHg7XG4gICAgYmFja2dyb3VuZDogdHJhbnNwYXJlbnQ7XG4gICAgYm9yZGVyOiBub25lO1xuICAgIGZvbnQtc2l6ZTogMjRweDtcbiAgICBjdXJzb3I6IHBvaW50ZXI7XG59XG4iXX0= */";
7281
- var styles$7 = {"scrim":"Modal-module_scrim__jKO-A","Modal":"Modal-module_Modal__k49dY","closeButton":"Modal-module_closeButton__dzf6l"};
7282
- styleInject(css_248z$8);
7394
+ var css_248z$9 = ".Modal-module_scrim__jKO-A{align-items:center;background-color:rgba(0,0,0,.5);display:flex;height:100%;justify-content:center;left:0;position:fixed;top:0;width:100%;z-index:9000000}.Modal-module_Modal__k49dY{background:#fff;border-radius:8px;max-height:90%;max-width:90%;min-height:30vh;min-width:50vw;overflow:auto;padding:20px;position:relative}.Modal-module_closeButton__dzf6l{background:transparent;border:none;cursor:pointer;font-size:24px;position:absolute;right:10px;top:10px}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIk1vZGFsLm1vZHVsZS5jc3MiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsMkJBU0ksa0JBQW1CLENBSG5CLCtCQUFvQyxDQUNwQyxZQUFhLENBRmIsV0FBWSxDQUdaLHNCQUF1QixDQUx2QixNQUFPLENBRlAsY0FBZSxDQUNmLEtBQU0sQ0FFTixVQUFXLENBTVgsZUFDSixDQUVBLDJCQUNJLGVBQWlCLENBRWpCLGlCQUFrQixDQUdsQixjQUFlLENBRGYsYUFBYyxDQUdkLGVBQWdCLENBRGhCLGNBQWUsQ0FFZixhQUFjLENBUGQsWUFBYSxDQUViLGlCQU1KLENBRUEsaUNBSUksc0JBQXVCLENBQ3ZCLFdBQVksQ0FFWixjQUFlLENBRGYsY0FBZSxDQUxmLGlCQUFrQixDQUVsQixVQUFXLENBRFgsUUFNSiIsImZpbGUiOiJNb2RhbC5tb2R1bGUuY3NzIiwic291cmNlc0NvbnRlbnQiOlsiLnNjcmltIHtcbiAgICBwb3NpdGlvbjogZml4ZWQ7XG4gICAgdG9wOiAwO1xuICAgIGxlZnQ6IDA7XG4gICAgd2lkdGg6IDEwMCU7XG4gICAgaGVpZ2h0OiAxMDAlO1xuICAgIGJhY2tncm91bmQtY29sb3I6IHJnYmEoMCwgMCwgMCwgMC41KTtcbiAgICBkaXNwbGF5OiBmbGV4O1xuICAgIGp1c3RpZnktY29udGVudDogY2VudGVyO1xuICAgIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gICAgei1pbmRleDogOTAwMDAwMDtcbn1cblxuLk1vZGFsIHtcbiAgICBiYWNrZ3JvdW5kOiB3aGl0ZTtcbiAgICBwYWRkaW5nOiAyMHB4O1xuICAgIGJvcmRlci1yYWRpdXM6IDhweDtcbiAgICBwb3NpdGlvbjogcmVsYXRpdmU7XG4gICAgbWF4LXdpZHRoOiA5MCU7XG4gICAgbWF4LWhlaWdodDogOTAlO1xuICAgIG1pbi13aWR0aDogNTB2dztcbiAgICBtaW4taGVpZ2h0OiAzMHZoO1xuICAgIG92ZXJmbG93OiBhdXRvO1xufVxuXG4uY2xvc2VCdXR0b24ge1xuICAgIHBvc2l0aW9uOiBhYnNvbHV0ZTtcbiAgICB0b3A6IDEwcHg7XG4gICAgcmlnaHQ6IDEwcHg7XG4gICAgYmFja2dyb3VuZDogdHJhbnNwYXJlbnQ7XG4gICAgYm9yZGVyOiBub25lO1xuICAgIGZvbnQtc2l6ZTogMjRweDtcbiAgICBjdXJzb3I6IHBvaW50ZXI7XG59XG4iXX0= */";
7395
+ var styles$8 = {"scrim":"Modal-module_scrim__jKO-A","Modal":"Modal-module_Modal__k49dY","closeButton":"Modal-module_closeButton__dzf6l"};
7396
+ styleInject(css_248z$9);
7283
7397
 
7284
7398
  /**
7285
7399
  *
@@ -7297,7 +7411,7 @@ function Modal({ children, onClose, className, }) {
7297
7411
  window.removeEventListener('keydown', handleKeyDown);
7298
7412
  };
7299
7413
  }, [onClose]);
7300
- return createPortal(jsx("div", { className: styles$7.scrim, onClick: onClose, children: jsxs("div", { className: classNames(styles$7.Modal, className), onClick: (e) => e.stopPropagation(), children: [jsx("button", { className: styles$7.closeButton, onClick: onClose, children: "\u00D7" }), children] }) }), document.body);
7414
+ return createPortal(jsx("div", { className: styles$8.scrim, onClick: onClose, children: jsxs("div", { className: classNames(styles$8.Modal, className), onClick: (e) => e.stopPropagation(), children: [jsx("button", { className: styles$8.closeButton, onClick: onClose, children: "\u00D7" }), children] }) }), document.body);
7301
7415
  }
7302
7416
 
7303
7417
  /**
@@ -7382,9 +7496,9 @@ const DEFAULT_BOOK = padBook(validateBook(spaceTrim$2(`
7382
7496
  // <- [🐱‍🚀] Buttons into genesis book
7383
7497
  // <- TODO: [🐱‍🚀] generateBookBoilerplate and deprecate `DEFAULT_BOOK`
7384
7498
 
7385
- var css_248z$7 = ".BookEditor-module_BookEditor__s-0PU{width:100%}.BookEditor-module_bookEditorContainer__wLMwM{box-sizing:border-box;height:100%;padding:10px 25px 0;position:relative;width:100%}.BookEditor-module_bookEditorContainer__wLMwM.BookEditor-module_isVerbose__VQ6iL{background-color:rgba(0,0,0,.05);outline:1px dotted rgba(0,0,0,.5)}.BookEditor-module_isVerbose__VQ6iL{outline:2px dotted #ff7526}.BookEditor-module_bookEditorWrapper__twppD{background-color:#fff;border:1px solid rgba(209,213,219,.8);border-radius:1rem;box-shadow:0 1px 2px 0 rgba(0,0,0,.05);overflow:hidden;padding-top:10px;transition:box-shadow .2s ease-in-out}.BookEditor-module_isVerbose__VQ6iL .BookEditor-module_bookEditorWrapper__twppD{overflow:visible}.BookEditor-module_bookEditorWrapper__twppD:hover{box-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -1px rgba(0,0,0,.06)}.BookEditor-module_bookEditorWrapper__twppD.BookEditor-module_isBorderRadiusDisabled__h1I3v{border-radius:0}.BookEditor-module_dropOverlay__xWWoX{align-items:center;background-color:rgba(0,0,0,.5);bottom:0;color:#fff;display:flex;font-size:1.5rem;justify-content:center;left:0;pointer-events:none;position:absolute;right:0;top:0;z-index:100}.BookEditor-module_bookEditorActionbar__KW6dc{position:absolute;right:55px;top:10px;z-index:100}.BookEditor-module_fullscreen__rktsl{border:none;border-radius:0;bottom:0;box-shadow:none;height:100%;left:0;padding-top:50px;position:fixed;right:0;top:0;width:100%;z-index:9999}.BookEditor-module_button__hS390{align-items:center;background-color:#fff;border:1px solid #d1d5db;border-radius:.375rem;box-shadow:0 1px 2px 0 rgba(0,0,0,.05);color:#374151;cursor:pointer;display:inline-flex;gap:.5rem;padding:.5rem 1rem;transition:all .2s ease-in-out}.BookEditor-module_button__hS390:hover{background-color:#f9fafb;border-color:#b7bcce;box-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px 0 rgba(0,0,0,.06)}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkJvb2tFZGl0b3IubW9kdWxlLmNzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxxQ0FFSSxVQUNKLENBRUEsOENBS0kscUJBQXNCLENBSHRCLFdBQVksQ0FFWixtQkFBb0IsQ0FEcEIsaUJBQWtCLENBRmxCLFVBS0osQ0FFQSxpRkFFSSxnQ0FBcUMsQ0FDckMsaUNBRUosQ0FFQSxvQ0FDSSwwQkFDSixDQUVBLDRDQUtJLHFCQUF1QixDQUR2QixxQ0FBMEMsQ0FGMUMsa0JBQW1CLENBSW5CLHNDQUEyQyxDQUwzQyxlQUFnQixDQUVoQixnQkFBaUIsQ0FJakIscUNBQ0osQ0FDQSxnRkFFSSxnQkFFSixDQUVBLGtEQUNJLHVFQUNKLENBVUEsNEZBQ0ksZUFDSixDQUVBLHNDQVNJLGtCQUFtQixDQUhuQiwrQkFBb0MsQ0FE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Bub25lO1xufVxuXG4uYnV0dG9uIHtcbiAgICBiYWNrZ3JvdW5kLWNvbG9yOiAjZmZmO1xuICAgIGJvcmRlcjogMXB4IHNvbGlkICNkMWQ1ZGI7XG4gICAgYm9yZGVyLXJhZGl1czogMC4zNzVyZW07XG4gICAgcGFkZGluZzogMC41cmVtIDFyZW07XG4gICAgY3Vyc29yOiBwb2ludGVyO1xuICAgIGRpc3BsYXk6IGlubGluZS1mbGV4O1xuICAgIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gICAgZ2FwOiAwLjVyZW07XG4gICAgY29sb3I6ICMzNzQxNTE7XG4gICAgYm94LXNoYWRvdzogMCAxcHggMnB4IDAgcmdiYSgwLCAwLCAwLCAwLjA1KTtcbiAgICB0cmFuc2l0aW9uOiBhbGwgMC4ycyBlYXNlLWluLW91dDtcbn1cblxuLmJ1dHRvbjpob3ZlciB7XG4gICAgYmFja2dyb3VuZC1jb2xvcjogI2Y5ZmFmYjtcbiAgICBib3JkZXItY29sb3I6ICNiN2JjY2U7XG4gICAgYm94LXNoYWRvdzogMCAxcHggM3B4IDAgcmdiYSgwLCAwLCAwLCAwLjEpLCAwIDFweCAycHggMCByZ2JhKDAsIDAsIDAsIDAuMDYpO1xufVxuIl19 */";
7386
- var styles$6 = {"BookEditor":"BookEditor-module_BookEditor__s-0PU","bookEditorContainer":"BookEditor-module_bookEditorContainer__wLMwM","isVerbose":"BookEditor-module_isVerbose__VQ6iL","bookEditorWrapper":"BookEditor-module_bookEditorWrapper__twppD","isBorderRadiusDisabled":"BookEditor-module_isBorderRadiusDisabled__h1I3v","dropOverlay":"BookEditor-module_dropOverlay__xWWoX","bookEditorActionbar":"BookEditor-module_bookEditorActionbar__KW6dc","fullscreen":"BookEditor-module_fullscreen__rktsl","button":"BookEditor-module_button__hS390"};
7387
- styleInject(css_248z$7);
7499
+ var css_248z$8 = ".BookEditor-module_BookEditor__s-0PU{width:100%}.BookEditor-module_bookEditorContainer__wLMwM{box-sizing:border-box;height:100%;padding:10px 25px 0;position:relative;width:100%}.BookEditor-module_bookEditorContainer__wLMwM.BookEditor-module_isVerbose__VQ6iL{background-color:rgba(0,0,0,.05);outline:1px dotted rgba(0,0,0,.5)}.BookEditor-module_isVerbose__VQ6iL{outline:2px dotted #ff7526}.BookEditor-module_bookEditorWrapper__twppD{background-color:#fff;border:1px solid rgba(209,213,219,.8);border-radius:1rem;box-shadow:0 1px 2px 0 rgba(0,0,0,.05);overflow:hidden;padding-top:10px;transition:box-shadow .2s ease-in-out}.BookEditor-module_isVerbose__VQ6iL .BookEditor-module_bookEditorWrapper__twppD{overflow:visible}.BookEditor-module_bookEditorWrapper__twppD:hover{box-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -1px rgba(0,0,0,.06)}.BookEditor-module_bookEditorWrapper__twppD.BookEditor-module_isBorderRadiusDisabled__h1I3v{border-radius:0}.BookEditor-module_dropOverlay__xWWoX{align-items:center;background-color:rgba(0,0,0,.5);bottom:0;color:#fff;display:flex;font-size:1.5rem;justify-content:center;left:0;pointer-events:none;position:absolute;right:0;top:0;z-index:100}.BookEditor-module_bookEditorActionbar__KW6dc{position:absolute;right:55px;top:10px;z-index:100}.BookEditor-module_fullscreen__rktsl{border:none;border-radius:0;bottom:0;box-shadow:none;height:100%;left:0;padding-top:50px;position:fixed;right:0;top:0;width:100%;z-index:9999}.BookEditor-module_button__hS390{align-items:center;background-color:#fff;border:1px solid #d1d5db;border-radius:.375rem;box-shadow:0 1px 2px 0 rgba(0,0,0,.05);color:#374151;cursor:pointer;display:inline-flex;gap:.5rem;padding:.5rem 1rem;transition:all .2s ease-in-out}.BookEditor-module_button__hS390:hover{background-color:#f9fafb;border-color:#b7bcce;box-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px 0 rgba(0,0,0,.06)}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkJvb2tFZGl0b3IubW9kdWxlLmNzcyJdLCJuYW1l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ycHggMCByZ2JhKDAsIDAsIDAsIDAuMDYpO1xufVxuIl19 */";
7500
+ var styles$7 = {"BookEditor":"BookEditor-module_BookEditor__s-0PU","bookEditorContainer":"BookEditor-module_bookEditorContainer__wLMwM","isVerbose":"BookEditor-module_isVerbose__VQ6iL","bookEditorWrapper":"BookEditor-module_bookEditorWrapper__twppD","isBorderRadiusDisabled":"BookEditor-module_isBorderRadiusDisabled__h1I3v","dropOverlay":"BookEditor-module_dropOverlay__xWWoX","bookEditorActionbar":"BookEditor-module_bookEditorActionbar__KW6dc","fullscreen":"BookEditor-module_fullscreen__rktsl","button":"BookEditor-module_button__hS390"};
7501
+ styleInject(css_248z$8);
7388
7502
 
7389
7503
  /**
7390
7504
  * Converts Blob, File or MediaSource to url using URL.createObjectURL
@@ -7504,6 +7618,101 @@ async function $induceBookDownload(book) {
7504
7618
  * Note: [🔵] Code in this file should never be published outside of `@promptbook/browser`
7505
7619
  */
7506
7620
 
7621
+ /**
7622
+ * Downloads a file with the given content and filename
7623
+ *
7624
+ * @private utility of `<Chat/>` component
7625
+ */
7626
+ function downloadFile(content, filename, mimeType) {
7627
+ const blob = new Blob([content], { type: mimeType });
7628
+ const url = URL.createObjectURL(blob);
7629
+ const link = document.createElement('a');
7630
+ link.href = url;
7631
+ link.download = filename;
7632
+ document.body.appendChild(link);
7633
+ link.click();
7634
+ document.body.removeChild(link);
7635
+ // Clean up the URL object
7636
+ setTimeout(() => URL.revokeObjectURL(url), 100);
7637
+ }
7638
+
7639
+ var css_248z$7 = ".CodeBlock-module_CodeBlock__6K33Z{border:1px solid #444;border-radius:5px;margin:10px 0;overflow:hidden}.CodeBlock-module_CodeBlockHeader__tfOwl{align-items:center;background-color:#2d2d2d;border-bottom:1px solid #444;color:#ccc;display:flex;font-size:.8em;justify-content:space-between;padding:5px 10px}.CodeBlock-module_CodeBlockButtons__rz1VO{display:flex;gap:8px}.CodeBlock-module_CopyButton__M07tp,.CodeBlock-module_CreateAgentButton__kUEnp,.CodeBlock-module_DownloadButton__ZTrzQ{align-items:center;background:transparent;border:none;color:#aaa;cursor:pointer;display:flex;font-size:inherit;gap:5px;padding:0;transition:color .2s}.CodeBlock-module_CopyButton__M07tp:hover,.CodeBlock-module_CreateAgentButton__kUEnp:hover,.CodeBlock-module_DownloadButton__ZTrzQ:hover{color:#fff}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvZGVCbG9jay5tb2R1bGUuY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLG1DQUlJLHFCQUFzQixDQUZ0QixpQkFBa0IsQ0FEbEIsYUFBYyxDQUVkLGVBRUosQ0FFQSx5Q0FRSSxrQkFBbUIsQ0FQbkIsd0JBQXlCLENBSXpCLDRCQUE2QixDQUg3QixVQUFXLENBSVgsWUFBYSxDQUZiLGNBQWdCLENBR2hCLDZCQUE4QixDQUo5QixnQkFNSixDQUVBLDBDQUNJLFlBQWEsQ0FDYixPQUNKLENBRUEsdUhBVUksa0JBQW1CLENBUG5CLHNCQUF1QixDQUN2QixXQUFZLENBQ1osVUFBVyxDQUNYLGNBQWUsQ0FHZixZQUFhLENBRmIsaUJBQWtCLENBSWxCLE9BQVEsQ0FIUixTQUFVLENBSVYsb0JBQ0osQ0FFQSx5SUFHSSxVQUNKIiwiZmlsZSI6IkNvZGVCbG9jay5tb2R1bGUuY3NzIiwic291cmNlc0NvbnRlbnQiOlsiLkNvZGVCbG9jayB7XG4gICAgbWFyZ2luOiAxMHB4IDA7XG4gICAgYm9yZGVyLXJhZGl1czogNXB4O1xuICAgIG92ZXJmbG93OiBoaWRkZW47XG4gICAgYm9yZGVyOiAxcHggc29saWQgIzQ0NDsgLyogRGFyayBtb2RlIGJvcmRlciAqL1xufVxuXG4uQ29kZUJsb2NrSGVhZGVyIHtcbiAgICBiYWNrZ3JvdW5kLWNvbG9yOiAjMmQyZDJkO1xuICAgIGNvbG9yOiAjY2NjO1xuICAgIHBhZGRpbmc6IDVweCAxMHB4O1xuICAgIGZvbnQtc2l6ZTogMC44ZW07XG4gICAgYm9yZGVyLWJvdHRvbTogMXB4IHNvbGlkICM0NDQ7XG4gICAgZGlzcGxheTogZmxleDtcbiAgICBqdXN0aWZ5LWNvbnRlbnQ6IHNwYWNlLWJldHdlZW47XG4gICAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbn1cblxuLkNvZGVCbG9ja0J1dHRvbnMge1xuICAgIGRpc3BsYXk6IGZsZXg7XG4gICAgZ2FwOiA4cHg7XG59XG5cbi5Db3B5QnV0dG9uLFxuLkRvd25sb2FkQnV0dG9uLFxuLkNyZWF0ZUFnZW50QnV0dG9uIHtcbiAgICBiYWNrZ3JvdW5kOiB0cmFuc3BhcmVudDtcbiAgICBib3JkZXI6IG5vbmU7XG4gICAgY29sb3I6ICNhYWE7XG4gICAgY3Vyc29yOiBwb2ludGVyO1xuICAgIGZvbnQtc2l6ZTogaW5oZXJpdDtcbiAgICBwYWRkaW5nOiAwO1xuICAgIGRpc3BsYXk6IGZsZXg7XG4gICAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbiAgICBnYXA6IDVweDtcbiAgICB0cmFuc2l0aW9uOiBjb2xvciAwLjJzO1xufVxuXG4uQ29weUJ1dHRvbjpob3Zlcixcbi5Eb3dubG9hZEJ1dHRvbjpob3Zlcixcbi5DcmVhdGVBZ2VudEJ1dHRvbjpob3ZlciB7XG4gICAgY29sb3I6ICNmZmY7XG59XG4iXX0= */";
7640
+ var styles$6 = {"CodeBlock":"CodeBlock-module_CodeBlock__6K33Z","CodeBlockHeader":"CodeBlock-module_CodeBlockHeader__tfOwl","CodeBlockButtons":"CodeBlock-module_CodeBlockButtons__rz1VO","CopyButton":"CodeBlock-module_CopyButton__M07tp","DownloadButton":"CodeBlock-module_DownloadButton__ZTrzQ","CreateAgentButton":"CodeBlock-module_CreateAgentButton__kUEnp"};
7641
+ styleInject(css_248z$7);
7642
+
7643
+ const LANGUAGE_EXTENSIONS = {
7644
+ python: 'py',
7645
+ javascript: 'js',
7646
+ typescript: 'ts',
7647
+ json: 'json',
7648
+ html: 'html',
7649
+ css: 'css',
7650
+ markdown: 'md',
7651
+ text: 'txt',
7652
+ xml: 'xml',
7653
+ sql: 'sql',
7654
+ sh: 'sh',
7655
+ bash: 'sh',
7656
+ zsh: 'sh',
7657
+ yaml: 'yaml',
7658
+ yml: 'yaml',
7659
+ book: 'book',
7660
+ };
7661
+ /**
7662
+ * Component to render a code block with syntax highlighting, copy, download, and create agent options.
7663
+ *
7664
+ * @private Internal utility of `<ChatMessage />` component
7665
+ */
7666
+ function CodeBlock({ code, language, className, onCreateAgent }) {
7667
+ const lines = useMemo(() => code.split('\n').length, [code]);
7668
+ // Note: 19px is approx line height for fontSize 14. +20 for padding.
7669
+ // We cap at 400px to avoid taking too much space, allowing scroll.
7670
+ const height = Math.min(Math.max(lines * 19, 19), 400);
7671
+ const [copied, setCopied] = useState(false);
7672
+ const handleDownload = () => {
7673
+ const lang = (language === null || language === void 0 ? void 0 : language.trim().toLowerCase()) || 'text';
7674
+ const extension = LANGUAGE_EXTENSIONS[lang] || lang;
7675
+ const filename = `file.${extension}`;
7676
+ downloadFile(code, filename, 'text/plain');
7677
+ };
7678
+ const handleCopy = async () => {
7679
+ try {
7680
+ await navigator.clipboard.writeText(code);
7681
+ setCopied(true);
7682
+ setTimeout(() => setCopied(false), 2000);
7683
+ }
7684
+ catch (error) {
7685
+ console.error('Failed to copy code to clipboard:', error);
7686
+ }
7687
+ };
7688
+ const header = language ? (jsxs("div", { className: styles$6.CodeBlockHeader, children: [jsx("span", { children: language }), jsxs("div", { className: styles$6.CodeBlockButtons, children: [jsx("button", { onClick: handleCopy, className: styles$6.CopyButton, title: "Copy to clipboard", children: copied ? 'Copied!' : 'Copy' }), jsx("button", { onClick: handleDownload, className: styles$6.DownloadButton, title: "Download code", children: "Download" }), (language === null || language === void 0 ? void 0 : language.trim().toLowerCase()) === 'book' && onCreateAgent && (jsx("button", { onClick: () => onCreateAgent(code), className: styles$6.CreateAgentButton, title: "Create agent from this book", children: "Create Agent" }))] })] })) : null;
7689
+ if ((language === null || language === void 0 ? void 0 : language.trim().toLowerCase()) === 'book') {
7690
+ return (jsxs("div", { className: classNames(styles$6.CodeBlock, className), children: [header, jsx(BookEditor, { value: code, isReadonly: true, height: lines * 25 /* <- [🧠] A bit more than 19px to accommodate BookEditor lines */ })] }));
7691
+ }
7692
+ return (jsxs("div", { className: classNames(styles$6.CodeBlock, className), children: [header, jsx(Editor, { height: `${height}px`, language: language || 'plaintext', value: code, theme: "vs-dark", options: {
7693
+ readOnly: true,
7694
+ minimap: { enabled: false },
7695
+ scrollBeyondLastLine: false,
7696
+ lineNumbers: 'on',
7697
+ folding: false,
7698
+ glyphMargin: false,
7699
+ fontFamily: 'Consolas, "Courier New", monospace',
7700
+ fontSize: 14,
7701
+ lineHeight: 19,
7702
+ overviewRulerLanes: 0,
7703
+ hideCursorInOverviewRuler: true,
7704
+ renderLineHighlight: 'none',
7705
+ contextmenu: false,
7706
+ scrollbar: {
7707
+ vertical: 'auto',
7708
+ horizontal: 'auto',
7709
+ useShadows: false,
7710
+ },
7711
+ domReadOnly: true,
7712
+ wordWrap: 'off',
7713
+ } })] }));
7714
+ }
7715
+
7507
7716
  var css_248z$6 = ".MarkdownContent-module_MarkdownContent__2JuyX h1{font-size:2em}.MarkdownContent-module_MarkdownContent__2JuyX h2{font-size:1.75em}.MarkdownContent-module_MarkdownContent__2JuyX h3{font-size:1.5em}.MarkdownContent-module_MarkdownContent__2JuyX h4{font-size:1.25em}.MarkdownContent-module_MarkdownContent__2JuyX h5{font-size:1.1em}.MarkdownContent-module_MarkdownContent__2JuyX p{text-wrap:auto}.MarkdownContent-module_MarkdownContent__2JuyX ul{list-style:disc;margin-left:20px}.MarkdownContent-module_MarkdownContent__2JuyX ol{list-style:decimal;margin-left:20px}.MarkdownContent-module_MarkdownContent__2JuyX blockquote,.MarkdownContent-module_MarkdownContent__2JuyX img,.MarkdownContent-module_MarkdownContent__2JuyX pre,.MarkdownContent-module_MarkdownContent__2JuyX table{border-radius:8px;margin-bottom:10px;margin-top:10px}.MarkdownContent-module_MarkdownContent__2JuyX pre{background:#000;border:none;box-shadow:none;color:#fff;display:block;font-size:inherit;line-height:inherit;padding:1em}.MarkdownContent-module_MarkdownContent__2JuyX blockquote{background:#ffffffcc;border:none;box-shadow:none;color:#000;display:block;font-size:inherit;line-height:inherit;padding:1em}.MarkdownContent-module_MarkdownContent__2JuyX code{background:#cccccc55;border:none;box-shadow:none;color:inherit;display:inline-block;font-size:inherit;line-height:inherit;margin:0;padding:0}.MarkdownContent-module_MarkdownContent__2JuyX pre code{background-color:#000000cc;border-radius:8px}.MarkdownContent-module_MarkdownContent__2JuyX .MarkdownContent-module_chat-code-block__ZffFg{background:#181c23;border-color:#23272f;box-shadow:0 2px 8px rgba(0,0,0,.12);color:#f8fafc;font-family:Fira Mono,Menlo,Consolas,Liberation Mono,monospace;font-size:14px;line-height:1.6;overflow-x:auto}.MarkdownContent-module_MarkdownContent__2JuyX .MarkdownContent-module_chat-code-block__ZffFg code{background:none!important;border:none!important;box-shadow:none!important;color:inherit!important;display:block;font-family:inherit!important;font-size:inherit!important;overflow-x:auto;padding:0!important;white-space:pre;word-break:break-word}.MarkdownContent-module_MarkdownContent__2JuyX table{background:#f8fafc;border-collapse:separate;border-spacing:0;box-shadow:0 2px 8px rgba(0,0,0,.08);color:#17223b;font-size:14px;margin:16px 0;width:100%}.MarkdownContent-module_MarkdownContent__2JuyX td,.MarkdownContent-module_MarkdownContent__2JuyX th{background:none;border-bottom:1px solid #d1dbe8;color:#17223b;padding:10px 16px;text-align:left}.MarkdownContent-module_MarkdownContent__2JuyX th{background:linear-gradient(90deg,#eaf3fa 80%,#d1e3f8);border-bottom:2px solid #b5c7de;color:#17223b;font-weight:700}.MarkdownContent-module_MarkdownContent__2JuyX tr:last-child td{border-bottom:none}.MarkdownContent-module_MarkdownContent__2JuyX tr:nth-child(2n) td{background:#eaf3fa}.MarkdownContent-module_MarkdownContent__2JuyX tr:hover td{background:#cbe0f7;transition:background .2s}.MarkdownContent-module_MarkdownContent__2JuyX table{border-radius:12px;overflow:hidden}.MarkdownContent-module_MarkdownContent__2JuyX td:first-child,.MarkdownContent-module_MarkdownContent__2JuyX th:first-child{border-top-left-radius:12px}.MarkdownContent-module_MarkdownContent__2JuyX td:last-child,.MarkdownContent-module_MarkdownContent__2JuyX th:last-child{border-top-right-radius:12px}.MarkdownContent-module_citation__11SMw{background:#e7f1ff;border-radius:4px;color:#007bff;cursor:default;display:inline-block;font-size:.7em;font-weight:700;margin:0 2px;padding:0 4px;user-select:none;vertical-align:super}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIk1hcmtkb3duQ29udGVudC5tb2R1bGUuY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGtEQUNJLGFBQ0osQ0FFQSxrREFDSSxnQkFDSixDQUVBLGtEQUNJLGVBQ0osQ0FFQSxrREFDSSxnQkFDSixDQUVBLGtEQUNJLGVBQ0osQ0FFQSxpREFDSSxjQUNKLENBRUEsa0RBQ0ksZUFBZ0IsQ0FDaEIsZ0JBQ0osQ0FFQSxrREFDSSxrQkFBbUIsQ0FDbkIsZ0JBQ0osQ0FFQSxxTkFNSSxpQkFBa0IsQ0FEbEIsa0JBQW1CLENBRG5CLGVBR0osQ0FFQSxtREFJSSxlQUFxQixDQUZyQixXQUFZLENBQ1osZUFBZ0IsQ0FJaEIsVUFBVyxDQU5YLGFBQWMsQ0FJZCxpQkFBa0IsQ0FDbEIsbUJBQW9CLENBRXBCLFdBQ0osQ0FFQSwwREFJSSxvQkFBcUIsQ0FGckIsV0FBWSxDQUNaLGVBQWdCLENBSWhCLFVBQVcsQ0FOWCxhQUFjLENBSWQsaUJBQWtCLENBQ2xCLG1CQUFvQixDQUVwQixXQUNKLENBRUEsb0RBTUksb0JBQXFCLENBRnJCLFdBQVksQ0FD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2hpbGQge1xuICAgIGJvcmRlci10b3AtbGVmdC1yYWRpdXM6IDEycHg7XG59XG4uTWFya2Rvd25Db250ZW50IHRoOmxhc3QtY2hpbGQsXG4uTWFya2Rvd25Db250ZW50IHRkOmxhc3QtY2hpbGQge1xuICAgIGJvcmRlci10b3AtcmlnaHQtcmFkaXVzOiAxMnB4O1xufVxuXG4uY2l0YXRpb24ge1xuICAgIGRpc3BsYXk6IGlubGluZS1ibG9jaztcbiAgICB2ZXJ0aWNhbC1hbGlnbjogc3VwZXI7XG4gICAgZm9udC1zaXplOiAwLjdlbTtcbiAgICBmb250LXdlaWdodDogYm9sZDtcbiAgICBjb2xvcjogIzAwN2JmZjtcbiAgICBiYWNrZ3JvdW5kOiAjZTdmMWZmO1xuICAgIHBhZGRpbmc6IDAgNHB4O1xuICAgIGJvcmRlci1yYWRpdXM6IDRweDtcbiAgICBtYXJnaW46IDAgMnB4O1xuICAgIGN1cnNvcjogZGVmYXVsdDtcbiAgICB1c2VyLXNlbGVjdDogbm9uZTtcbn1cblxuLyoqXG4gKiBUT0RPOiBb8J+MiV0gRFJZIE1hcmtkb3duIHByaW1pdGl2ZXMgc3R5bGluZ1xuICovXG4iXX0= */";
7508
7717
  var styles$5 = {"MarkdownContent":"MarkdownContent-module_MarkdownContent__2JuyX","chat-code-block":"MarkdownContent-module_chat-code-block__ZffFg","citation":"MarkdownContent-module_citation__11SMw"};
7509
7718
  styleInject(css_248z$6);
@@ -7606,32 +7815,8 @@ function renderMarkdown(markdown) {
7606
7815
  }
7607
7816
  try {
7608
7817
  const processedMarkdown = renderMathInMarkdown(markdown);
7609
- let html = chatMarkdownConverter.makeHtml(processedMarkdown);
7610
- if (typeof window === 'undefined') {
7611
- html = html.replace(/<pre><code( class="language-([^"]+)")?>([\s\S]*?)<\/code><\/pre>/g, (match, _langClass, lang, code) => {
7612
- const decoded = code
7613
- .replace(/&/g, '&')
7614
- .replace(/</g, '<')
7615
- .replace(/>/g, '>')
7616
- .replace(/"/g, '"')
7617
- .replace(/&#39;/g, "'");
7618
- const highlighted = lang
7619
- ? hljs.highlight(decoded, { language: lang }).value
7620
- : hljs.highlightAuto(decoded).value;
7621
- return `<pre class="chat-code-block"><code class="hljs${lang ? ' language-' + lang : ''}">${highlighted}</code></pre>`;
7622
- });
7623
- }
7624
- else {
7625
- if (html.match(/<pre><code/)) {
7626
- const cssId = 'hljs-github-dark-css';
7627
- if (!window.document.getElementById(cssId)) {
7628
- const link = window.document.createElement('link');
7629
- link.id = cssId;
7630
- link.rel = 'stylesheet';
7631
- link.href = 'https://book-components.ptbk.io/cdn/highlightjs/github-dark.css';
7632
- window.document.head.appendChild(link);
7633
- }
7634
- }
7818
+ const html = chatMarkdownConverter.makeHtml(processedMarkdown);
7819
+ if (typeof window !== 'undefined') {
7635
7820
  if (html.match(/class="katex/)) {
7636
7821
  const katexCssId = 'katex-css';
7637
7822
  if (!window.document.getElementById(katexCssId)) {
@@ -7642,38 +7827,6 @@ function renderMarkdown(markdown) {
7642
7827
  window.document.head.appendChild(link);
7643
7828
  }
7644
7829
  }
7645
- const parser = new window.DOMParser();
7646
- const doc = parser.parseFromString(html, 'text/html');
7647
- doc.querySelectorAll('pre > code').forEach((codeEl) => {
7648
- var _a;
7649
- const preEl = codeEl.parentElement;
7650
- if (!preEl)
7651
- return;
7652
- const lang = (_a = Array.from(codeEl.classList)
7653
- .find((cls) => cls.startsWith('language-'))) === null || _a === void 0 ? void 0 : _a.replace('language-', '');
7654
- const code = codeEl.innerHTML;
7655
- let highlighted = '';
7656
- try {
7657
- const decoded = code
7658
- .replace(/&/g, '&')
7659
- .replace(/</g, '<')
7660
- .replace(/>/g, '>')
7661
- .replace(/"/g, '"')
7662
- .replace(/&#39;/g, "'");
7663
- highlighted = lang
7664
- ? hljs.highlight(decoded, { language: lang }).value
7665
- : hljs.highlightAuto(decoded).value;
7666
- }
7667
- catch (_b) {
7668
- highlighted = code;
7669
- }
7670
- codeEl.innerHTML = highlighted;
7671
- codeEl.classList.add('hljs');
7672
- if (lang)
7673
- codeEl.classList.add(`language-${lang}`);
7674
- preEl.classList.add('chat-code-block');
7675
- });
7676
- html = doc.body.innerHTML;
7677
7830
  }
7678
7831
  const sanitizedHtml = html
7679
7832
  .replace(/<\s*(script|style|iframe|object|embed)[^>]*>[\s\S]*?<\s*\/\s*\1\s*>/gi, '')
@@ -7703,9 +7856,50 @@ function renderMarkdown(markdown) {
7703
7856
  * @public exported from `@promptbook/components`
7704
7857
  */
7705
7858
  function MarkdownContent(props) {
7706
- const { content, className } = props;
7859
+ const { content, className, onCreateAgent } = props;
7707
7860
  const htmlContent = useMemo(() => renderMarkdown(content), [content]);
7708
- return (jsx("div", { className: classNames(styles$5.MarkdownContent, className), dangerouslySetInnerHTML: {
7861
+ const containerRef = useRef(null);
7862
+ const rootsRef = useRef([]);
7863
+ useEffect(() => {
7864
+ // Cleanup previous roots
7865
+ rootsRef.current.forEach((root) => root.unmount());
7866
+ rootsRef.current = [];
7867
+ if (!containerRef.current) {
7868
+ return;
7869
+ }
7870
+ const preElements = containerRef.current.querySelectorAll('pre');
7871
+ preElements.forEach((pre) => {
7872
+ // Check if it is a code block (has code element)
7873
+ const codeElement = pre.querySelector('code');
7874
+ if (!codeElement) {
7875
+ return;
7876
+ }
7877
+ // Get language and code
7878
+ const className = codeElement.className; // e.g. language-python
7879
+ const match = className.match(/language-([^\s]+)/);
7880
+ const language = match ? match[1] : undefined;
7881
+ const code = codeElement.textContent || '';
7882
+ // Clear the pre element content
7883
+ pre.innerHTML = '';
7884
+ pre.className = ''; // remove existing classes if any
7885
+ pre.style.background = 'none'; // reset styles
7886
+ pre.style.padding = '0';
7887
+ pre.style.margin = '0';
7888
+ pre.style.overflow = 'visible';
7889
+ // Create a container for the CodeBlock
7890
+ const mountPoint = document.createElement('div');
7891
+ pre.appendChild(mountPoint);
7892
+ // Render CodeBlock
7893
+ const root = createRoot(mountPoint);
7894
+ root.render(jsx(CodeBlock, { code: code, language: language, onCreateAgent: onCreateAgent }));
7895
+ rootsRef.current.push(root);
7896
+ });
7897
+ return () => {
7898
+ rootsRef.current.forEach((root) => root.unmount());
7899
+ rootsRef.current = [];
7900
+ };
7901
+ }, [htmlContent, onCreateAgent]);
7902
+ return (jsx("div", { ref: containerRef, className: classNames(styles$5.MarkdownContent, className), dangerouslySetInnerHTML: {
7709
7903
  __html: htmlContent,
7710
7904
  } }));
7711
7905
  }
@@ -7922,6 +8116,16 @@ function Dropdown({ actions }) {
7922
8116
  }, children: [icon, jsx("span", { children: name })] }, name))) }))] }));
7923
8117
  }
7924
8118
 
8119
+ const MenuHoistingContext = createContext(null);
8120
+ /**
8121
+ * Hook to use the menu hoisting system
8122
+ *
8123
+ * @private mechanism inside Promptbook
8124
+ */
8125
+ function useMenuHoisting() {
8126
+ return useContext(MenuHoistingContext);
8127
+ }
8128
+
7925
8129
  /**
7926
8130
  *
7927
8131
  * @private Internal component used by `BookEditor`
@@ -7929,50 +8133,83 @@ function Dropdown({ actions }) {
7929
8133
  function BookEditorActionbar(props) {
7930
8134
  const { value, isDownloadButtonShown, isUploadButtonShown, isCameraButtonShown, isAboutButtonShown, isFullscreenButtonShown, onFullscreenClick, onUploadDocument, onTakePhoto, isFullscreen, } = props;
7931
8135
  const [isAboutModalOpen, setIsAboutModalOpen] = useState(false);
7932
- const handleDownload = () => {
7933
- const book = validateBook(value || DEFAULT_BOOK);
8136
+ const menuHoisting = useMenuHoisting();
8137
+ // Note: [1] We use ref to avoid re-creating the handleDownload function (and thus the actions array) on every value change
8138
+ const valueRef = useRef(value);
8139
+ useEffect(() => {
8140
+ valueRef.current = value;
8141
+ }, [value]);
8142
+ const handleDownload = useCallback(() => {
8143
+ const book = validateBook(valueRef.current || DEFAULT_BOOK);
7934
8144
  /* not await */ $induceBookDownload(book);
7935
- };
7936
- const actions = [];
7937
- if (isUploadButtonShown && onUploadDocument) {
7938
- actions.push({
7939
- icon: jsx(AttachmentIcon, {}),
7940
- name: 'Upload document',
7941
- onClick: onUploadDocument,
7942
- });
7943
- }
7944
- if (isCameraButtonShown && onTakePhoto) {
7945
- actions.push({
7946
- icon: jsx(CameraIcon, {}),
7947
- name: 'Take photo',
7948
- onClick: onTakePhoto,
7949
- });
7950
- }
7951
- if (isDownloadButtonShown) {
7952
- actions.push({
7953
- icon: jsx(DownloadIcon, {}),
7954
- name: 'Download',
7955
- onClick: handleDownload,
7956
- });
7957
- }
7958
- if (isAboutButtonShown) {
7959
- actions.push({
7960
- icon: jsx(AboutIcon, {}),
7961
- name: 'About',
7962
- onClick: () => setIsAboutModalOpen(true),
7963
- });
7964
- }
7965
- if (isFullscreenButtonShown && onFullscreenClick) {
7966
- actions.push({
7967
- icon: jsx(FullscreenIcon, {}),
7968
- name: 'Fullscreen',
7969
- onClick: onFullscreenClick,
7970
- });
7971
- }
8145
+ }, []);
8146
+ const actions = useMemo(() => {
8147
+ const _actions = [];
8148
+ if (isUploadButtonShown && onUploadDocument) {
8149
+ _actions.push({
8150
+ icon: jsx(AttachmentIcon, {}),
8151
+ name: 'Upload document',
8152
+ onClick: onUploadDocument,
8153
+ });
8154
+ }
8155
+ if (isCameraButtonShown && onTakePhoto) {
8156
+ _actions.push({
8157
+ icon: jsx(CameraIcon, {}),
8158
+ name: 'Take photo',
8159
+ onClick: onTakePhoto,
8160
+ });
8161
+ }
8162
+ if (isDownloadButtonShown) {
8163
+ _actions.push({
8164
+ icon: jsx(DownloadIcon, {}),
8165
+ name: 'Download',
8166
+ onClick: handleDownload,
8167
+ });
8168
+ }
8169
+ if (isAboutButtonShown) {
8170
+ _actions.push({
8171
+ icon: jsx(AboutIcon, {}),
8172
+ name: 'About',
8173
+ onClick: () => setIsAboutModalOpen(true),
8174
+ });
8175
+ }
8176
+ if (isFullscreenButtonShown && onFullscreenClick) {
8177
+ _actions.push({
8178
+ icon: jsx(FullscreenIcon, {}),
8179
+ name: 'Fullscreen',
8180
+ onClick: onFullscreenClick,
8181
+ });
8182
+ }
8183
+ return _actions;
8184
+ }, [
8185
+ isUploadButtonShown,
8186
+ onUploadDocument,
8187
+ isCameraButtonShown,
8188
+ onTakePhoto,
8189
+ isDownloadButtonShown,
8190
+ handleDownload,
8191
+ isAboutButtonShown,
8192
+ isFullscreenButtonShown,
8193
+ onFullscreenClick,
8194
+ ]);
8195
+ useEffect(() => {
8196
+ if (!menuHoisting || isFullscreen) {
8197
+ return;
8198
+ }
8199
+ menuHoisting.setMenu(actions);
8200
+ return () => {
8201
+ menuHoisting.setMenu([]);
8202
+ };
8203
+ }, [menuHoisting, actions, isFullscreen]);
7972
8204
  if (isFullscreen) {
7973
- return (jsx("div", { className: styles$6.bookEditorActionbar, children: jsx("button", { className: styles$6.button, onClick: onFullscreenClick, children: jsx(ExitFullscreenIcon, {}) }) }));
8205
+ return (jsx("div", { className: styles$7.bookEditorActionbar, children: jsx("button", { className: styles$7.button, onClick: onFullscreenClick, children: jsx(ExitFullscreenIcon, {}) }) }));
7974
8206
  }
7975
- return (jsxs("div", { className: styles$6.bookEditorActionbar, children: [actions.length >= 2 ? (jsx(Dropdown, { actions: actions })) : (actions.map(({ icon, name, onClick }) => (jsx("button", { className: styles$6.button, onClick: onClick, children: icon }, name)))), isAboutModalOpen && (jsx(Modal, { onClose: () => {
8207
+ if (menuHoisting && !isFullscreen) {
8208
+ return (jsx(Fragment, { children: isAboutModalOpen && (jsx(Modal, { onClose: () => {
8209
+ setIsAboutModalOpen(false);
8210
+ }, children: jsx(AboutPromptbookInformation, {}) })) }));
8211
+ }
8212
+ return (jsxs("div", { className: styles$7.bookEditorActionbar, children: [actions.length >= 2 ? (jsx(Dropdown, { actions: actions })) : (actions.map(({ icon, name, onClick }) => (jsx("button", { className: styles$7.button, onClick: onClick, children: icon }, name)))), isAboutModalOpen && (jsx(Modal, { onClose: () => {
7976
8213
  setIsAboutModalOpen(false);
7977
8214
  }, children: jsx(AboutPromptbookInformation, {}) }))] }));
7978
8215
  }
@@ -8310,7 +8547,7 @@ function BookEditorMonaco(props) {
8310
8547
  event.preventDefault();
8311
8548
  setIsDragOver(false);
8312
8549
  }, []);
8313
- return (jsxs("div", { className: classNames(styles$6.bookEditorContainer, instanceClass), onDrop: handleDrop, onDragOver: handleDragOver, onDragEnter: handleDragEnter, onDragLeave: handleDragLeave, children: [(isUploadButtonShown ||
8550
+ return (jsxs("div", { className: classNames(styles$7.bookEditorContainer, instanceClass), onDrop: handleDrop, onDragOver: handleDragOver, onDragEnter: handleDragEnter, onDragLeave: handleDragLeave, children: [(isUploadButtonShown ||
8314
8551
  isCameraButtonShown ||
8315
8552
  isDownloadButtonShown ||
8316
8553
  isAboutButtonShown ||
@@ -8323,7 +8560,7 @@ function BookEditorMonaco(props) {
8323
8560
  onFullscreenClick,
8324
8561
  onUploadDocument: handleUploadDocument,
8325
8562
  onTakePhoto: handleTakePhoto,
8326
- isFullscreen })), jsx("input", { type: "file", ref: fileUploadInputRef, style: { display: 'none' }, onChange: handleFileInputChange, multiple: true }), jsx("input", { type: "file", ref: cameraInputRef, style: { display: 'none' }, accept: "image/*", capture: "environment", onChange: handleFileInputChange }), isDragOver && jsx("div", { className: styles$6.dropOverlay, children: "Drop files to upload" }), jsxs("div", { style: {
8563
+ isFullscreen })), jsx("input", { type: "file", ref: fileUploadInputRef, style: { display: 'none' }, onChange: handleFileInputChange, multiple: true }), jsx("input", { type: "file", ref: cameraInputRef, style: { display: 'none' }, accept: "image/*", capture: "environment", onChange: handleFileInputChange }), isDragOver && jsx("div", { className: styles$7.dropOverlay, children: "Drop files to upload" }), jsxs("div", { style: {
8327
8564
  position: 'relative',
8328
8565
  flex: 1,
8329
8566
  height: '100%',
@@ -8388,7 +8625,7 @@ function BookEditorMonaco(props) {
8388
8625
  arrowSize: 0,
8389
8626
  useShadows: false,
8390
8627
  },
8391
- }, loading: jsx("div", { className: styles$6.loading, children: "\uD83D\uDCD6" }) })] })] }));
8628
+ }, loading: jsx("div", { className: styles$7.loading, children: "\uD83D\uDCD6" }) })] })] }));
8392
8629
  }
8393
8630
 
8394
8631
  /**
@@ -8410,7 +8647,7 @@ function BookEditor(props) {
8410
8647
  const handleFullscreenToggle = () => {
8411
8648
  setIsFullscreen(!isFullscreen);
8412
8649
  };
8413
- const editorContent = (jsx("div", { "data-book-component": "BookEditor", className: classNames(styles$6.BookEditor, isVerbose && styles$6.isVerbose, styles$6.bookEditorWrapper, isBorderRadiusDisabled && styles$6.isBorderRadiusDisabled, isFullscreen && styles$6.fullscreen, className), style: isFullscreen
8650
+ const editorContent = (jsx("div", { "data-book-component": "BookEditor", className: classNames(styles$7.BookEditor, isVerbose && styles$7.isVerbose, styles$7.bookEditorWrapper, isBorderRadiusDisabled && styles$7.isBorderRadiusDisabled, isFullscreen && styles$7.fullscreen, className), style: isFullscreen
8414
8651
  ? style
8415
8652
  : {
8416
8653
  ...(style || {}),
@@ -9262,7 +9499,7 @@ const AVATAR_SIZE = 40;
9262
9499
  *
9263
9500
  * @private internal subcomponent of `<Chat>` component
9264
9501
  */
9265
- const ChatMessageItem = memo(({ message, participant, participants, isLastMessage, onMessage, setExpandedMessageId, isExpanded, currentRating, handleRating, mode, isCopyButtonEnabled, isFeedbackEnabled, onCopy, }) => {
9502
+ const ChatMessageItem = memo(({ message, participant, participants, isLastMessage, onMessage, setExpandedMessageId, isExpanded, currentRating, handleRating, mode, isCopyButtonEnabled, isFeedbackEnabled, onCopy, onCreateAgent, }) => {
9266
9503
  const avatarSrc = (participant === null || participant === void 0 ? void 0 : participant.avatarSrc) || '';
9267
9504
  const [isAvatarTooltipVisible, setIsAvatarTooltipVisible] = useState(false);
9268
9505
  const [avatarTooltipPosition, setAvatarTooltipPosition] = useState(null);
@@ -9405,7 +9642,7 @@ const ChatMessageItem = memo(({ message, participant, participants, isLastMessag
9405
9642
  ? ' ' + chatStyles.copiedTooltipLeft
9406
9643
  : tooltipAlign === 'right'
9407
9644
  ? ' ' + chatStyles.copiedTooltipRight
9408
- : ''), children: "Copied!" }))] }) })), message.isVoiceCall && (jsx("div", { className: chatStyles.voiceCallIndicator, children: jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: jsx("path", { d: "M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z" }) }) })), message.content === LOADING_INTERACTIVE_IMAGE ? (jsx(Fragment, {})) : (jsx("div", { ref: contentWithoutButtonsRef, children: jsx(MarkdownContent, { content: contentWithoutButtons }) })), !message.isComplete && jsx("span", { className: chatStyles.NonCompleteMessageFiller, children: '_'.repeat(70) }), shouldShowButtons && (jsx("div", { className: chatStyles.messageButtons, children: buttons.map((button, buttonIndex) => (jsx("button", { className: chatStyles.messageButton, onClick: (event) => {
9645
+ : ''), children: "Copied!" }))] }) })), message.isVoiceCall && (jsx("div", { className: chatStyles.voiceCallIndicator, children: jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: jsx("path", { d: "M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z" }) }) })), message.content === LOADING_INTERACTIVE_IMAGE ? (jsx(Fragment, {})) : (jsx("div", { ref: contentWithoutButtonsRef, children: jsx(MarkdownContent, { content: contentWithoutButtons, onCreateAgent: onCreateAgent }) })), !message.isComplete && jsx("span", { className: chatStyles.NonCompleteMessageFiller, children: '_'.repeat(70) }), shouldShowButtons && (jsx("div", { className: chatStyles.messageButtons, children: buttons.map((button, buttonIndex) => (jsx("button", { className: chatStyles.messageButton, onClick: (event) => {
9409
9646
  event.stopPropagation();
9410
9647
  if (onMessage) {
9411
9648
  onMessage(button.message);
@@ -9488,7 +9725,7 @@ function Chat(props) {
9488
9725
  // isExperimental = false,
9489
9726
  // TODO: [😅]> isSaveButtonEnabled = false,
9490
9727
  // exportHeaderMarkdown,
9491
- participants = [], extraActions, actionsContainer, saveFormats, isSaveButtonEnabled = true, isCopyButtonEnabled = true, buttonColor: buttonColorRaw, onUseTemplate, } = props;
9728
+ participants = [], extraActions, actionsContainer, saveFormats, isSaveButtonEnabled = true, isCopyButtonEnabled = true, buttonColor: buttonColorRaw, onUseTemplate, onCreateAgent, } = props;
9492
9729
  const buttonColor = useMemo(() => Color.from(buttonColorRaw || '#0066cc'), [buttonColorRaw]);
9493
9730
  // Use the auto-scroll hook
9494
9731
  const { isAutoScrolling, chatMessagesRef, handleScroll, handleMessagesChange, scrollToBottom, isMobile: isMobileFromHook, } = useChatAutoScroll();
@@ -9784,7 +10021,7 @@ function Chat(props) {
9784
10021
  const isLastMessage = i === postprocessedMessages.length - 1;
9785
10022
  const isExpanded = expandedMessageId === message.id;
9786
10023
  const currentRating = messageRatings.get(message.id || message.content /* <-[💃] */) || 0;
9787
- return (jsx(ChatMessageItem, { message: message, participant: participant, participants: participants, isLastMessage: isLastMessage, onMessage: onMessage, setExpandedMessageId: setExpandedMessageId, isExpanded: isExpanded, currentRating: currentRating, handleRating: handleRating, mode: mode, isCopyButtonEnabled: isCopyButtonEnabled, isFeedbackEnabled: isFeedbackEnabled, onCopy: handleCopy }, message.id));
10024
+ return (jsx(ChatMessageItem, { message: message, participant: participant, participants: participants, isLastMessage: isLastMessage, onMessage: onMessage, setExpandedMessageId: setExpandedMessageId, isExpanded: isExpanded, currentRating: currentRating, handleRating: handleRating, mode: mode, isCopyButtonEnabled: isCopyButtonEnabled, isFeedbackEnabled: isFeedbackEnabled, onCopy: handleCopy, onCreateAgent: onCreateAgent }, message.id));
9788
10025
  }), jsx("div", {
9789
10026
  // Note: Extra space at bottom for input area
9790
10027
  style: { height: 100 } })] }), onMessage && (jsxs("div", { className: classNames(chatStyles.chatInput, useChatCssClassName('chatInput'), isDragOver && chatStyles.dragOver), ...(onFileUpload
@@ -17746,7 +17983,7 @@ class RemoteAgent extends Agent {
17746
17983
  * TODO: !!! Agent on remote server
17747
17984
  */
17748
17985
 
17749
- var css_248z = ".PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegration__KTAQl{bottom:20px;font-family:sans-serif;position:fixed;right:20px;z-index:10000}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationButton__beMWa{align-items:center;background-color:#007bff;border-radius:30px;box-shadow:0 4px 12px rgba(0,0,0,.15);color:#fff;cursor:pointer;display:flex;padding:10px 20px;position:relative;transition:transform .2s,box-shadow .2s}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationButton__beMWa:hover{box-shadow:0 6px 16px rgba(0,0,0,.2);transform:translateY(-2px)}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationAvatar__OrK-R{background-color:#eee;border-radius:50%;height:32px;margin-right:10px;overflow:hidden;transform:translate(-10px) scale(1.3);width:32px}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationAvatar__OrK-R img{height:100%;object-fit:cover;width:100%}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationLabel__gvgCn{font-weight:700}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationStatus__QBwnt{border:2px solid #fff;border-radius:50%;bottom:12px;height:12px;left:40px;position:absolute;width:12px;z-index:10}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationStatusConnected__w15ZJ{background-color:#57b660}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationStatusPending__vtVxc{background-color:#9e9e9e}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationStatusError__nu02u{background-color:#f44336}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegration__KTAQl.PromptbookAgentSeamlessIntegration-module_open__rt5ey .PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationButton__beMWa{display:none}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationWindow__6sxeZ{animation:PromptbookAgentSeamlessIntegration-module_promptbook-agent-slide-up__0dGVe .3s ease-out;background-color:#fff;border-radius:12px;box-shadow:0 8px 32px rgba(0,0,0,.2);display:flex;flex-direction:column;height:600px;max-height:80vh;overflow:hidden;width:380px}@keyframes PromptbookAgentSeamlessIntegration-module_promptbook-agent-slide-up__0dGVe{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationHeader__9ae8B{align-items:center;background-color:#007bff;color:#fff;display:flex;justify-content:space-between;padding:15px}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationHeader__9ae8B button{align-items:center!important;background:transparent!important;border:none!important;border-radius:50%!important;box-shadow:none!important;color:inherit!important;cursor:pointer;display:flex!important;height:32px!important;justify-content:center!important;margin:0 2px!important;min-width:32px!important;opacity:.8;padding:5px!important;transition:opacity .2s}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationHeader__9ae8B button:hover{background-color:hsla(0,0%,100%,.2)!important;opacity:1}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationHeader__9ae8B button span{display:none!important}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationHeader__9ae8B button svg{height:20px;width:20px}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationTitle__D6p2j{font-size:1.1em;font-weight:700}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationClose__Ot41T{font-size:1.2em}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationContent__xqAns{display:flex;flex:1;flex-direction:column;overflow-y:auto;position:relative}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationError__RaBDa,.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationLoading__OAqgE{align-items:center;color:#666;display:flex;flex:1;justify-content:center;padding:20px;text-align:center}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationError__RaBDa{color:#d32f2f}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationIframe__KX5iC{border:none;flex:1;height:100%;width:100%}@media (max-width:480px){.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegration__KTAQl.PromptbookAgentSeamlessIntegration-module_open__rt5ey{bottom:0;left:0;right:0}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationWindow__6sxeZ{border-radius:0;height:100vh;max-height:100vh;width:100%}}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlByb21wdGJvb2tBZ2VudFNlYW1sZXNzSW50ZWdyYXRpb24ubW9kdWxlLmNzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxxRkFFSSxXQUFZLENBR1osc0JBQXVCLENBSnZCLGNBQWUsQ0FFZixVQUFXLENBQ1gsYUFFSixDQUVBLDJGQUVJLGtCQUFtQixDQUNuQix3QkFBeUIsQ0FFekIsa0JBQW1CLENBR25CLHFDQUEwQyxDQUoxQyxVQUFZLENBR1osY0FBZSxDQU5mLFlBQWEsQ0FLYixpQkFBa0IsQ0FJbEIsaUJBQWtCLENBRGxCLHVDQUVKLENBRUEsaUdBRUksb0NBQXlDLENBRHpDLDBCQUVKLENBRUEsMkZBTUkscUJBQXNCLENBSHRCLGlCQUFrQixDQURsQixXQUFZLENBR1osaUJBQWtCLENBRGxCLGVBQWdCLENBSWhCLHFDQUF5QyxDQVB6QyxVQVFKLENBRUEsK0ZBRUksV0FBWSxDQUNaLGdCQUFpQixDQUZqQixVQUdKLENBRUEsM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Q6IDA7XG4gICAgICAgIGxlZnQ6IDA7XG4gICAgfVxuXG4gICAgLlByb21wdGJvb2tBZ2VudFNlYW1sZXNzSW50ZWdyYXRpb25XaW5kb3cge1xuICAgICAgICB3aWR0aDogMTAwJTtcbiAgICAgICAgaGVpZ2h0OiAxMDB2aDtcbiAgICAgICAgbWF4LWhlaWdodDogMTAwdmg7XG4gICAgICAgIGJvcmRlci1yYWRpdXM6IDA7XG4gICAgfVxufVxuIl19 */";
17986
+ var css_248z = ".PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegration__KTAQl{bottom:20px;font-family:sans-serif;position:fixed;right:20px;z-index:10000}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationButton__beMWa{align-items:center;background-color:#007bff;border-radius:30px;box-shadow:0 4px 12px rgba(0,0,0,.15);color:#fff;cursor:pointer;display:flex;padding:10px 20px;position:relative;transition:transform .2s,box-shadow .2s}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationButton__beMWa:hover{box-shadow:0 6px 16px rgba(0,0,0,.2);transform:translateY(-2px)}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationAvatar__OrK-R{background-color:#eee;border-radius:50%;height:32px;margin-right:10px;overflow:hidden;transform:translate(-10px) scale(1.3);width:32px}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationAvatar__OrK-R img{height:100%;object-fit:cover;width:100%}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationLabel__gvgCn{font-weight:700}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationStatus__QBwnt{border:2px solid #fff;border-radius:50%;bottom:12px;height:12px;left:40px;position:absolute;width:12px;z-index:10}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationStatusConnected__w15ZJ{background-color:#57b660}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationStatusPending__vtVxc{background-color:#9e9e9e}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationStatusError__nu02u{background-color:#f44336}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegration__KTAQl.PromptbookAgentSeamlessIntegration-module_open__rt5ey .PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationButton__beMWa{display:none}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationWindow__6sxeZ{animation:PromptbookAgentSeamlessIntegration-module_promptbook-agent-slide-up__0dGVe .3s ease-out;background-color:#fff;border-radius:12px;box-shadow:0 8px 32px rgba(0,0,0,.2);display:flex;flex-direction:column;height:600px;max-height:80vh;overflow:hidden;width:380px}@keyframes PromptbookAgentSeamlessIntegration-module_promptbook-agent-slide-up__0dGVe{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationHeader__9ae8B{align-items:center;background-color:#007bff;color:#fff;display:flex;justify-content:space-between;padding:15px}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationHeader__9ae8B button{align-items:center!important;background:transparent!important;border:none!important;border-radius:50%!important;box-shadow:none!important;color:inherit!important;cursor:pointer;display:flex!important;height:32px!important;justify-content:center!important;margin:0 2px!important;min-width:32px!important;opacity:.8;padding:5px!important;transition:opacity .2s}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationHeader__9ae8B button:hover{background-color:hsla(0,0%,100%,.2)!important;opacity:1}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationHeader__9ae8B button span{display:none!important}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationHeader__9ae8B button svg{height:20px;width:20px}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationTitle__D6p2j{font-size:1.1em;font-weight:700}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationClose__Ot41T{font-size:1.2em}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationContent__xqAns{display:flex;flex:1;flex-direction:column;overflow-y:auto;position:relative}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationError__RaBDa,.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationLoading__OAqgE{align-items:center;color:#666;display:flex;flex:1;justify-content:center;padding:20px;text-align:center}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationError__RaBDa{color:#d32f2f}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationIframe__KX5iC{border:none;height:100%;left:0;position:absolute;top:0;transition:opacity .2s ease-in-out;width:100%}@media (max-width:480px){.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegration__KTAQl.PromptbookAgentSeamlessIntegration-module_open__rt5ey{bottom:0;left:0;right:0}.PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationWindow__6sxeZ{border-radius:0;height:100vh;max-height:100vh;width:100%}}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlByb21wdGJvb2tBZ2VudFNlYW1sZXNzSW50ZWdyYXRpb24ubW9kdWxlLmNzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxxRkFFSSxXQUFZLENBR1osc0JBQXVCLENBSnZCLGNBQWUsQ0FFZixVQUFXLENBQ1gsYUFFSixDQUVBLDJGQUVJLGtCQUFtQixDQUNuQix3QkFBeUIsQ0FFekIsa0JBQW1CLENBR25CLHFDQUEwQyxDQUoxQyxVQUFZLENBR1osY0FBZSxDQU5mLFlBQWEsQ0FLYixpQkFBa0IsQ0FJbEIsaUJBQWtCLENBRGxCLHVDQUVKLENBRUEsaUdBRUksb0NBQXlDLENBRHpDLDBCQUVKLENBRUEsMkZBTUkscUJBQXNCLENBSHRCLGlCQUFrQixDQURsQixXQUFZLEN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DtcbiAgICB3aWR0aDogMTAwJTtcbiAgICBoZWlnaHQ6IDEwMCU7XG4gICAgYm9yZGVyOiBub25lO1xuICAgIHRyYW5zaXRpb246IG9wYWNpdHkgMC4ycyBlYXNlLWluLW91dDtcbn1cblxuQG1lZGlhIChtYXgtd2lkdGg6IDQ4MHB4KSB7XG4gICAgLlByb21wdGJvb2tBZ2VudFNlYW1sZXNzSW50ZWdyYXRpb24ub3BlbiB7XG4gICAgICAgIGJvdHRvbTogMDtcbiAgICAgICAgcmlnaHQ6IDA7XG4gICAgICAgIGxlZnQ6IDA7XG4gICAgfVxuXG4gICAgLlByb21wdGJvb2tBZ2VudFNlYW1sZXNzSW50ZWdyYXRpb25XaW5kb3cge1xuICAgICAgICB3aWR0aDogMTAwJTtcbiAgICAgICAgaGVpZ2h0OiAxMDB2aDtcbiAgICAgICAgbWF4LWhlaWdodDogMTAwdmg7XG4gICAgICAgIGJvcmRlci1yYWRpdXM6IDA7XG4gICAgfVxufVxuIl19 */";
17750
17987
  var styles = {"PromptbookAgentSeamlessIntegration":"PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegration__KTAQl","PromptbookAgentSeamlessIntegrationButton":"PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationButton__beMWa","PromptbookAgentSeamlessIntegrationAvatar":"PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationAvatar__OrK-R","PromptbookAgentSeamlessIntegrationLabel":"PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationLabel__gvgCn","PromptbookAgentSeamlessIntegrationStatus":"PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationStatus__QBwnt","PromptbookAgentSeamlessIntegrationStatusConnected":"PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationStatusConnected__w15ZJ","PromptbookAgentSeamlessIntegrationStatusPending":"PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationStatusPending__vtVxc","PromptbookAgentSeamlessIntegrationStatusError":"PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationStatusError__nu02u","open":"PromptbookAgentSeamlessIntegration-module_open__rt5ey","closed":"PromptbookAgentSeamlessIntegration-module_closed__VPHQ-","PromptbookAgentSeamlessIntegrationWindow":"PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationWindow__6sxeZ","promptbook-agent-slide-up":"PromptbookAgentSeamlessIntegration-module_promptbook-agent-slide-up__0dGVe","PromptbookAgentSeamlessIntegrationHeader":"PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationHeader__9ae8B","PromptbookAgentSeamlessIntegrationTitle":"PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationTitle__D6p2j","PromptbookAgentSeamlessIntegrationClose":"PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationClose__Ot41T","PromptbookAgentSeamlessIntegrationContent":"PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationContent__xqAns","PromptbookAgentSeamlessIntegrationLoading":"PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationLoading__OAqgE","PromptbookAgentSeamlessIntegrationError":"PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationError__RaBDa","PromptbookAgentSeamlessIntegrationIframe":"PromptbookAgentSeamlessIntegration-module_PromptbookAgentSeamlessIntegrationIframe__KX5iC"};
17751
17988
  styleInject(css_248z);
17752
17989
 
@@ -17760,10 +17997,14 @@ function PromptbookAgentSeamlessIntegration(props) {
17760
17997
  const { agentUrl, meta, onOpenChange, className, style, isFocusedOnLoad, isIframeUsed = false } = props;
17761
17998
  const [isOpen, setIsOpen] = useState(false);
17762
17999
  const [headerElement, setHeaderElement] = useState(null);
18000
+ const [isIframeLoaded, setIsIframeLoaded] = useState(false);
17763
18001
  useEffect(() => {
17764
18002
  if (onOpenChange) {
17765
18003
  onOpenChange(isOpen);
17766
18004
  }
18005
+ if (!isOpen) {
18006
+ setIsIframeLoaded(false);
18007
+ }
17767
18008
  }, [isOpen, onOpenChange]);
17768
18009
  const [agent, setAgent] = useState(null);
17769
18010
  const [error, setError] = useState(null);
@@ -17819,7 +18060,7 @@ function PromptbookAgentSeamlessIntegration(props) {
17819
18060
  ? styles.PromptbookAgentSeamlessIntegrationStatusConnected
17820
18061
  : connectionStatus === 'error'
17821
18062
  ? styles.PromptbookAgentSeamlessIntegrationStatusError
17822
- : styles.PromptbookAgentSeamlessIntegrationStatusPending}` }), jsx("div", { className: styles.PromptbookAgentSeamlessIntegrationLabel, children: "CHAT" })] }), isOpen && (jsxs("div", { className: styles.PromptbookAgentSeamlessIntegrationWindow, children: [jsx("div", { className: styles.PromptbookAgentSeamlessIntegrationHeader, style: { backgroundColor: color }, ref: setHeaderElement, children: jsx("div", { className: styles.PromptbookAgentSeamlessIntegrationTitle, children: (agent === null || agent === void 0 ? void 0 : agent.meta.fullname) || (meta === null || meta === void 0 ? void 0 : meta.fullname) || (agent === null || agent === void 0 ? void 0 : agent.agentName) || 'Chat with Agent' }) }), jsx("div", { className: styles.PromptbookAgentSeamlessIntegrationContent, children: isIframeUsed ? (jsx("iframe", { src: agentUrl + '/chat?headless', className: styles.PromptbookAgentSeamlessIntegrationIframe, tabIndex: -1 })) : agent ? (jsx(AgentChat, { agent: agent, actionsContainer: headerElement, isFocusedOnLoad: isFocusedOnLoad, extraActions: jsx("button", { className: styles.PromptbookAgentSeamlessIntegrationClose, onClick: () => setIsOpen(false), title: "Close", children: jsx(CloseIcon, {}) }) })) : error ? (jsxs("div", { className: styles.PromptbookAgentSeamlessIntegrationError, children: ["Failed to connect to agent: ", error.message] })) : (jsx("div", { className: styles.PromptbookAgentSeamlessIntegrationLoading, children: "Connecting to agent..." })) })] }))] }));
18063
+ : styles.PromptbookAgentSeamlessIntegrationStatusPending}` }), jsx("div", { className: styles.PromptbookAgentSeamlessIntegrationLabel, children: "CHAT" })] }), isOpen && (jsxs("div", { className: styles.PromptbookAgentSeamlessIntegrationWindow, children: [jsxs("div", { className: styles.PromptbookAgentSeamlessIntegrationHeader, style: { backgroundColor: color }, ref: setHeaderElement, children: [jsx("div", { className: styles.PromptbookAgentSeamlessIntegrationTitle, children: (agent === null || agent === void 0 ? void 0 : agent.meta.fullname) || (meta === null || meta === void 0 ? void 0 : meta.fullname) || (agent === null || agent === void 0 ? void 0 : agent.agentName) || 'Chat with Agent' }), isIframeUsed && (jsx("button", { className: styles.PromptbookAgentSeamlessIntegrationClose, onClick: () => setIsOpen(false), title: "Close", children: jsx(CloseIcon, {}) }))] }), jsx("div", { className: styles.PromptbookAgentSeamlessIntegrationContent, children: isIframeUsed ? (jsxs(Fragment, { children: [!isIframeLoaded && (jsx("div", { className: styles.PromptbookAgentSeamlessIntegrationLoading, children: "Loading chat..." })), jsx("iframe", { src: agentUrl + '/chat?headless', className: styles.PromptbookAgentSeamlessIntegrationIframe, style: { opacity: isIframeLoaded ? 1 : 0 }, tabIndex: -1, onLoad: () => setIsIframeLoaded(true) })] })) : agent ? (jsx(AgentChat, { agent: agent, actionsContainer: headerElement, isFocusedOnLoad: isFocusedOnLoad, extraActions: jsx("button", { className: styles.PromptbookAgentSeamlessIntegrationClose, onClick: () => setIsOpen(false), title: "Close", children: jsx(CloseIcon, {}) }) })) : error ? (jsxs("div", { className: styles.PromptbookAgentSeamlessIntegrationError, children: ["Failed to connect to agent: ", error.message] })) : (jsx("div", { className: styles.PromptbookAgentSeamlessIntegrationLoading, children: "Connecting to agent..." })) })] }))] }));
17823
18064
  }
17824
18065
 
17825
18066
  /**