@assistant-ui/react 0.5.21 → 0.5.23
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/{AssistantTypes-D93BmqD5.d.mts → AssistantTypes-BNB-knVq.d.mts} +1 -1
 - package/dist/{AssistantTypes-D93BmqD5.d.ts → AssistantTypes-BNB-knVq.d.ts} +1 -1
 - package/dist/chunk-DCHYNTHI.js +11 -0
 - package/dist/chunk-DCHYNTHI.js.map +1 -0
 - package/dist/chunk-NSPHKRLF.js +819 -0
 - package/dist/chunk-NSPHKRLF.js.map +1 -0
 - package/dist/{chunk-2RKUKZSZ.mjs → chunk-ZWRFAYHH.mjs} +61 -3
 - package/dist/chunk-ZWRFAYHH.mjs.map +1 -0
 - package/dist/edge.d.mts +90 -5
 - package/dist/edge.d.ts +90 -5
 - package/dist/edge.js +0 -1
 - package/dist/edge.js.map +1 -1
 - package/dist/edge.mjs +799 -49
 - package/dist/edge.mjs.map +1 -1
 - package/dist/index.d.mts +164 -7
 - package/dist/index.d.ts +164 -7
 - package/dist/index.js +761 -1607
 - package/dist/index.js.map +1 -1
 - package/dist/index.mjs +833 -252
 - package/dist/index.mjs.map +1 -1
 - package/dist/tailwindcss/index.js +24 -53
 - package/dist/tailwindcss/index.js.map +1 -1
 - package/package.json +1 -12
 - package/dist/Thread-BbLf1cc4.d.mts +0 -156
 - package/dist/Thread-jfAlPLli.d.ts +0 -156
 - package/dist/chunk-2RKUKZSZ.mjs.map +0 -1
 - package/dist/chunk-QBS6JLLN.mjs +0 -63
 - package/dist/chunk-QBS6JLLN.mjs.map +0 -1
 - package/dist/chunk-V66MVXBH.mjs +0 -608
 - package/dist/chunk-V66MVXBH.mjs.map +0 -1
 - package/dist/internal.d.mts +0 -9
 - package/dist/internal.d.ts +0 -9
 - package/dist/internal.js +0 -620
 - package/dist/internal.js.map +0 -1
 - package/dist/internal.mjs +0 -24
 - package/dist/internal.mjs.map +0 -1
 - package/internal/README.md +0 -1
 - package/internal/package.json +0 -5
 
    
        package/dist/index.mjs
    CHANGED
    
    | 
         @@ -1,37 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            "use client";
         
     | 
| 
       2 
2 
     | 
    
         
             
            import {
         
     | 
| 
      
 3 
     | 
    
         
            +
              mergeModelConfigs,
         
     | 
| 
       3 
4 
     | 
    
         
             
              runResultStream,
         
     | 
| 
       4 
5 
     | 
    
         
             
              toCoreMessage,
         
     | 
| 
       5 
6 
     | 
    
         
             
              toCoreMessages,
         
     | 
| 
       6 
7 
     | 
    
         
             
              toLanguageModelMessages,
         
     | 
| 
       7 
8 
     | 
    
         
             
              toLanguageModelTools,
         
     | 
| 
       8 
9 
     | 
    
         
             
              toolResultStream
         
     | 
| 
       9 
     | 
    
         
            -
            } from "./chunk- 
     | 
| 
       10 
     | 
    
         
            -
            import {
         
     | 
| 
       11 
     | 
    
         
            -
              AssistantContext,
         
     | 
| 
       12 
     | 
    
         
            -
              BaseAssistantRuntime,
         
     | 
| 
       13 
     | 
    
         
            -
              Button,
         
     | 
| 
       14 
     | 
    
         
            -
              ContentPartContext,
         
     | 
| 
       15 
     | 
    
         
            -
              MessageContext,
         
     | 
| 
       16 
     | 
    
         
            -
              MessageRepository,
         
     | 
| 
       17 
     | 
    
         
            -
              ProxyConfigProvider,
         
     | 
| 
       18 
     | 
    
         
            -
              ThreadContext,
         
     | 
| 
       19 
     | 
    
         
            -
              TooltipIconButton,
         
     | 
| 
       20 
     | 
    
         
            -
              fromCoreMessage,
         
     | 
| 
       21 
     | 
    
         
            -
              fromCoreMessages,
         
     | 
| 
       22 
     | 
    
         
            -
              generateId,
         
     | 
| 
       23 
     | 
    
         
            -
              internal_exports,
         
     | 
| 
       24 
     | 
    
         
            -
              useAssistantContext,
         
     | 
| 
       25 
     | 
    
         
            -
              useComposerContext,
         
     | 
| 
       26 
     | 
    
         
            -
              useContentPartContext,
         
     | 
| 
       27 
     | 
    
         
            -
              useMessageContext,
         
     | 
| 
       28 
     | 
    
         
            -
              useSmooth,
         
     | 
| 
       29 
     | 
    
         
            -
              useSmoothStatus,
         
     | 
| 
       30 
     | 
    
         
            -
              useThreadContext,
         
     | 
| 
       31 
     | 
    
         
            -
              withDefaults,
         
     | 
| 
       32 
     | 
    
         
            -
              withSmoothContextProvider
         
     | 
| 
       33 
     | 
    
         
            -
            } from "./chunk-V66MVXBH.mjs";
         
     | 
| 
       34 
     | 
    
         
            -
            import "./chunk-QBS6JLLN.mjs";
         
     | 
| 
      
 10 
     | 
    
         
            +
            } from "./chunk-ZWRFAYHH.mjs";
         
     | 
| 
       35 
11 
     | 
    
         
             
            import {
         
     | 
| 
       36 
12 
     | 
    
         
             
              __export
         
     | 
| 
       37 
13 
     | 
    
         
             
            } from "./chunk-BJPOCE4O.mjs";
         
     | 
| 
         @@ -42,8 +18,38 @@ import { memo } from "react"; 
     | 
|
| 
       42 
18 
     | 
    
         
             
            // src/context/providers/AssistantProvider.tsx
         
     | 
| 
       43 
19 
     | 
    
         
             
            import { useEffect, useInsertionEffect as useInsertionEffect2, useRef as useRef2, useState as useState2 } from "react";
         
     | 
| 
       44 
20 
     | 
    
         | 
| 
      
 21 
     | 
    
         
            +
            // src/context/react/AssistantContext.ts
         
     | 
| 
      
 22 
     | 
    
         
            +
            import { createContext, useContext } from "react";
         
     | 
| 
      
 23 
     | 
    
         
            +
            var AssistantContext = createContext(
         
     | 
| 
      
 24 
     | 
    
         
            +
              null
         
     | 
| 
      
 25 
     | 
    
         
            +
            );
         
     | 
| 
      
 26 
     | 
    
         
            +
            function useAssistantContext(options) {
         
     | 
| 
      
 27 
     | 
    
         
            +
              const context = useContext(AssistantContext);
         
     | 
| 
      
 28 
     | 
    
         
            +
              if (!options?.optional && !context)
         
     | 
| 
      
 29 
     | 
    
         
            +
                throw new Error(
         
     | 
| 
      
 30 
     | 
    
         
            +
                  "This component must be used within an AssistantRuntimeProvider."
         
     | 
| 
      
 31 
     | 
    
         
            +
                );
         
     | 
| 
      
 32 
     | 
    
         
            +
              return context;
         
     | 
| 
      
 33 
     | 
    
         
            +
            }
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
       45 
35 
     | 
    
         
             
            // src/context/stores/AssistantModelConfig.ts
         
     | 
| 
       46 
36 
     | 
    
         
             
            import { create } from "zustand";
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            // src/utils/ProxyConfigProvider.ts
         
     | 
| 
      
 39 
     | 
    
         
            +
            var ProxyConfigProvider = class {
         
     | 
| 
      
 40 
     | 
    
         
            +
              _providers = /* @__PURE__ */ new Set();
         
     | 
| 
      
 41 
     | 
    
         
            +
              getModelConfig() {
         
     | 
| 
      
 42 
     | 
    
         
            +
                return mergeModelConfigs(this._providers);
         
     | 
| 
      
 43 
     | 
    
         
            +
              }
         
     | 
| 
      
 44 
     | 
    
         
            +
              registerModelConfigProvider(provider) {
         
     | 
| 
      
 45 
     | 
    
         
            +
                this._providers.add(provider);
         
     | 
| 
      
 46 
     | 
    
         
            +
                return () => {
         
     | 
| 
      
 47 
     | 
    
         
            +
                  this._providers.delete(provider);
         
     | 
| 
      
 48 
     | 
    
         
            +
                };
         
     | 
| 
      
 49 
     | 
    
         
            +
              }
         
     | 
| 
      
 50 
     | 
    
         
            +
            };
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
            // src/context/stores/AssistantModelConfig.ts
         
     | 
| 
       47 
53 
     | 
    
         
             
            var makeAssistantModelConfigStore = () => create(() => {
         
     | 
| 
       48 
54 
     | 
    
         
             
              const proxy = new ProxyConfigProvider();
         
     | 
| 
       49 
55 
     | 
    
         
             
              return Object.freeze({
         
     | 
| 
         @@ -91,6 +97,18 @@ var makeAssistantToolUIsStore = () => create2((set) => { 
     | 
|
| 
       91 
97 
     | 
    
         
             
            // src/context/providers/ThreadProvider.tsx
         
     | 
| 
       92 
98 
     | 
    
         
             
            import { useCallback as useCallback2, useInsertionEffect, useState } from "react";
         
     | 
| 
       93 
99 
     | 
    
         | 
| 
      
 100 
     | 
    
         
            +
            // src/context/react/ThreadContext.ts
         
     | 
| 
      
 101 
     | 
    
         
            +
            import { createContext as createContext2, useContext as useContext2 } from "react";
         
     | 
| 
      
 102 
     | 
    
         
            +
            var ThreadContext = createContext2(null);
         
     | 
| 
      
 103 
     | 
    
         
            +
            function useThreadContext(options) {
         
     | 
| 
      
 104 
     | 
    
         
            +
              const context = useContext2(ThreadContext);
         
     | 
| 
      
 105 
     | 
    
         
            +
              if (!options?.optional && !context)
         
     | 
| 
      
 106 
     | 
    
         
            +
                throw new Error(
         
     | 
| 
      
 107 
     | 
    
         
            +
                  "This component must be used within an AssistantRuntimeProvider."
         
     | 
| 
      
 108 
     | 
    
         
            +
                );
         
     | 
| 
      
 109 
     | 
    
         
            +
              return context;
         
     | 
| 
      
 110 
     | 
    
         
            +
            }
         
     | 
| 
      
 111 
     | 
    
         
            +
             
     | 
| 
       94 
112 
     | 
    
         
             
            // src/context/stores/Composer.ts
         
     | 
| 
       95 
113 
     | 
    
         
             
            import { create as create3 } from "zustand";
         
     | 
| 
       96 
114 
     | 
    
         | 
| 
         @@ -318,6 +336,48 @@ var AssistantRuntimeProviderImpl = ({ children, runtime }) => { 
     | 
|
| 
       318 
336 
     | 
    
         
             
            };
         
     | 
| 
       319 
337 
     | 
    
         
             
            var AssistantRuntimeProvider = memo(AssistantRuntimeProviderImpl);
         
     | 
| 
       320 
338 
     | 
    
         | 
| 
      
 339 
     | 
    
         
            +
            // src/context/react/ComposerContext.ts
         
     | 
| 
      
 340 
     | 
    
         
            +
            import { useMemo } from "react";
         
     | 
| 
      
 341 
     | 
    
         
            +
             
     | 
| 
      
 342 
     | 
    
         
            +
            // src/context/react/MessageContext.ts
         
     | 
| 
      
 343 
     | 
    
         
            +
            import { createContext as createContext3, useContext as useContext3 } from "react";
         
     | 
| 
      
 344 
     | 
    
         
            +
            var MessageContext = createContext3(null);
         
     | 
| 
      
 345 
     | 
    
         
            +
            function useMessageContext(options) {
         
     | 
| 
      
 346 
     | 
    
         
            +
              const context = useContext3(MessageContext);
         
     | 
| 
      
 347 
     | 
    
         
            +
              if (!options?.optional && !context)
         
     | 
| 
      
 348 
     | 
    
         
            +
                throw new Error(
         
     | 
| 
      
 349 
     | 
    
         
            +
                  "This component can only be used inside a component passed to <ThreadPrimitive.Messages components={...} />."
         
     | 
| 
      
 350 
     | 
    
         
            +
                );
         
     | 
| 
      
 351 
     | 
    
         
            +
              return context;
         
     | 
| 
      
 352 
     | 
    
         
            +
            }
         
     | 
| 
      
 353 
     | 
    
         
            +
             
     | 
| 
      
 354 
     | 
    
         
            +
            // src/context/react/ComposerContext.ts
         
     | 
| 
      
 355 
     | 
    
         
            +
            var useComposerContext = () => {
         
     | 
| 
      
 356 
     | 
    
         
            +
              const { useComposer } = useThreadContext();
         
     | 
| 
      
 357 
     | 
    
         
            +
              const { useEditComposer } = useMessageContext({ optional: true }) ?? {};
         
     | 
| 
      
 358 
     | 
    
         
            +
              return useMemo(
         
     | 
| 
      
 359 
     | 
    
         
            +
                () => ({
         
     | 
| 
      
 360 
     | 
    
         
            +
                  useComposer: useEditComposer ?? useComposer,
         
     | 
| 
      
 361 
     | 
    
         
            +
                  type: useEditComposer ? "edit" : "new"
         
     | 
| 
      
 362 
     | 
    
         
            +
                }),
         
     | 
| 
      
 363 
     | 
    
         
            +
                [useEditComposer, useComposer]
         
     | 
| 
      
 364 
     | 
    
         
            +
              );
         
     | 
| 
      
 365 
     | 
    
         
            +
            };
         
     | 
| 
      
 366 
     | 
    
         
            +
             
     | 
| 
      
 367 
     | 
    
         
            +
            // src/context/react/ContentPartContext.ts
         
     | 
| 
      
 368 
     | 
    
         
            +
            import { createContext as createContext4, useContext as useContext4 } from "react";
         
     | 
| 
      
 369 
     | 
    
         
            +
            var ContentPartContext = createContext4(
         
     | 
| 
      
 370 
     | 
    
         
            +
              null
         
     | 
| 
      
 371 
     | 
    
         
            +
            );
         
     | 
| 
      
 372 
     | 
    
         
            +
            function useContentPartContext(options) {
         
     | 
| 
      
 373 
     | 
    
         
            +
              const context = useContext4(ContentPartContext);
         
     | 
| 
      
 374 
     | 
    
         
            +
              if (!options?.optional && !context)
         
     | 
| 
      
 375 
     | 
    
         
            +
                throw new Error(
         
     | 
| 
      
 376 
     | 
    
         
            +
                  "This component can only be used inside a component passed to <MessagePrimitive.Content components={...} >."
         
     | 
| 
      
 377 
     | 
    
         
            +
                );
         
     | 
| 
      
 378 
     | 
    
         
            +
              return context;
         
     | 
| 
      
 379 
     | 
    
         
            +
            }
         
     | 
| 
      
 380 
     | 
    
         
            +
             
     | 
| 
       321 
381 
     | 
    
         
             
            // src/hooks/useAppendMessage.tsx
         
     | 
| 
       322 
382 
     | 
    
         
             
            import { useCallback as useCallback3 } from "react";
         
     | 
| 
       323 
383 
     | 
    
         
             
            var toAppendMessage = (useThreadMessages, message) => {
         
     | 
| 
         @@ -435,7 +495,7 @@ var useAssistantInstructions = (instruction) => { 
     | 
|
| 
       435 
495 
     | 
    
         
             
            import { useCallback as useCallback5 } from "react";
         
     | 
| 
       436 
496 
     | 
    
         | 
| 
       437 
497 
     | 
    
         
             
            // src/utils/combined/useCombinedStore.ts
         
     | 
| 
       438 
     | 
    
         
            -
            import { useMemo } from "react";
         
     | 
| 
      
 498 
     | 
    
         
            +
            import { useMemo as useMemo2 } from "react";
         
     | 
| 
       439 
499 
     | 
    
         | 
| 
       440 
500 
     | 
    
         
             
            // src/utils/combined/createCombinedStore.ts
         
     | 
| 
       441 
501 
     | 
    
         
             
            import { useSyncExternalStore } from "react";
         
     | 
| 
         @@ -456,7 +516,7 @@ var createCombinedStore = (stores) => { 
     | 
|
| 
       456 
516 
     | 
    
         | 
| 
       457 
517 
     | 
    
         
             
            // src/utils/combined/useCombinedStore.ts
         
     | 
| 
       458 
518 
     | 
    
         
             
            var useCombinedStore = (stores, selector) => {
         
     | 
| 
       459 
     | 
    
         
            -
              const useCombined =  
     | 
| 
      
 519 
     | 
    
         
            +
              const useCombined = useMemo2(() => createCombinedStore(stores), stores);
         
     | 
| 
       460 
520 
     | 
    
         
             
              return useCombined(selector);
         
     | 
| 
       461 
521 
     | 
    
         
             
            };
         
     | 
| 
       462 
522 
     | 
    
         | 
| 
         @@ -1011,7 +1071,7 @@ BranchPickerPrimitiveNumber.displayName = "BranchPickerPrimitive.Number"; 
     | 
|
| 
       1011 
1071 
     | 
    
         | 
| 
       1012 
1072 
     | 
    
         
             
            // src/primitives/branchPicker/BranchPickerRoot.tsx
         
     | 
| 
       1013 
1073 
     | 
    
         
             
            import { Primitive as Primitive5 } from "@radix-ui/react-primitive";
         
     | 
| 
       1014 
     | 
    
         
            -
            import { forwardRef as  
     | 
| 
      
 1074 
     | 
    
         
            +
            import { forwardRef as forwardRef10 } from "react";
         
     | 
| 
       1015 
1075 
     | 
    
         | 
| 
       1016 
1076 
     | 
    
         
             
            // src/primitives/message/index.ts
         
     | 
| 
       1017 
1077 
     | 
    
         
             
            var message_exports = {};
         
     | 
| 
         @@ -1053,9 +1113,9 @@ var useIsHoveringRef = () => { 
     | 
|
| 
       1053 
1113 
     | 
    
         
             
              );
         
     | 
| 
       1054 
1114 
     | 
    
         
             
              return useManagedRef(callbackRef);
         
     | 
| 
       1055 
1115 
     | 
    
         
             
            };
         
     | 
| 
       1056 
     | 
    
         
            -
            var MessagePrimitiveRoot = forwardRef6(({ onMouseEnter, onMouseLeave, ...rest },  
     | 
| 
      
 1116 
     | 
    
         
            +
            var MessagePrimitiveRoot = forwardRef6(({ onMouseEnter, onMouseLeave, ...rest }, forwardRef29) => {
         
     | 
| 
       1057 
1117 
     | 
    
         
             
              const isHoveringRef = useIsHoveringRef();
         
     | 
| 
       1058 
     | 
    
         
            -
              const ref = useComposedRefs( 
     | 
| 
      
 1118 
     | 
    
         
            +
              const ref = useComposedRefs(forwardRef29, isHoveringRef);
         
     | 
| 
       1059 
1119 
     | 
    
         
             
              return /* @__PURE__ */ jsx12(Primitive3.div, { ...rest, ref });
         
     | 
| 
       1060 
1120 
     | 
    
         
             
            });
         
     | 
| 
       1061 
1121 
     | 
    
         
             
            MessagePrimitiveRoot.displayName = "MessagePrimitive.Root";
         
     | 
| 
         @@ -1144,27 +1204,170 @@ var ContentPartProvider = ({ 
     | 
|
| 
       1144 
1204 
     | 
    
         | 
| 
       1145 
1205 
     | 
    
         
             
            // src/primitives/contentPart/ContentPartText.tsx
         
     | 
| 
       1146 
1206 
     | 
    
         
             
            import {
         
     | 
| 
       1147 
     | 
    
         
            -
              forwardRef as  
     | 
| 
      
 1207 
     | 
    
         
            +
              forwardRef as forwardRef8
         
     | 
| 
       1148 
1208 
     | 
    
         
             
            } from "react";
         
     | 
| 
      
 1209 
     | 
    
         
            +
             
     | 
| 
      
 1210 
     | 
    
         
            +
            // src/utils/smooth/useSmooth.tsx
         
     | 
| 
      
 1211 
     | 
    
         
            +
            import { useEffect as useEffect7, useMemo as useMemo3, useRef as useRef3, useState as useState6 } from "react";
         
     | 
| 
      
 1212 
     | 
    
         
            +
             
     | 
| 
      
 1213 
     | 
    
         
            +
            // src/utils/smooth/SmoothContext.tsx
         
     | 
| 
      
 1214 
     | 
    
         
            +
            import {
         
     | 
| 
      
 1215 
     | 
    
         
            +
              createContext as createContext5,
         
     | 
| 
      
 1216 
     | 
    
         
            +
              forwardRef as forwardRef7,
         
     | 
| 
      
 1217 
     | 
    
         
            +
              useContext as useContext5,
         
     | 
| 
      
 1218 
     | 
    
         
            +
              useState as useState5
         
     | 
| 
      
 1219 
     | 
    
         
            +
            } from "react";
         
     | 
| 
      
 1220 
     | 
    
         
            +
            import { create as create11 } from "zustand";
         
     | 
| 
       1149 
1221 
     | 
    
         
             
            import { jsx as jsx14 } from "react/jsx-runtime";
         
     | 
| 
       1150 
     | 
    
         
            -
            var  
     | 
| 
      
 1222 
     | 
    
         
            +
            var SmoothContext = createContext5(null);
         
     | 
| 
      
 1223 
     | 
    
         
            +
            var makeSmoothContext = (initialState) => {
         
     | 
| 
      
 1224 
     | 
    
         
            +
              const useSmoothStatus2 = create11(() => initialState);
         
     | 
| 
      
 1225 
     | 
    
         
            +
              return { useSmoothStatus: useSmoothStatus2 };
         
     | 
| 
      
 1226 
     | 
    
         
            +
            };
         
     | 
| 
      
 1227 
     | 
    
         
            +
            var SmoothContextProvider = ({ children }) => {
         
     | 
| 
      
 1228 
     | 
    
         
            +
              const outer = useSmoothContext({ optional: true });
         
     | 
| 
      
 1229 
     | 
    
         
            +
              const { useContentPart } = useContentPartContext();
         
     | 
| 
      
 1230 
     | 
    
         
            +
              const [context] = useState5(
         
     | 
| 
      
 1231 
     | 
    
         
            +
                () => makeSmoothContext(useContentPart.getState().status)
         
     | 
| 
      
 1232 
     | 
    
         
            +
              );
         
     | 
| 
      
 1233 
     | 
    
         
            +
              if (outer) return children;
         
     | 
| 
      
 1234 
     | 
    
         
            +
              return /* @__PURE__ */ jsx14(SmoothContext.Provider, { value: context, children });
         
     | 
| 
      
 1235 
     | 
    
         
            +
            };
         
     | 
| 
      
 1236 
     | 
    
         
            +
            var withSmoothContextProvider = (Component) => {
         
     | 
| 
      
 1237 
     | 
    
         
            +
              const Wrapped = forwardRef7((props, ref) => {
         
     | 
| 
      
 1238 
     | 
    
         
            +
                return /* @__PURE__ */ jsx14(SmoothContextProvider, { children: /* @__PURE__ */ jsx14(Component, { ...props, ref }) });
         
     | 
| 
      
 1239 
     | 
    
         
            +
              });
         
     | 
| 
      
 1240 
     | 
    
         
            +
              Wrapped.displayName = Component.displayName;
         
     | 
| 
      
 1241 
     | 
    
         
            +
              return Wrapped;
         
     | 
| 
      
 1242 
     | 
    
         
            +
            };
         
     | 
| 
      
 1243 
     | 
    
         
            +
            function useSmoothContext(options) {
         
     | 
| 
      
 1244 
     | 
    
         
            +
              const context = useContext5(SmoothContext);
         
     | 
| 
      
 1245 
     | 
    
         
            +
              if (!options?.optional && !context)
         
     | 
| 
      
 1246 
     | 
    
         
            +
                throw new Error(
         
     | 
| 
      
 1247 
     | 
    
         
            +
                  "This component must be used within a SmoothContextProvider."
         
     | 
| 
      
 1248 
     | 
    
         
            +
                );
         
     | 
| 
      
 1249 
     | 
    
         
            +
              return context;
         
     | 
| 
      
 1250 
     | 
    
         
            +
            }
         
     | 
| 
      
 1251 
     | 
    
         
            +
            var useSmoothStatus = () => {
         
     | 
| 
      
 1252 
     | 
    
         
            +
              const { useSmoothStatus: useSmoothStatus2 } = useSmoothContext();
         
     | 
| 
      
 1253 
     | 
    
         
            +
              return useSmoothStatus2();
         
     | 
| 
      
 1254 
     | 
    
         
            +
            };
         
     | 
| 
      
 1255 
     | 
    
         
            +
             
     | 
| 
      
 1256 
     | 
    
         
            +
            // src/utils/smooth/useSmooth.tsx
         
     | 
| 
      
 1257 
     | 
    
         
            +
            import { useCallbackRef as useCallbackRef2 } from "@radix-ui/react-use-callback-ref";
         
     | 
| 
      
 1258 
     | 
    
         
            +
            var TextStreamAnimator = class {
         
     | 
| 
      
 1259 
     | 
    
         
            +
              constructor(currentText, setText) {
         
     | 
| 
      
 1260 
     | 
    
         
            +
                this.currentText = currentText;
         
     | 
| 
      
 1261 
     | 
    
         
            +
                this.setText = setText;
         
     | 
| 
      
 1262 
     | 
    
         
            +
              }
         
     | 
| 
      
 1263 
     | 
    
         
            +
              animationFrameId = null;
         
     | 
| 
      
 1264 
     | 
    
         
            +
              lastUpdateTime = Date.now();
         
     | 
| 
      
 1265 
     | 
    
         
            +
              targetText = "";
         
     | 
| 
      
 1266 
     | 
    
         
            +
              start() {
         
     | 
| 
      
 1267 
     | 
    
         
            +
                if (this.animationFrameId !== null) return;
         
     | 
| 
      
 1268 
     | 
    
         
            +
                this.lastUpdateTime = Date.now();
         
     | 
| 
      
 1269 
     | 
    
         
            +
                this.animate();
         
     | 
| 
      
 1270 
     | 
    
         
            +
              }
         
     | 
| 
      
 1271 
     | 
    
         
            +
              stop() {
         
     | 
| 
      
 1272 
     | 
    
         
            +
                if (this.animationFrameId !== null) {
         
     | 
| 
      
 1273 
     | 
    
         
            +
                  cancelAnimationFrame(this.animationFrameId);
         
     | 
| 
      
 1274 
     | 
    
         
            +
                  this.animationFrameId = null;
         
     | 
| 
      
 1275 
     | 
    
         
            +
                }
         
     | 
| 
      
 1276 
     | 
    
         
            +
              }
         
     | 
| 
      
 1277 
     | 
    
         
            +
              animate = () => {
         
     | 
| 
      
 1278 
     | 
    
         
            +
                const currentTime = Date.now();
         
     | 
| 
      
 1279 
     | 
    
         
            +
                const deltaTime = currentTime - this.lastUpdateTime;
         
     | 
| 
      
 1280 
     | 
    
         
            +
                let timeToConsume = deltaTime;
         
     | 
| 
      
 1281 
     | 
    
         
            +
                const remainingChars = this.targetText.length - this.currentText.length;
         
     | 
| 
      
 1282 
     | 
    
         
            +
                const baseTimePerChar = Math.min(5, 250 / remainingChars);
         
     | 
| 
      
 1283 
     | 
    
         
            +
                let charsToAdd = 0;
         
     | 
| 
      
 1284 
     | 
    
         
            +
                while (timeToConsume >= baseTimePerChar && charsToAdd < remainingChars) {
         
     | 
| 
      
 1285 
     | 
    
         
            +
                  charsToAdd++;
         
     | 
| 
      
 1286 
     | 
    
         
            +
                  timeToConsume -= baseTimePerChar;
         
     | 
| 
      
 1287 
     | 
    
         
            +
                }
         
     | 
| 
      
 1288 
     | 
    
         
            +
                if (charsToAdd !== remainingChars) {
         
     | 
| 
      
 1289 
     | 
    
         
            +
                  this.animationFrameId = requestAnimationFrame(this.animate);
         
     | 
| 
      
 1290 
     | 
    
         
            +
                } else {
         
     | 
| 
      
 1291 
     | 
    
         
            +
                  this.animationFrameId = null;
         
     | 
| 
      
 1292 
     | 
    
         
            +
                }
         
     | 
| 
      
 1293 
     | 
    
         
            +
                if (charsToAdd === 0) return;
         
     | 
| 
      
 1294 
     | 
    
         
            +
                this.currentText = this.targetText.slice(
         
     | 
| 
      
 1295 
     | 
    
         
            +
                  0,
         
     | 
| 
      
 1296 
     | 
    
         
            +
                  this.currentText.length + charsToAdd
         
     | 
| 
      
 1297 
     | 
    
         
            +
                );
         
     | 
| 
      
 1298 
     | 
    
         
            +
                this.lastUpdateTime = currentTime - timeToConsume;
         
     | 
| 
      
 1299 
     | 
    
         
            +
                this.setText(this.currentText);
         
     | 
| 
      
 1300 
     | 
    
         
            +
              };
         
     | 
| 
      
 1301 
     | 
    
         
            +
            };
         
     | 
| 
      
 1302 
     | 
    
         
            +
            var SMOOTH_STATUS = Object.freeze({
         
     | 
| 
      
 1303 
     | 
    
         
            +
              type: "running"
         
     | 
| 
      
 1304 
     | 
    
         
            +
            });
         
     | 
| 
      
 1305 
     | 
    
         
            +
            var useSmooth = (state, smooth = false) => {
         
     | 
| 
      
 1306 
     | 
    
         
            +
              const { useSmoothStatus: useSmoothStatus2 } = useSmoothContext({ optional: true }) ?? {};
         
     | 
| 
      
 1307 
     | 
    
         
            +
              const {
         
     | 
| 
      
 1308 
     | 
    
         
            +
                part: { text }
         
     | 
| 
      
 1309 
     | 
    
         
            +
              } = state;
         
     | 
| 
      
 1310 
     | 
    
         
            +
              const { useMessage } = useMessageContext();
         
     | 
| 
      
 1311 
     | 
    
         
            +
              const id = useMessage((m) => m.message.id);
         
     | 
| 
      
 1312 
     | 
    
         
            +
              const idRef = useRef3(id);
         
     | 
| 
      
 1313 
     | 
    
         
            +
              const [displayedText, setDisplayedText] = useState6(text);
         
     | 
| 
      
 1314 
     | 
    
         
            +
              const setText = useCallbackRef2((text2) => {
         
     | 
| 
      
 1315 
     | 
    
         
            +
                setDisplayedText(text2);
         
     | 
| 
      
 1316 
     | 
    
         
            +
                useSmoothStatus2?.setState(text2 !== state.part.text ? SMOOTH_STATUS : state.status);
         
     | 
| 
      
 1317 
     | 
    
         
            +
              });
         
     | 
| 
      
 1318 
     | 
    
         
            +
              const [animatorRef] = useState6(
         
     | 
| 
      
 1319 
     | 
    
         
            +
                new TextStreamAnimator(text, setText)
         
     | 
| 
      
 1320 
     | 
    
         
            +
              );
         
     | 
| 
      
 1321 
     | 
    
         
            +
              useEffect7(() => {
         
     | 
| 
      
 1322 
     | 
    
         
            +
                if (!smooth) {
         
     | 
| 
      
 1323 
     | 
    
         
            +
                  animatorRef.stop();
         
     | 
| 
      
 1324 
     | 
    
         
            +
                  return;
         
     | 
| 
      
 1325 
     | 
    
         
            +
                }
         
     | 
| 
      
 1326 
     | 
    
         
            +
                if (idRef.current !== id || !text.startsWith(animatorRef.targetText)) {
         
     | 
| 
      
 1327 
     | 
    
         
            +
                  idRef.current = id;
         
     | 
| 
      
 1328 
     | 
    
         
            +
                  setText(text);
         
     | 
| 
      
 1329 
     | 
    
         
            +
                  animatorRef.currentText = text;
         
     | 
| 
      
 1330 
     | 
    
         
            +
                  animatorRef.targetText = text;
         
     | 
| 
      
 1331 
     | 
    
         
            +
                  animatorRef.stop();
         
     | 
| 
      
 1332 
     | 
    
         
            +
                  return;
         
     | 
| 
      
 1333 
     | 
    
         
            +
                }
         
     | 
| 
      
 1334 
     | 
    
         
            +
                animatorRef.targetText = text;
         
     | 
| 
      
 1335 
     | 
    
         
            +
                animatorRef.start();
         
     | 
| 
      
 1336 
     | 
    
         
            +
              }, [setText, animatorRef, id, smooth, text]);
         
     | 
| 
      
 1337 
     | 
    
         
            +
              useEffect7(() => {
         
     | 
| 
      
 1338 
     | 
    
         
            +
                return () => {
         
     | 
| 
      
 1339 
     | 
    
         
            +
                  animatorRef.stop();
         
     | 
| 
      
 1340 
     | 
    
         
            +
                };
         
     | 
| 
      
 1341 
     | 
    
         
            +
              }, [animatorRef]);
         
     | 
| 
      
 1342 
     | 
    
         
            +
              return useMemo3(
         
     | 
| 
      
 1343 
     | 
    
         
            +
                () => smooth ? {
         
     | 
| 
      
 1344 
     | 
    
         
            +
                  part: { type: "text", text: displayedText },
         
     | 
| 
      
 1345 
     | 
    
         
            +
                  status: text === displayedText ? state.status : SMOOTH_STATUS
         
     | 
| 
      
 1346 
     | 
    
         
            +
                } : state,
         
     | 
| 
      
 1347 
     | 
    
         
            +
                [smooth, displayedText, state, text]
         
     | 
| 
      
 1348 
     | 
    
         
            +
              );
         
     | 
| 
      
 1349 
     | 
    
         
            +
            };
         
     | 
| 
      
 1350 
     | 
    
         
            +
             
     | 
| 
      
 1351 
     | 
    
         
            +
            // src/primitives/contentPart/ContentPartText.tsx
         
     | 
| 
      
 1352 
     | 
    
         
            +
            import { jsx as jsx15 } from "react/jsx-runtime";
         
     | 
| 
      
 1353 
     | 
    
         
            +
            var ContentPartPrimitiveText = forwardRef8(({ smooth = true, component: Component = "span", ...rest }, forwardedRef) => {
         
     | 
| 
       1151 
1354 
     | 
    
         
             
              const {
         
     | 
| 
       1152 
1355 
     | 
    
         
             
                part: { text },
         
     | 
| 
       1153 
1356 
     | 
    
         
             
                status
         
     | 
| 
       1154 
1357 
     | 
    
         
             
              } = useSmooth(useContentPartText(), smooth);
         
     | 
| 
       1155 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 1358 
     | 
    
         
            +
              return /* @__PURE__ */ jsx15(Component, { "data-status": status.type, ...rest, ref: forwardedRef, children: text });
         
     | 
| 
       1156 
1359 
     | 
    
         
             
            });
         
     | 
| 
       1157 
1360 
     | 
    
         
             
            ContentPartPrimitiveText.displayName = "ContentPartPrimitive.Text";
         
     | 
| 
       1158 
1361 
     | 
    
         | 
| 
       1159 
1362 
     | 
    
         
             
            // src/primitives/contentPart/ContentPartImage.tsx
         
     | 
| 
       1160 
1363 
     | 
    
         
             
            import { Primitive as Primitive4 } from "@radix-ui/react-primitive";
         
     | 
| 
       1161 
     | 
    
         
            -
            import { forwardRef as  
     | 
| 
       1162 
     | 
    
         
            -
            import { jsx as  
     | 
| 
       1163 
     | 
    
         
            -
            var ContentPartPrimitiveImage =  
     | 
| 
      
 1364 
     | 
    
         
            +
            import { forwardRef as forwardRef9 } from "react";
         
     | 
| 
      
 1365 
     | 
    
         
            +
            import { jsx as jsx16 } from "react/jsx-runtime";
         
     | 
| 
      
 1366 
     | 
    
         
            +
            var ContentPartPrimitiveImage = forwardRef9((props, forwardedRef) => {
         
     | 
| 
       1164 
1367 
     | 
    
         
             
              const {
         
     | 
| 
       1165 
1368 
     | 
    
         
             
                part: { image }
         
     | 
| 
       1166 
1369 
     | 
    
         
             
              } = useContentPartImage();
         
     | 
| 
       1167 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 1370 
     | 
    
         
            +
              return /* @__PURE__ */ jsx16(Primitive4.img, { src: image, ...props, ref: forwardedRef });
         
     | 
| 
       1168 
1371 
     | 
    
         
             
            });
         
     | 
| 
       1169 
1372 
     | 
    
         
             
            ContentPartPrimitiveImage.displayName = "ContentPartPrimitive.Image";
         
     | 
| 
       1170 
1373 
     | 
    
         | 
| 
         @@ -1186,20 +1389,20 @@ var ContentPartPrimitiveInProgress = ({ children }) => { 
     | 
|
| 
       1186 
1389 
     | 
    
         
             
            ContentPartPrimitiveInProgress.displayName = "ContentPartPrimitive.InProgress";
         
     | 
| 
       1187 
1390 
     | 
    
         | 
| 
       1188 
1391 
     | 
    
         
             
            // src/primitives/message/MessageContent.tsx
         
     | 
| 
       1189 
     | 
    
         
            -
            import { jsx as  
     | 
| 
      
 1392 
     | 
    
         
            +
            import { jsx as jsx17, jsxs as jsxs2 } from "react/jsx-runtime";
         
     | 
| 
       1190 
1393 
     | 
    
         
             
            var defaultComponents = {
         
     | 
| 
       1191 
1394 
     | 
    
         
             
              Text: () => /* @__PURE__ */ jsxs2("p", { style: { whiteSpace: "pre-line" }, children: [
         
     | 
| 
       1192 
     | 
    
         
            -
                /* @__PURE__ */  
     | 
| 
       1193 
     | 
    
         
            -
                /* @__PURE__ */  
     | 
| 
      
 1395 
     | 
    
         
            +
                /* @__PURE__ */ jsx17(ContentPartPrimitiveText, {}),
         
     | 
| 
      
 1396 
     | 
    
         
            +
                /* @__PURE__ */ jsx17(ContentPartPrimitiveInProgress, { children: /* @__PURE__ */ jsx17("span", { style: { fontFamily: "revert" }, children: " \u25CF" }) })
         
     | 
| 
       1194 
1397 
     | 
    
         
             
              ] }),
         
     | 
| 
       1195 
     | 
    
         
            -
              Image: () => /* @__PURE__ */  
     | 
| 
       1196 
     | 
    
         
            -
              UI: () => /* @__PURE__ */  
     | 
| 
      
 1398 
     | 
    
         
            +
              Image: () => /* @__PURE__ */ jsx17(ContentPartPrimitiveImage, {}),
         
     | 
| 
      
 1399 
     | 
    
         
            +
              UI: () => /* @__PURE__ */ jsx17(ContentPartPrimitiveDisplay, {}),
         
     | 
| 
       1197 
1400 
     | 
    
         
             
              tools: {
         
     | 
| 
       1198 
1401 
     | 
    
         
             
                Fallback: (props) => {
         
     | 
| 
       1199 
1402 
     | 
    
         
             
                  const { useToolUIs } = useAssistantContext();
         
     | 
| 
       1200 
1403 
     | 
    
         
             
                  const Render = useToolUIs((s) => s.getToolUI(props.part.toolName));
         
     | 
| 
       1201 
1404 
     | 
    
         
             
                  if (!Render) return null;
         
     | 
| 
       1202 
     | 
    
         
            -
                  return /* @__PURE__ */  
     | 
| 
      
 1405 
     | 
    
         
            +
                  return /* @__PURE__ */ jsx17(Render, { ...props });
         
     | 
| 
       1203 
1406 
     | 
    
         
             
                }
         
     | 
| 
       1204 
1407 
     | 
    
         
             
              }
         
     | 
| 
       1205 
1408 
     | 
    
         
             
            };
         
     | 
| 
         @@ -1222,16 +1425,16 @@ var MessageContentPartComponent = ({ 
     | 
|
| 
       1222 
1425 
     | 
    
         
             
                case "text":
         
     | 
| 
       1223 
1426 
     | 
    
         
             
                  if (status.type === "requires-action")
         
     | 
| 
       1224 
1427 
     | 
    
         
             
                    throw new Error("Encountered unexpected requires-action status");
         
     | 
| 
       1225 
     | 
    
         
            -
                  if (part === EMPTY_CONTENT) return /* @__PURE__ */  
     | 
| 
       1226 
     | 
    
         
            -
                  return /* @__PURE__ */  
     | 
| 
      
 1428 
     | 
    
         
            +
                  if (part === EMPTY_CONTENT) return /* @__PURE__ */ jsx17(Empty, { part, status });
         
     | 
| 
      
 1429 
     | 
    
         
            +
                  return /* @__PURE__ */ jsx17(Text2, { part, status });
         
     | 
| 
       1227 
1430 
     | 
    
         
             
                case "image":
         
     | 
| 
       1228 
1431 
     | 
    
         
             
                  if (status.type === "requires-action")
         
     | 
| 
       1229 
1432 
     | 
    
         
             
                    throw new Error("Encountered unexpected requires-action status");
         
     | 
| 
       1230 
     | 
    
         
            -
                  return /* @__PURE__ */  
     | 
| 
      
 1433 
     | 
    
         
            +
                  return /* @__PURE__ */ jsx17(Image2, { part, status });
         
     | 
| 
       1231 
1434 
     | 
    
         
             
                case "ui":
         
     | 
| 
       1232 
1435 
     | 
    
         
             
                  if (status.type === "requires-action")
         
     | 
| 
       1233 
1436 
     | 
    
         
             
                    throw new Error("Encountered unexpected requires-action status");
         
     | 
| 
       1234 
     | 
    
         
            -
                  return /* @__PURE__ */  
     | 
| 
      
 1437 
     | 
    
         
            +
                  return /* @__PURE__ */ jsx17(UI, { part, status });
         
     | 
| 
       1235 
1438 
     | 
    
         
             
                case "tool-call": {
         
     | 
| 
       1236 
1439 
     | 
    
         
             
                  const Tool = by_name[part.toolName] || Fallback2;
         
     | 
| 
       1237 
1440 
     | 
    
         
             
                  const addResult = (result) => addToolResult({
         
     | 
| 
         @@ -1239,7 +1442,7 @@ var MessageContentPartComponent = ({ 
     | 
|
| 
       1239 
1442 
     | 
    
         
             
                    toolCallId: part.toolCallId,
         
     | 
| 
       1240 
1443 
     | 
    
         
             
                    result
         
     | 
| 
       1241 
1444 
     | 
    
         
             
                  });
         
     | 
| 
       1242 
     | 
    
         
            -
                  return /* @__PURE__ */  
     | 
| 
      
 1445 
     | 
    
         
            +
                  return /* @__PURE__ */ jsx17(Tool, { part, status, addResult });
         
     | 
| 
       1243 
1446 
     | 
    
         
             
                }
         
     | 
| 
       1244 
1447 
     | 
    
         
             
                default:
         
     | 
| 
       1245 
1448 
     | 
    
         
             
                  const unhandledType = type;
         
     | 
| 
         @@ -1250,7 +1453,7 @@ var MessageContentPartImpl = ({ 
     | 
|
| 
       1250 
1453 
     | 
    
         
             
              partIndex,
         
     | 
| 
       1251 
1454 
     | 
    
         
             
              components
         
     | 
| 
       1252 
1455 
     | 
    
         
             
            }) => {
         
     | 
| 
       1253 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 1456 
     | 
    
         
            +
              return /* @__PURE__ */ jsx17(ContentPartProvider, { partIndex, children: /* @__PURE__ */ jsx17(MessageContentPartComponent, { components }) });
         
     | 
| 
       1254 
1457 
     | 
    
         
             
            };
         
     | 
| 
       1255 
1458 
     | 
    
         
             
            var MessageContentPart = memo2(
         
     | 
| 
       1256 
1459 
     | 
    
         
             
              MessageContentPartImpl,
         
     | 
| 
         @@ -1263,7 +1466,7 @@ var MessagePrimitiveContent = ({ 
     | 
|
| 
       1263 
1466 
     | 
    
         
             
              const contentLength = useMessage((s) => s.message.content.length) || 1;
         
     | 
| 
       1264 
1467 
     | 
    
         
             
              return new Array(contentLength).fill(null).map((_, idx) => {
         
     | 
| 
       1265 
1468 
     | 
    
         
             
                const partIndex = idx;
         
     | 
| 
       1266 
     | 
    
         
            -
                return /* @__PURE__ */  
     | 
| 
      
 1469 
     | 
    
         
            +
                return /* @__PURE__ */ jsx17(
         
     | 
| 
       1267 
1470 
     | 
    
         
             
                  MessageContentPart,
         
     | 
| 
       1268 
1471 
     | 
    
         
             
                  {
         
     | 
| 
       1269 
1472 
     | 
    
         
             
                    partIndex,
         
     | 
| 
         @@ -1282,9 +1485,9 @@ var MessagePrimitiveInProgress = () => { 
     | 
|
| 
       1282 
1485 
     | 
    
         
             
            MessagePrimitiveInProgress.displayName = "MessagePrimitive.InProgress";
         
     | 
| 
       1283 
1486 
     | 
    
         | 
| 
       1284 
1487 
     | 
    
         
             
            // src/primitives/branchPicker/BranchPickerRoot.tsx
         
     | 
| 
       1285 
     | 
    
         
            -
            import { jsx as  
     | 
| 
       1286 
     | 
    
         
            -
            var BranchPickerPrimitiveRoot =  
     | 
| 
       1287 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 1488 
     | 
    
         
            +
            import { jsx as jsx18 } from "react/jsx-runtime";
         
     | 
| 
      
 1489 
     | 
    
         
            +
            var BranchPickerPrimitiveRoot = forwardRef10(({ hideWhenSingleBranch, ...rest }, ref) => {
         
     | 
| 
      
 1490 
     | 
    
         
            +
              return /* @__PURE__ */ jsx18(MessagePrimitiveIf, { hasBranches: hideWhenSingleBranch ? true : void 0, children: /* @__PURE__ */ jsx18(Primitive5.div, { ...rest, ref }) });
         
     | 
| 
       1288 
1491 
     | 
    
         
             
            });
         
     | 
| 
       1289 
1492 
     | 
    
         
             
            BranchPickerPrimitiveRoot.displayName = "BranchPickerPrimitive.Root";
         
     | 
| 
       1290 
1493 
     | 
    
         | 
| 
         @@ -1302,17 +1505,17 @@ __export(composer_exports, { 
     | 
|
| 
       1302 
1505 
     | 
    
         
             
            import { composeEventHandlers as composeEventHandlers4 } from "@radix-ui/primitive";
         
     | 
| 
       1303 
1506 
     | 
    
         
             
            import { Primitive as Primitive6 } from "@radix-ui/react-primitive";
         
     | 
| 
       1304 
1507 
     | 
    
         
             
            import {
         
     | 
| 
       1305 
     | 
    
         
            -
              forwardRef as  
     | 
| 
      
 1508 
     | 
    
         
            +
              forwardRef as forwardRef11
         
     | 
| 
       1306 
1509 
     | 
    
         
             
            } from "react";
         
     | 
| 
       1307 
     | 
    
         
            -
            import { jsx as  
     | 
| 
       1308 
     | 
    
         
            -
            var ComposerPrimitiveRoot =  
     | 
| 
      
 1510 
     | 
    
         
            +
            import { jsx as jsx19 } from "react/jsx-runtime";
         
     | 
| 
      
 1511 
     | 
    
         
            +
            var ComposerPrimitiveRoot = forwardRef11(({ onSubmit, ...rest }, forwardedRef) => {
         
     | 
| 
       1309 
1512 
     | 
    
         
             
              const send = useComposerSend();
         
     | 
| 
       1310 
1513 
     | 
    
         
             
              const handleSubmit = (e) => {
         
     | 
| 
       1311 
1514 
     | 
    
         
             
                e.preventDefault();
         
     | 
| 
       1312 
1515 
     | 
    
         
             
                if (!send) return;
         
     | 
| 
       1313 
1516 
     | 
    
         
             
                send();
         
     | 
| 
       1314 
1517 
     | 
    
         
             
              };
         
     | 
| 
       1315 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 1518 
     | 
    
         
            +
              return /* @__PURE__ */ jsx19(
         
     | 
| 
       1316 
1519 
     | 
    
         
             
                Primitive6.form,
         
     | 
| 
       1317 
1520 
     | 
    
         
             
                {
         
     | 
| 
       1318 
1521 
     | 
    
         
             
                  ...rest,
         
     | 
| 
         @@ -1328,15 +1531,15 @@ import { composeEventHandlers as composeEventHandlers5 } from "@radix-ui/primiti 
     | 
|
| 
       1328 
1531 
     | 
    
         
             
            import { useComposedRefs as useComposedRefs2 } from "@radix-ui/react-compose-refs";
         
     | 
| 
       1329 
1532 
     | 
    
         
             
            import { Slot } from "@radix-ui/react-slot";
         
     | 
| 
       1330 
1533 
     | 
    
         
             
            import {
         
     | 
| 
       1331 
     | 
    
         
            -
              forwardRef as  
     | 
| 
      
 1534 
     | 
    
         
            +
              forwardRef as forwardRef12,
         
     | 
| 
       1332 
1535 
     | 
    
         
             
              useCallback as useCallback15,
         
     | 
| 
       1333 
     | 
    
         
            -
              useEffect as  
     | 
| 
       1334 
     | 
    
         
            -
              useRef as  
     | 
| 
      
 1536 
     | 
    
         
            +
              useEffect as useEffect8,
         
     | 
| 
      
 1537 
     | 
    
         
            +
              useRef as useRef4
         
     | 
| 
       1335 
1538 
     | 
    
         
             
            } from "react";
         
     | 
| 
       1336 
1539 
     | 
    
         
             
            import TextareaAutosize from "react-textarea-autosize";
         
     | 
| 
       1337 
1540 
     | 
    
         
             
            import { useEscapeKeydown } from "@radix-ui/react-use-escape-keydown";
         
     | 
| 
       1338 
     | 
    
         
            -
            import { jsx as  
     | 
| 
       1339 
     | 
    
         
            -
            var ComposerPrimitiveInput =  
     | 
| 
      
 1541 
     | 
    
         
            +
            import { jsx as jsx20 } from "react/jsx-runtime";
         
     | 
| 
      
 1542 
     | 
    
         
            +
            var ComposerPrimitiveInput = forwardRef12(
         
     | 
| 
       1340 
1543 
     | 
    
         
             
              ({
         
     | 
| 
       1341 
1544 
     | 
    
         
             
                autoFocus = false,
         
     | 
| 
       1342 
1545 
     | 
    
         
             
                asChild,
         
     | 
| 
         @@ -1353,7 +1556,7 @@ var ComposerPrimitiveInput = forwardRef11( 
     | 
|
| 
       1353 
1556 
     | 
    
         
             
                });
         
     | 
| 
       1354 
1557 
     | 
    
         
             
                const Component = asChild ? Slot : TextareaAutosize;
         
     | 
| 
       1355 
1558 
     | 
    
         
             
                const isDisabled = useThread((t) => t.isDisabled) ?? disabledProp ?? false;
         
     | 
| 
       1356 
     | 
    
         
            -
                const textareaRef =  
     | 
| 
      
 1559 
     | 
    
         
            +
                const textareaRef = useRef4(null);
         
     | 
| 
       1357 
1560 
     | 
    
         
             
                const ref = useComposedRefs2(forwardedRef, textareaRef);
         
     | 
| 
       1358 
1561 
     | 
    
         
             
                useEscapeKeydown((e) => {
         
     | 
| 
       1359 
1562 
     | 
    
         
             
                  const composer = useComposer.getState();
         
     | 
| 
         @@ -1382,13 +1585,13 @@ var ComposerPrimitiveInput = forwardRef11( 
     | 
|
| 
       1382 
1585 
     | 
    
         
             
                    textareaRef.current.value.length
         
     | 
| 
       1383 
1586 
     | 
    
         
             
                  );
         
     | 
| 
       1384 
1587 
     | 
    
         
             
                }, [autoFocusEnabled]);
         
     | 
| 
       1385 
     | 
    
         
            -
                 
     | 
| 
      
 1588 
     | 
    
         
            +
                useEffect8(() => focus(), [focus]);
         
     | 
| 
       1386 
1589 
     | 
    
         
             
                useOnComposerFocus(() => {
         
     | 
| 
       1387 
1590 
     | 
    
         
             
                  if (type === "new") {
         
     | 
| 
       1388 
1591 
     | 
    
         
             
                    focus();
         
     | 
| 
       1389 
1592 
     | 
    
         
             
                  }
         
     | 
| 
       1390 
1593 
     | 
    
         
             
                });
         
     | 
| 
       1391 
     | 
    
         
            -
                return /* @__PURE__ */  
     | 
| 
      
 1594 
     | 
    
         
            +
                return /* @__PURE__ */ jsx20(
         
     | 
| 
       1392 
1595 
     | 
    
         
             
                  Component,
         
     | 
| 
       1393 
1596 
     | 
    
         
             
                  {
         
     | 
| 
       1394 
1597 
     | 
    
         
             
                    name: "input",
         
     | 
| 
         @@ -1409,13 +1612,13 @@ var ComposerPrimitiveInput = forwardRef11( 
     | 
|
| 
       1409 
1612 
     | 
    
         
             
            ComposerPrimitiveInput.displayName = "ComposerPrimitive.Input";
         
     | 
| 
       1410 
1613 
     | 
    
         | 
| 
       1411 
1614 
     | 
    
         
             
            // src/primitives/composer/ComposerSend.tsx
         
     | 
| 
       1412 
     | 
    
         
            -
            import { forwardRef as  
     | 
| 
      
 1615 
     | 
    
         
            +
            import { forwardRef as forwardRef13 } from "react";
         
     | 
| 
       1413 
1616 
     | 
    
         
             
            import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
         
     | 
| 
       1414 
     | 
    
         
            -
            import { jsx as  
     | 
| 
       1415 
     | 
    
         
            -
            var ComposerPrimitiveSend =  
     | 
| 
      
 1617 
     | 
    
         
            +
            import { jsx as jsx21 } from "react/jsx-runtime";
         
     | 
| 
      
 1618 
     | 
    
         
            +
            var ComposerPrimitiveSend = forwardRef13(({ disabled, ...rest }, ref) => {
         
     | 
| 
       1416 
1619 
     | 
    
         
             
              const { useComposer } = useComposerContext();
         
     | 
| 
       1417 
1620 
     | 
    
         
             
              const hasValue = useComposer((c) => c.isEditing && c.value.length > 0);
         
     | 
| 
       1418 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 1621 
     | 
    
         
            +
              return /* @__PURE__ */ jsx21(
         
     | 
| 
       1419 
1622 
     | 
    
         
             
                Primitive7.button,
         
     | 
| 
       1420 
1623 
     | 
    
         
             
                {
         
     | 
| 
       1421 
1624 
     | 
    
         
             
                  type: "submit",
         
     | 
| 
         @@ -1466,10 +1669,10 @@ __export(thread_exports, { 
     | 
|
| 
       1466 
1669 
     | 
    
         | 
| 
       1467 
1670 
     | 
    
         
             
            // src/primitives/thread/ThreadRoot.tsx
         
     | 
| 
       1468 
1671 
     | 
    
         
             
            import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
         
     | 
| 
       1469 
     | 
    
         
            -
            import { forwardRef as  
     | 
| 
       1470 
     | 
    
         
            -
            import { jsx as  
     | 
| 
       1471 
     | 
    
         
            -
            var ThreadPrimitiveRoot =  
     | 
| 
       1472 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 1672 
     | 
    
         
            +
            import { forwardRef as forwardRef14 } from "react";
         
     | 
| 
      
 1673 
     | 
    
         
            +
            import { jsx as jsx22 } from "react/jsx-runtime";
         
     | 
| 
      
 1674 
     | 
    
         
            +
            var ThreadPrimitiveRoot = forwardRef14((props, ref) => {
         
     | 
| 
      
 1675 
     | 
    
         
            +
              return /* @__PURE__ */ jsx22(Primitive8.div, { ...props, ref });
         
     | 
| 
       1473 
1676 
     | 
    
         
             
            });
         
     | 
| 
       1474 
1677 
     | 
    
         
             
            ThreadPrimitiveRoot.displayName = "ThreadPrimitive.Root";
         
     | 
| 
       1475 
1678 
     | 
    
         | 
| 
         @@ -1495,17 +1698,17 @@ ThreadPrimitiveIf.displayName = "ThreadPrimitive.If"; 
     | 
|
| 
       1495 
1698 
     | 
    
         
             
            // src/primitives/thread/ThreadViewport.tsx
         
     | 
| 
       1496 
1699 
     | 
    
         
             
            import { useComposedRefs as useComposedRefs4 } from "@radix-ui/react-compose-refs";
         
     | 
| 
       1497 
1700 
     | 
    
         
             
            import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
         
     | 
| 
       1498 
     | 
    
         
            -
            import { forwardRef as  
     | 
| 
      
 1701 
     | 
    
         
            +
            import { forwardRef as forwardRef15 } from "react";
         
     | 
| 
       1499 
1702 
     | 
    
         | 
| 
       1500 
1703 
     | 
    
         
             
            // src/primitive-hooks/thread/useThreadViewportAutoScroll.tsx
         
     | 
| 
       1501 
1704 
     | 
    
         
             
            import { useComposedRefs as useComposedRefs3 } from "@radix-ui/react-compose-refs";
         
     | 
| 
       1502 
     | 
    
         
            -
            import { useRef as  
     | 
| 
      
 1705 
     | 
    
         
            +
            import { useRef as useRef5 } from "react";
         
     | 
| 
       1503 
1706 
     | 
    
         | 
| 
       1504 
1707 
     | 
    
         
             
            // src/utils/hooks/useOnResizeContent.tsx
         
     | 
| 
       1505 
     | 
    
         
            -
            import { useCallbackRef as  
     | 
| 
      
 1708 
     | 
    
         
            +
            import { useCallbackRef as useCallbackRef3 } from "@radix-ui/react-use-callback-ref";
         
     | 
| 
       1506 
1709 
     | 
    
         
             
            import { useCallback as useCallback16 } from "react";
         
     | 
| 
       1507 
1710 
     | 
    
         
             
            var useOnResizeContent = (callback) => {
         
     | 
| 
       1508 
     | 
    
         
            -
              const callbackRef =  
     | 
| 
      
 1711 
     | 
    
         
            +
              const callbackRef = useCallbackRef3(callback);
         
     | 
| 
       1509 
1712 
     | 
    
         
             
              const refCallback = useCallback16(
         
     | 
| 
       1510 
1713 
     | 
    
         
             
                (el) => {
         
     | 
| 
       1511 
1714 
     | 
    
         
             
                  const resizeObserver = new ResizeObserver(() => {
         
     | 
| 
         @@ -1542,12 +1745,12 @@ var useOnResizeContent = (callback) => { 
     | 
|
| 
       1542 
1745 
     | 
    
         
             
            };
         
     | 
| 
       1543 
1746 
     | 
    
         | 
| 
       1544 
1747 
     | 
    
         
             
            // src/utils/hooks/useOnScrollToBottom.tsx
         
     | 
| 
       1545 
     | 
    
         
            -
            import { useCallbackRef as  
     | 
| 
       1546 
     | 
    
         
            -
            import { useEffect as  
     | 
| 
      
 1748 
     | 
    
         
            +
            import { useCallbackRef as useCallbackRef4 } from "@radix-ui/react-use-callback-ref";
         
     | 
| 
      
 1749 
     | 
    
         
            +
            import { useEffect as useEffect9 } from "react";
         
     | 
| 
       1547 
1750 
     | 
    
         
             
            var useOnScrollToBottom = (callback) => {
         
     | 
| 
       1548 
     | 
    
         
            -
              const callbackRef =  
     | 
| 
      
 1751 
     | 
    
         
            +
              const callbackRef = useCallbackRef4(callback);
         
     | 
| 
       1549 
1752 
     | 
    
         
             
              const { useViewport } = useThreadContext();
         
     | 
| 
       1550 
     | 
    
         
            -
               
     | 
| 
      
 1753 
     | 
    
         
            +
              useEffect9(() => {
         
     | 
| 
       1551 
1754 
     | 
    
         
             
                return useViewport.getState().onScrollToBottom(() => {
         
     | 
| 
       1552 
1755 
     | 
    
         
             
                  callbackRef();
         
     | 
| 
       1553 
1756 
     | 
    
         
             
                });
         
     | 
| 
         @@ -1558,10 +1761,10 @@ var useOnScrollToBottom = (callback) => { 
     | 
|
| 
       1558 
1761 
     | 
    
         
             
            var useThreadViewportAutoScroll = ({
         
     | 
| 
       1559 
1762 
     | 
    
         
             
              autoScroll = true
         
     | 
| 
       1560 
1763 
     | 
    
         
             
            }) => {
         
     | 
| 
       1561 
     | 
    
         
            -
              const divRef =  
     | 
| 
      
 1764 
     | 
    
         
            +
              const divRef = useRef5(null);
         
     | 
| 
       1562 
1765 
     | 
    
         
             
              const { useViewport } = useThreadContext();
         
     | 
| 
       1563 
     | 
    
         
            -
              const lastScrollTop =  
     | 
| 
       1564 
     | 
    
         
            -
              const isScrollingToBottomRef =  
     | 
| 
      
 1766 
     | 
    
         
            +
              const lastScrollTop = useRef5(0);
         
     | 
| 
      
 1767 
     | 
    
         
            +
              const isScrollingToBottomRef = useRef5(false);
         
     | 
| 
       1565 
1768 
     | 
    
         
             
              const scrollToBottom = (behavior) => {
         
     | 
| 
       1566 
1769 
     | 
    
         
             
                const div = divRef.current;
         
     | 
| 
       1567 
1770 
     | 
    
         
             
                if (!div || !autoScroll) return;
         
     | 
| 
         @@ -1606,13 +1809,13 @@ var useThreadViewportAutoScroll = ({ 
     | 
|
| 
       1606 
1809 
     | 
    
         
             
            };
         
     | 
| 
       1607 
1810 
     | 
    
         | 
| 
       1608 
1811 
     | 
    
         
             
            // src/primitives/thread/ThreadViewport.tsx
         
     | 
| 
       1609 
     | 
    
         
            -
            import { jsx as  
     | 
| 
       1610 
     | 
    
         
            -
            var ThreadPrimitiveViewport =  
     | 
| 
      
 1812 
     | 
    
         
            +
            import { jsx as jsx23 } from "react/jsx-runtime";
         
     | 
| 
      
 1813 
     | 
    
         
            +
            var ThreadPrimitiveViewport = forwardRef15(({ autoScroll, onScroll, children, ...rest }, forwardedRef) => {
         
     | 
| 
       1611 
1814 
     | 
    
         
             
              const autoScrollRef = useThreadViewportAutoScroll({
         
     | 
| 
       1612 
1815 
     | 
    
         
             
                autoScroll
         
     | 
| 
       1613 
1816 
     | 
    
         
             
              });
         
     | 
| 
       1614 
1817 
     | 
    
         
             
              const ref = useComposedRefs4(forwardedRef, autoScrollRef);
         
     | 
| 
       1615 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 1818 
     | 
    
         
            +
              return /* @__PURE__ */ jsx23(Primitive9.div, { ...rest, ref, children });
         
     | 
| 
       1616 
1819 
     | 
    
         
             
            });
         
     | 
| 
       1617 
1820 
     | 
    
         
             
            ThreadPrimitiveViewport.displayName = "ThreadPrimitive.Viewport";
         
     | 
| 
       1618 
1821 
     | 
    
         | 
| 
         @@ -1620,15 +1823,15 @@ ThreadPrimitiveViewport.displayName = "ThreadPrimitive.Viewport"; 
     | 
|
| 
       1620 
1823 
     | 
    
         
             
            import { memo as memo3 } from "react";
         
     | 
| 
       1621 
1824 
     | 
    
         | 
| 
       1622 
1825 
     | 
    
         
             
            // src/context/providers/MessageProvider.tsx
         
     | 
| 
       1623 
     | 
    
         
            -
            import { useEffect as  
     | 
| 
       1624 
     | 
    
         
            -
            import { create as  
     | 
| 
      
 1826 
     | 
    
         
            +
            import { useEffect as useEffect10, useState as useState7 } from "react";
         
     | 
| 
      
 1827 
     | 
    
         
            +
            import { create as create14 } from "zustand";
         
     | 
| 
       1625 
1828 
     | 
    
         | 
| 
       1626 
1829 
     | 
    
         
             
            // src/context/stores/EditComposer.ts
         
     | 
| 
       1627 
     | 
    
         
            -
            import { create as  
     | 
| 
      
 1830 
     | 
    
         
            +
            import { create as create12 } from "zustand";
         
     | 
| 
       1628 
1831 
     | 
    
         
             
            var makeEditComposerStore = ({
         
     | 
| 
       1629 
1832 
     | 
    
         
             
              onEdit,
         
     | 
| 
       1630 
1833 
     | 
    
         
             
              onSend
         
     | 
| 
       1631 
     | 
    
         
            -
            }) =>  
     | 
| 
      
 1834 
     | 
    
         
            +
            }) => create12()((set, get, store) => ({
         
     | 
| 
       1632 
1835 
     | 
    
         
             
              ...makeBaseComposer(set, get, store),
         
     | 
| 
       1633 
1836 
     | 
    
         
             
              canCancel: false,
         
     | 
| 
       1634 
1837 
     | 
    
         
             
              isEditing: false,
         
     | 
| 
         @@ -1647,8 +1850,8 @@ var makeEditComposerStore = ({ 
     | 
|
| 
       1647 
1850 
     | 
    
         
             
            }));
         
     | 
| 
       1648 
1851 
     | 
    
         | 
| 
       1649 
1852 
     | 
    
         
             
            // src/context/stores/MessageUtils.ts
         
     | 
| 
       1650 
     | 
    
         
            -
            import { create as  
     | 
| 
       1651 
     | 
    
         
            -
            var makeMessageUtilsStore = () =>  
     | 
| 
      
 1853 
     | 
    
         
            +
            import { create as create13 } from "zustand";
         
     | 
| 
      
 1854 
     | 
    
         
            +
            var makeMessageUtilsStore = () => create13((set) => ({
         
     | 
| 
       1652 
1855 
     | 
    
         
             
              isCopied: false,
         
     | 
| 
       1653 
1856 
     | 
    
         
             
              setIsCopied: (value) => {
         
     | 
| 
       1654 
1857 
     | 
    
         
             
                set({ isCopied: value });
         
     | 
| 
         @@ -1660,7 +1863,7 @@ var makeMessageUtilsStore = () => create12((set) => ({ 
     | 
|
| 
       1660 
1863 
     | 
    
         
             
            }));
         
     | 
| 
       1661 
1864 
     | 
    
         | 
| 
       1662 
1865 
     | 
    
         
             
            // src/context/providers/MessageProvider.tsx
         
     | 
| 
       1663 
     | 
    
         
            -
            import { jsx as  
     | 
| 
      
 1866 
     | 
    
         
            +
            import { jsx as jsx24 } from "react/jsx-runtime";
         
     | 
| 
       1664 
1867 
     | 
    
         
             
            var getIsLast = (messages, message) => {
         
     | 
| 
       1665 
1868 
     | 
    
         
             
              return messages[messages.length - 1]?.id === message.id;
         
     | 
| 
       1666 
1869 
     | 
    
         
             
            };
         
     | 
| 
         @@ -1682,8 +1885,8 @@ var getMessageState = (messages, getBranches, useMessage, messageIndex) => { 
     | 
|
| 
       1682 
1885 
     | 
    
         
             
            };
         
     | 
| 
       1683 
1886 
     | 
    
         
             
            var useMessageContext2 = (messageIndex) => {
         
     | 
| 
       1684 
1887 
     | 
    
         
             
              const { useThreadMessages, useThreadActions } = useThreadContext();
         
     | 
| 
       1685 
     | 
    
         
            -
              const [context] =  
     | 
| 
       1686 
     | 
    
         
            -
                const useMessage =  
     | 
| 
      
 1888 
     | 
    
         
            +
              const [context] = useState7(() => {
         
     | 
| 
      
 1889 
     | 
    
         
            +
                const useMessage = create14(
         
     | 
| 
       1687 
1890 
     | 
    
         
             
                  () => getMessageState(
         
     | 
| 
       1688 
1891 
     | 
    
         
             
                    useThreadMessages.getState(),
         
     | 
| 
       1689 
1892 
     | 
    
         
             
                    useThreadActions.getState().getBranches,
         
     | 
| 
         @@ -1720,7 +1923,7 @@ var useMessageContext2 = (messageIndex) => { 
     | 
|
| 
       1720 
1923 
     | 
    
         
             
                });
         
     | 
| 
       1721 
1924 
     | 
    
         
             
                return { useMessage, useMessageUtils, useEditComposer };
         
     | 
| 
       1722 
1925 
     | 
    
         
             
              });
         
     | 
| 
       1723 
     | 
    
         
            -
               
     | 
| 
      
 1926 
     | 
    
         
            +
              useEffect10(() => {
         
     | 
| 
       1724 
1927 
     | 
    
         
             
                const syncMessage = (thread) => {
         
     | 
| 
       1725 
1928 
     | 
    
         
             
                  const newState = getMessageState(
         
     | 
| 
       1726 
1929 
     | 
    
         
             
                    thread,
         
     | 
| 
         @@ -1744,11 +1947,11 @@ var MessageProvider = ({ 
     | 
|
| 
       1744 
1947 
     | 
    
         
             
              children
         
     | 
| 
       1745 
1948 
     | 
    
         
             
            }) => {
         
     | 
| 
       1746 
1949 
     | 
    
         
             
              const context = useMessageContext2(messageIndex);
         
     | 
| 
       1747 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 1950 
     | 
    
         
            +
              return /* @__PURE__ */ jsx24(MessageContext.Provider, { value: context, children });
         
     | 
| 
       1748 
1951 
     | 
    
         
             
            };
         
     | 
| 
       1749 
1952 
     | 
    
         | 
| 
       1750 
1953 
     | 
    
         
             
            // src/primitives/thread/ThreadMessages.tsx
         
     | 
| 
       1751 
     | 
    
         
            -
            import { jsx as  
     | 
| 
      
 1954 
     | 
    
         
            +
            import { jsx as jsx25, jsxs as jsxs3 } from "react/jsx-runtime";
         
     | 
| 
       1752 
1955 
     | 
    
         
             
            var DEFAULT_SYSTEM_MESSAGE = () => null;
         
     | 
| 
       1753 
1956 
     | 
    
         
             
            var getComponents = (components) => {
         
     | 
| 
       1754 
1957 
     | 
    
         
             
              return {
         
     | 
| 
         @@ -1765,11 +1968,11 @@ var ThreadMessageImpl = ({ 
     | 
|
| 
       1765 
1968 
     | 
    
         
             
              const { UserMessage: UserMessage2, EditComposer: EditComposer2, AssistantMessage: AssistantMessage2, SystemMessage: SystemMessage2 } = getComponents(components);
         
     | 
| 
       1766 
1969 
     | 
    
         
             
              return /* @__PURE__ */ jsxs3(MessageProvider, { messageIndex, children: [
         
     | 
| 
       1767 
1970 
     | 
    
         
             
                /* @__PURE__ */ jsxs3(MessagePrimitiveIf, { user: true, children: [
         
     | 
| 
       1768 
     | 
    
         
            -
                  /* @__PURE__ */  
     | 
| 
       1769 
     | 
    
         
            -
                  /* @__PURE__ */  
     | 
| 
      
 1971 
     | 
    
         
            +
                  /* @__PURE__ */ jsx25(ComposerPrimitiveIf, { editing: false, children: /* @__PURE__ */ jsx25(UserMessage2, {}) }),
         
     | 
| 
      
 1972 
     | 
    
         
            +
                  /* @__PURE__ */ jsx25(ComposerPrimitiveIf, { editing: true, children: /* @__PURE__ */ jsx25(EditComposer2, {}) })
         
     | 
| 
       1770 
1973 
     | 
    
         
             
                ] }),
         
     | 
| 
       1771 
     | 
    
         
            -
                /* @__PURE__ */  
     | 
| 
       1772 
     | 
    
         
            -
                /* @__PURE__ */  
     | 
| 
      
 1974 
     | 
    
         
            +
                /* @__PURE__ */ jsx25(MessagePrimitiveIf, { assistant: true, children: /* @__PURE__ */ jsx25(AssistantMessage2, {}) }),
         
     | 
| 
      
 1975 
     | 
    
         
            +
                /* @__PURE__ */ jsx25(MessagePrimitiveIf, { system: true, children: /* @__PURE__ */ jsx25(SystemMessage2, {}) })
         
     | 
| 
       1773 
1976 
     | 
    
         
             
              ] });
         
     | 
| 
       1774 
1977 
     | 
    
         
             
            };
         
     | 
| 
       1775 
1978 
     | 
    
         
             
            var ThreadMessage = memo3(
         
     | 
| 
         @@ -1784,7 +1987,7 @@ var ThreadPrimitiveMessagesImpl = ({ 
     | 
|
| 
       1784 
1987 
     | 
    
         
             
              if (messagesLength === 0) return null;
         
     | 
| 
       1785 
1988 
     | 
    
         
             
              return new Array(messagesLength).fill(null).map((_, idx) => {
         
     | 
| 
       1786 
1989 
     | 
    
         
             
                const messageIndex = idx;
         
     | 
| 
       1787 
     | 
    
         
            -
                return /* @__PURE__ */  
     | 
| 
      
 1990 
     | 
    
         
            +
                return /* @__PURE__ */ jsx25(
         
     | 
| 
       1788 
1991 
     | 
    
         
             
                  ThreadMessage,
         
     | 
| 
       1789 
1992 
     | 
    
         
             
                  {
         
     | 
| 
       1790 
1993 
     | 
    
         
             
                    messageIndex,
         
     | 
| 
         @@ -1814,7 +2017,378 @@ var ThreadPrimitiveSuggestion = createActionButton( 
     | 
|
| 
       1814 
2017 
     | 
    
         
             
            );
         
     | 
| 
       1815 
2018 
     | 
    
         | 
| 
       1816 
2019 
     | 
    
         
             
            // src/runtimes/local/useLocalRuntime.tsx
         
     | 
| 
       1817 
     | 
    
         
            -
            import { useInsertionEffect as useInsertionEffect3, useState as  
     | 
| 
      
 2020 
     | 
    
         
            +
            import { useInsertionEffect as useInsertionEffect3, useState as useState9 } from "react";
         
     | 
| 
      
 2021 
     | 
    
         
            +
             
     | 
| 
      
 2022 
     | 
    
         
            +
            // src/runtimes/core/BaseAssistantRuntime.tsx
         
     | 
| 
      
 2023 
     | 
    
         
            +
            var BaseAssistantRuntime = class {
         
     | 
| 
      
 2024 
     | 
    
         
            +
              constructor(_thread) {
         
     | 
| 
      
 2025 
     | 
    
         
            +
                this._thread = _thread;
         
     | 
| 
      
 2026 
     | 
    
         
            +
                this._thread = _thread;
         
     | 
| 
      
 2027 
     | 
    
         
            +
              }
         
     | 
| 
      
 2028 
     | 
    
         
            +
              get thread() {
         
     | 
| 
      
 2029 
     | 
    
         
            +
                return this._thread;
         
     | 
| 
      
 2030 
     | 
    
         
            +
              }
         
     | 
| 
      
 2031 
     | 
    
         
            +
              set thread(thread) {
         
     | 
| 
      
 2032 
     | 
    
         
            +
                this._thread = thread;
         
     | 
| 
      
 2033 
     | 
    
         
            +
                this.subscriptionHandler();
         
     | 
| 
      
 2034 
     | 
    
         
            +
              }
         
     | 
| 
      
 2035 
     | 
    
         
            +
              _subscriptions = /* @__PURE__ */ new Set();
         
     | 
| 
      
 2036 
     | 
    
         
            +
              subscribe(callback) {
         
     | 
| 
      
 2037 
     | 
    
         
            +
                this._subscriptions.add(callback);
         
     | 
| 
      
 2038 
     | 
    
         
            +
                return () => this._subscriptions.delete(callback);
         
     | 
| 
      
 2039 
     | 
    
         
            +
              }
         
     | 
| 
      
 2040 
     | 
    
         
            +
              subscriptionHandler = () => {
         
     | 
| 
      
 2041 
     | 
    
         
            +
                for (const callback of this._subscriptions) callback();
         
     | 
| 
      
 2042 
     | 
    
         
            +
              };
         
     | 
| 
      
 2043 
     | 
    
         
            +
            };
         
     | 
| 
      
 2044 
     | 
    
         
            +
             
     | 
| 
      
 2045 
     | 
    
         
            +
            // src/internal.ts
         
     | 
| 
      
 2046 
     | 
    
         
            +
            var internal_exports = {};
         
     | 
| 
      
 2047 
     | 
    
         
            +
            __export(internal_exports, {
         
     | 
| 
      
 2048 
     | 
    
         
            +
              BaseAssistantRuntime: () => BaseAssistantRuntime,
         
     | 
| 
      
 2049 
     | 
    
         
            +
              MessageRepository: () => MessageRepository,
         
     | 
| 
      
 2050 
     | 
    
         
            +
              ProxyConfigProvider: () => ProxyConfigProvider,
         
     | 
| 
      
 2051 
     | 
    
         
            +
              TooltipIconButton: () => TooltipIconButton,
         
     | 
| 
      
 2052 
     | 
    
         
            +
              generateId: () => generateId,
         
     | 
| 
      
 2053 
     | 
    
         
            +
              useSmooth: () => useSmooth,
         
     | 
| 
      
 2054 
     | 
    
         
            +
              useSmoothStatus: () => useSmoothStatus,
         
     | 
| 
      
 2055 
     | 
    
         
            +
              withSmoothContextProvider: () => withSmoothContextProvider
         
     | 
| 
      
 2056 
     | 
    
         
            +
            });
         
     | 
| 
      
 2057 
     | 
    
         
            +
             
     | 
| 
      
 2058 
     | 
    
         
            +
            // src/utils/idUtils.tsx
         
     | 
| 
      
 2059 
     | 
    
         
            +
            import { customAlphabet } from "nanoid/non-secure";
         
     | 
| 
      
 2060 
     | 
    
         
            +
            var generateId = customAlphabet(
         
     | 
| 
      
 2061 
     | 
    
         
            +
              "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
         
     | 
| 
      
 2062 
     | 
    
         
            +
              7
         
     | 
| 
      
 2063 
     | 
    
         
            +
            );
         
     | 
| 
      
 2064 
     | 
    
         
            +
            var optimisticPrefix = "__optimistic__";
         
     | 
| 
      
 2065 
     | 
    
         
            +
            var generateOptimisticId = () => `${optimisticPrefix}${generateId()}`;
         
     | 
| 
      
 2066 
     | 
    
         
            +
             
     | 
| 
      
 2067 
     | 
    
         
            +
            // src/runtimes/edge/converters/fromCoreMessage.ts
         
     | 
| 
      
 2068 
     | 
    
         
            +
            var fromCoreMessages = (message) => {
         
     | 
| 
      
 2069 
     | 
    
         
            +
              return message.map((message2) => fromCoreMessage(message2));
         
     | 
| 
      
 2070 
     | 
    
         
            +
            };
         
     | 
| 
      
 2071 
     | 
    
         
            +
            var fromCoreMessage = (message, {
         
     | 
| 
      
 2072 
     | 
    
         
            +
              id = generateId(),
         
     | 
| 
      
 2073 
     | 
    
         
            +
              status = { type: "complete", reason: "unknown" }
         
     | 
| 
      
 2074 
     | 
    
         
            +
            } = {}) => {
         
     | 
| 
      
 2075 
     | 
    
         
            +
              const commonProps = {
         
     | 
| 
      
 2076 
     | 
    
         
            +
                id,
         
     | 
| 
      
 2077 
     | 
    
         
            +
                createdAt: /* @__PURE__ */ new Date()
         
     | 
| 
      
 2078 
     | 
    
         
            +
              };
         
     | 
| 
      
 2079 
     | 
    
         
            +
              const role = message.role;
         
     | 
| 
      
 2080 
     | 
    
         
            +
              switch (role) {
         
     | 
| 
      
 2081 
     | 
    
         
            +
                case "assistant":
         
     | 
| 
      
 2082 
     | 
    
         
            +
                  return {
         
     | 
| 
      
 2083 
     | 
    
         
            +
                    ...commonProps,
         
     | 
| 
      
 2084 
     | 
    
         
            +
                    role,
         
     | 
| 
      
 2085 
     | 
    
         
            +
                    content: message.content.map((part) => {
         
     | 
| 
      
 2086 
     | 
    
         
            +
                      if (part.type === "tool-call") {
         
     | 
| 
      
 2087 
     | 
    
         
            +
                        return {
         
     | 
| 
      
 2088 
     | 
    
         
            +
                          ...part,
         
     | 
| 
      
 2089 
     | 
    
         
            +
                          argsText: JSON.stringify(part.args)
         
     | 
| 
      
 2090 
     | 
    
         
            +
                        };
         
     | 
| 
      
 2091 
     | 
    
         
            +
                      }
         
     | 
| 
      
 2092 
     | 
    
         
            +
                      return part;
         
     | 
| 
      
 2093 
     | 
    
         
            +
                    }),
         
     | 
| 
      
 2094 
     | 
    
         
            +
                    status
         
     | 
| 
      
 2095 
     | 
    
         
            +
                  };
         
     | 
| 
      
 2096 
     | 
    
         
            +
                case "user":
         
     | 
| 
      
 2097 
     | 
    
         
            +
                  return {
         
     | 
| 
      
 2098 
     | 
    
         
            +
                    ...commonProps,
         
     | 
| 
      
 2099 
     | 
    
         
            +
                    role,
         
     | 
| 
      
 2100 
     | 
    
         
            +
                    content: message.content
         
     | 
| 
      
 2101 
     | 
    
         
            +
                  };
         
     | 
| 
      
 2102 
     | 
    
         
            +
                case "system":
         
     | 
| 
      
 2103 
     | 
    
         
            +
                  return {
         
     | 
| 
      
 2104 
     | 
    
         
            +
                    ...commonProps,
         
     | 
| 
      
 2105 
     | 
    
         
            +
                    role,
         
     | 
| 
      
 2106 
     | 
    
         
            +
                    content: message.content
         
     | 
| 
      
 2107 
     | 
    
         
            +
                  };
         
     | 
| 
      
 2108 
     | 
    
         
            +
                default: {
         
     | 
| 
      
 2109 
     | 
    
         
            +
                  const unsupportedRole = role;
         
     | 
| 
      
 2110 
     | 
    
         
            +
                  throw new Error(`Unknown message role: ${unsupportedRole}`);
         
     | 
| 
      
 2111 
     | 
    
         
            +
                }
         
     | 
| 
      
 2112 
     | 
    
         
            +
              }
         
     | 
| 
      
 2113 
     | 
    
         
            +
            };
         
     | 
| 
      
 2114 
     | 
    
         
            +
             
     | 
| 
      
 2115 
     | 
    
         
            +
            // src/runtimes/utils/MessageRepository.tsx
         
     | 
| 
      
 2116 
     | 
    
         
            +
            var findHead = (message) => {
         
     | 
| 
      
 2117 
     | 
    
         
            +
              if (message.next) return findHead(message.next);
         
     | 
| 
      
 2118 
     | 
    
         
            +
              return message;
         
     | 
| 
      
 2119 
     | 
    
         
            +
            };
         
     | 
| 
      
 2120 
     | 
    
         
            +
            var MessageRepository = class {
         
     | 
| 
      
 2121 
     | 
    
         
            +
              messages = /* @__PURE__ */ new Map();
         
     | 
| 
      
 2122 
     | 
    
         
            +
              // message_id -> item
         
     | 
| 
      
 2123 
     | 
    
         
            +
              head = null;
         
     | 
| 
      
 2124 
     | 
    
         
            +
              root = {
         
     | 
| 
      
 2125 
     | 
    
         
            +
                children: []
         
     | 
| 
      
 2126 
     | 
    
         
            +
              };
         
     | 
| 
      
 2127 
     | 
    
         
            +
              performOp(newParent, child, operation) {
         
     | 
| 
      
 2128 
     | 
    
         
            +
                const parentOrRoot = child.prev ?? this.root;
         
     | 
| 
      
 2129 
     | 
    
         
            +
                const newParentOrRoot = newParent ?? this.root;
         
     | 
| 
      
 2130 
     | 
    
         
            +
                if (operation === "relink" && parentOrRoot === newParentOrRoot) return;
         
     | 
| 
      
 2131 
     | 
    
         
            +
                if (operation !== "link") {
         
     | 
| 
      
 2132 
     | 
    
         
            +
                  parentOrRoot.children = parentOrRoot.children.filter(
         
     | 
| 
      
 2133 
     | 
    
         
            +
                    (m) => m !== child.current.id
         
     | 
| 
      
 2134 
     | 
    
         
            +
                  );
         
     | 
| 
      
 2135 
     | 
    
         
            +
                  if (child.prev?.next === child) {
         
     | 
| 
      
 2136 
     | 
    
         
            +
                    const fallbackId = child.prev.children.at(-1);
         
     | 
| 
      
 2137 
     | 
    
         
            +
                    const fallback = fallbackId ? this.messages.get(fallbackId) : null;
         
     | 
| 
      
 2138 
     | 
    
         
            +
                    if (fallback === void 0) {
         
     | 
| 
      
 2139 
     | 
    
         
            +
                      throw new Error(
         
     | 
| 
      
 2140 
     | 
    
         
            +
                        "MessageRepository(performOp/cut): Fallback sibling message not found. This is likely an internal bug in assistant-ui."
         
     | 
| 
      
 2141 
     | 
    
         
            +
                      );
         
     | 
| 
      
 2142 
     | 
    
         
            +
                    }
         
     | 
| 
      
 2143 
     | 
    
         
            +
                    child.prev.next = fallback;
         
     | 
| 
      
 2144 
     | 
    
         
            +
                  }
         
     | 
| 
      
 2145 
     | 
    
         
            +
                }
         
     | 
| 
      
 2146 
     | 
    
         
            +
                if (operation !== "cut") {
         
     | 
| 
      
 2147 
     | 
    
         
            +
                  newParentOrRoot.children = [
         
     | 
| 
      
 2148 
     | 
    
         
            +
                    ...newParentOrRoot.children,
         
     | 
| 
      
 2149 
     | 
    
         
            +
                    child.current.id
         
     | 
| 
      
 2150 
     | 
    
         
            +
                  ];
         
     | 
| 
      
 2151 
     | 
    
         
            +
                  if (newParent && (findHead(child) === this.head || newParent.next === null)) {
         
     | 
| 
      
 2152 
     | 
    
         
            +
                    newParent.next = child;
         
     | 
| 
      
 2153 
     | 
    
         
            +
                  }
         
     | 
| 
      
 2154 
     | 
    
         
            +
                  child.prev = newParent;
         
     | 
| 
      
 2155 
     | 
    
         
            +
                }
         
     | 
| 
      
 2156 
     | 
    
         
            +
              }
         
     | 
| 
      
 2157 
     | 
    
         
            +
              getMessages() {
         
     | 
| 
      
 2158 
     | 
    
         
            +
                const messages = new Array(this.head?.level ?? 0);
         
     | 
| 
      
 2159 
     | 
    
         
            +
                for (let current = this.head; current; current = current.prev) {
         
     | 
| 
      
 2160 
     | 
    
         
            +
                  messages[current.level] = current.current;
         
     | 
| 
      
 2161 
     | 
    
         
            +
                }
         
     | 
| 
      
 2162 
     | 
    
         
            +
                return messages;
         
     | 
| 
      
 2163 
     | 
    
         
            +
              }
         
     | 
| 
      
 2164 
     | 
    
         
            +
              addOrUpdateMessage(parentId, message) {
         
     | 
| 
      
 2165 
     | 
    
         
            +
                const existingItem = this.messages.get(message.id);
         
     | 
| 
      
 2166 
     | 
    
         
            +
                const prev = parentId ? this.messages.get(parentId) : null;
         
     | 
| 
      
 2167 
     | 
    
         
            +
                if (prev === void 0)
         
     | 
| 
      
 2168 
     | 
    
         
            +
                  throw new Error(
         
     | 
| 
      
 2169 
     | 
    
         
            +
                    "MessageRepository(addOrUpdateMessage): Parent message not found. This is likely an internal bug in assistant-ui."
         
     | 
| 
      
 2170 
     | 
    
         
            +
                  );
         
     | 
| 
      
 2171 
     | 
    
         
            +
                if (existingItem) {
         
     | 
| 
      
 2172 
     | 
    
         
            +
                  existingItem.current = message;
         
     | 
| 
      
 2173 
     | 
    
         
            +
                  this.performOp(prev, existingItem, "relink");
         
     | 
| 
      
 2174 
     | 
    
         
            +
                  return;
         
     | 
| 
      
 2175 
     | 
    
         
            +
                }
         
     | 
| 
      
 2176 
     | 
    
         
            +
                const newItem = {
         
     | 
| 
      
 2177 
     | 
    
         
            +
                  prev,
         
     | 
| 
      
 2178 
     | 
    
         
            +
                  current: message,
         
     | 
| 
      
 2179 
     | 
    
         
            +
                  next: null,
         
     | 
| 
      
 2180 
     | 
    
         
            +
                  children: [],
         
     | 
| 
      
 2181 
     | 
    
         
            +
                  level: prev ? prev.level + 1 : 0
         
     | 
| 
      
 2182 
     | 
    
         
            +
                };
         
     | 
| 
      
 2183 
     | 
    
         
            +
                this.messages.set(message.id, newItem);
         
     | 
| 
      
 2184 
     | 
    
         
            +
                this.performOp(prev, newItem, "link");
         
     | 
| 
      
 2185 
     | 
    
         
            +
                if (this.head === prev) {
         
     | 
| 
      
 2186 
     | 
    
         
            +
                  this.head = newItem;
         
     | 
| 
      
 2187 
     | 
    
         
            +
                }
         
     | 
| 
      
 2188 
     | 
    
         
            +
              }
         
     | 
| 
      
 2189 
     | 
    
         
            +
              getMessage(messageId) {
         
     | 
| 
      
 2190 
     | 
    
         
            +
                const message = this.messages.get(messageId);
         
     | 
| 
      
 2191 
     | 
    
         
            +
                if (!message)
         
     | 
| 
      
 2192 
     | 
    
         
            +
                  throw new Error(
         
     | 
| 
      
 2193 
     | 
    
         
            +
                    "MessageRepository(updateMessage): Message not found. This is likely an internal bug in assistant-ui."
         
     | 
| 
      
 2194 
     | 
    
         
            +
                  );
         
     | 
| 
      
 2195 
     | 
    
         
            +
                return {
         
     | 
| 
      
 2196 
     | 
    
         
            +
                  parentId: message.prev?.current.id ?? null,
         
     | 
| 
      
 2197 
     | 
    
         
            +
                  message: message.current
         
     | 
| 
      
 2198 
     | 
    
         
            +
                };
         
     | 
| 
      
 2199 
     | 
    
         
            +
              }
         
     | 
| 
      
 2200 
     | 
    
         
            +
              appendOptimisticMessage(parentId, message) {
         
     | 
| 
      
 2201 
     | 
    
         
            +
                let optimisticId;
         
     | 
| 
      
 2202 
     | 
    
         
            +
                do {
         
     | 
| 
      
 2203 
     | 
    
         
            +
                  optimisticId = generateOptimisticId();
         
     | 
| 
      
 2204 
     | 
    
         
            +
                } while (this.messages.has(optimisticId));
         
     | 
| 
      
 2205 
     | 
    
         
            +
                this.addOrUpdateMessage(
         
     | 
| 
      
 2206 
     | 
    
         
            +
                  parentId,
         
     | 
| 
      
 2207 
     | 
    
         
            +
                  fromCoreMessage(message, {
         
     | 
| 
      
 2208 
     | 
    
         
            +
                    id: optimisticId,
         
     | 
| 
      
 2209 
     | 
    
         
            +
                    status: { type: "running" }
         
     | 
| 
      
 2210 
     | 
    
         
            +
                  })
         
     | 
| 
      
 2211 
     | 
    
         
            +
                );
         
     | 
| 
      
 2212 
     | 
    
         
            +
                return optimisticId;
         
     | 
| 
      
 2213 
     | 
    
         
            +
              }
         
     | 
| 
      
 2214 
     | 
    
         
            +
              deleteMessage(messageId, replacementId) {
         
     | 
| 
      
 2215 
     | 
    
         
            +
                const message = this.messages.get(messageId);
         
     | 
| 
      
 2216 
     | 
    
         
            +
                if (!message)
         
     | 
| 
      
 2217 
     | 
    
         
            +
                  throw new Error(
         
     | 
| 
      
 2218 
     | 
    
         
            +
                    "MessageRepository(deleteMessage): Optimistic message not found. This is likely an internal bug in assistant-ui."
         
     | 
| 
      
 2219 
     | 
    
         
            +
                  );
         
     | 
| 
      
 2220 
     | 
    
         
            +
                const replacement = replacementId === void 0 ? message.prev : replacementId === null ? null : this.messages.get(replacementId);
         
     | 
| 
      
 2221 
     | 
    
         
            +
                if (replacement === void 0)
         
     | 
| 
      
 2222 
     | 
    
         
            +
                  throw new Error(
         
     | 
| 
      
 2223 
     | 
    
         
            +
                    "MessageRepository(deleteMessage): Replacement not found. This is likely an internal bug in assistant-ui."
         
     | 
| 
      
 2224 
     | 
    
         
            +
                  );
         
     | 
| 
      
 2225 
     | 
    
         
            +
                for (const child of message.children) {
         
     | 
| 
      
 2226 
     | 
    
         
            +
                  const childMessage = this.messages.get(child);
         
     | 
| 
      
 2227 
     | 
    
         
            +
                  if (!childMessage)
         
     | 
| 
      
 2228 
     | 
    
         
            +
                    throw new Error(
         
     | 
| 
      
 2229 
     | 
    
         
            +
                      "MessageRepository(deleteMessage): Child message not found. This is likely an internal bug in assistant-ui."
         
     | 
| 
      
 2230 
     | 
    
         
            +
                    );
         
     | 
| 
      
 2231 
     | 
    
         
            +
                  this.performOp(replacement, childMessage, "relink");
         
     | 
| 
      
 2232 
     | 
    
         
            +
                }
         
     | 
| 
      
 2233 
     | 
    
         
            +
                this.performOp(null, message, "cut");
         
     | 
| 
      
 2234 
     | 
    
         
            +
                this.messages.delete(messageId);
         
     | 
| 
      
 2235 
     | 
    
         
            +
                if (this.head === message) {
         
     | 
| 
      
 2236 
     | 
    
         
            +
                  this.head = replacement ? findHead(replacement) : null;
         
     | 
| 
      
 2237 
     | 
    
         
            +
                }
         
     | 
| 
      
 2238 
     | 
    
         
            +
              }
         
     | 
| 
      
 2239 
     | 
    
         
            +
              getBranches(messageId) {
         
     | 
| 
      
 2240 
     | 
    
         
            +
                const message = this.messages.get(messageId);
         
     | 
| 
      
 2241 
     | 
    
         
            +
                if (!message)
         
     | 
| 
      
 2242 
     | 
    
         
            +
                  throw new Error(
         
     | 
| 
      
 2243 
     | 
    
         
            +
                    "MessageRepository(getBranches): Message not found. This is likely an internal bug in assistant-ui."
         
     | 
| 
      
 2244 
     | 
    
         
            +
                  );
         
     | 
| 
      
 2245 
     | 
    
         
            +
                const { children } = message.prev ?? this.root;
         
     | 
| 
      
 2246 
     | 
    
         
            +
                return children;
         
     | 
| 
      
 2247 
     | 
    
         
            +
              }
         
     | 
| 
      
 2248 
     | 
    
         
            +
              switchToBranch(messageId) {
         
     | 
| 
      
 2249 
     | 
    
         
            +
                const message = this.messages.get(messageId);
         
     | 
| 
      
 2250 
     | 
    
         
            +
                if (!message)
         
     | 
| 
      
 2251 
     | 
    
         
            +
                  throw new Error(
         
     | 
| 
      
 2252 
     | 
    
         
            +
                    "MessageRepository(switchToBranch): Branch not found. This is likely an internal bug in assistant-ui."
         
     | 
| 
      
 2253 
     | 
    
         
            +
                  );
         
     | 
| 
      
 2254 
     | 
    
         
            +
                if (message.prev) {
         
     | 
| 
      
 2255 
     | 
    
         
            +
                  message.prev.next = message;
         
     | 
| 
      
 2256 
     | 
    
         
            +
                }
         
     | 
| 
      
 2257 
     | 
    
         
            +
                this.head = findHead(message);
         
     | 
| 
      
 2258 
     | 
    
         
            +
              }
         
     | 
| 
      
 2259 
     | 
    
         
            +
              resetHead(messageId) {
         
     | 
| 
      
 2260 
     | 
    
         
            +
                if (messageId === null) {
         
     | 
| 
      
 2261 
     | 
    
         
            +
                  this.head = null;
         
     | 
| 
      
 2262 
     | 
    
         
            +
                  return;
         
     | 
| 
      
 2263 
     | 
    
         
            +
                }
         
     | 
| 
      
 2264 
     | 
    
         
            +
                const message = this.messages.get(messageId);
         
     | 
| 
      
 2265 
     | 
    
         
            +
                if (!message)
         
     | 
| 
      
 2266 
     | 
    
         
            +
                  throw new Error(
         
     | 
| 
      
 2267 
     | 
    
         
            +
                    "MessageRepository(resetHead): Branch not found. This is likely an internal bug in assistant-ui."
         
     | 
| 
      
 2268 
     | 
    
         
            +
                  );
         
     | 
| 
      
 2269 
     | 
    
         
            +
                this.head = message;
         
     | 
| 
      
 2270 
     | 
    
         
            +
                for (let current = message; current; current = current.prev) {
         
     | 
| 
      
 2271 
     | 
    
         
            +
                  if (current.prev) {
         
     | 
| 
      
 2272 
     | 
    
         
            +
                    current.prev.next = current;
         
     | 
| 
      
 2273 
     | 
    
         
            +
                  }
         
     | 
| 
      
 2274 
     | 
    
         
            +
                }
         
     | 
| 
      
 2275 
     | 
    
         
            +
              }
         
     | 
| 
      
 2276 
     | 
    
         
            +
              export() {
         
     | 
| 
      
 2277 
     | 
    
         
            +
                const exportItems = [];
         
     | 
| 
      
 2278 
     | 
    
         
            +
                for (const [, message] of this.messages) {
         
     | 
| 
      
 2279 
     | 
    
         
            +
                  exportItems.push({
         
     | 
| 
      
 2280 
     | 
    
         
            +
                    message: message.current,
         
     | 
| 
      
 2281 
     | 
    
         
            +
                    parentId: message.prev?.current.id ?? null
         
     | 
| 
      
 2282 
     | 
    
         
            +
                  });
         
     | 
| 
      
 2283 
     | 
    
         
            +
                }
         
     | 
| 
      
 2284 
     | 
    
         
            +
                return {
         
     | 
| 
      
 2285 
     | 
    
         
            +
                  headId: this.head?.current.id ?? null,
         
     | 
| 
      
 2286 
     | 
    
         
            +
                  messages: exportItems
         
     | 
| 
      
 2287 
     | 
    
         
            +
                };
         
     | 
| 
      
 2288 
     | 
    
         
            +
              }
         
     | 
| 
      
 2289 
     | 
    
         
            +
              import({ headId, messages }) {
         
     | 
| 
      
 2290 
     | 
    
         
            +
                for (const { message, parentId } of messages) {
         
     | 
| 
      
 2291 
     | 
    
         
            +
                  this.addOrUpdateMessage(parentId, message);
         
     | 
| 
      
 2292 
     | 
    
         
            +
                }
         
     | 
| 
      
 2293 
     | 
    
         
            +
                this.resetHead(headId ?? messages.at(-1)?.message.id ?? null);
         
     | 
| 
      
 2294 
     | 
    
         
            +
              }
         
     | 
| 
      
 2295 
     | 
    
         
            +
            };
         
     | 
| 
      
 2296 
     | 
    
         
            +
             
     | 
| 
      
 2297 
     | 
    
         
            +
            // src/ui/base/tooltip-icon-button.tsx
         
     | 
| 
      
 2298 
     | 
    
         
            +
            import { forwardRef as forwardRef18 } from "react";
         
     | 
| 
      
 2299 
     | 
    
         
            +
             
     | 
| 
      
 2300 
     | 
    
         
            +
            // src/ui/base/tooltip.tsx
         
     | 
| 
      
 2301 
     | 
    
         
            +
            import * as TooltipPrimitive from "@radix-ui/react-tooltip";
         
     | 
| 
      
 2302 
     | 
    
         
            +
             
     | 
| 
      
 2303 
     | 
    
         
            +
            // src/ui/utils/withDefaults.tsx
         
     | 
| 
      
 2304 
     | 
    
         
            +
            import {
         
     | 
| 
      
 2305 
     | 
    
         
            +
              forwardRef as forwardRef16
         
     | 
| 
      
 2306 
     | 
    
         
            +
            } from "react";
         
     | 
| 
      
 2307 
     | 
    
         
            +
            import classNames from "classnames";
         
     | 
| 
      
 2308 
     | 
    
         
            +
            import { jsx as jsx26 } from "react/jsx-runtime";
         
     | 
| 
      
 2309 
     | 
    
         
            +
            var withDefaultProps = ({
         
     | 
| 
      
 2310 
     | 
    
         
            +
              className,
         
     | 
| 
      
 2311 
     | 
    
         
            +
              ...defaultProps
         
     | 
| 
      
 2312 
     | 
    
         
            +
            }) => ({ className: classNameProp, ...props }) => {
         
     | 
| 
      
 2313 
     | 
    
         
            +
              return {
         
     | 
| 
      
 2314 
     | 
    
         
            +
                className: classNames(className, classNameProp),
         
     | 
| 
      
 2315 
     | 
    
         
            +
                ...defaultProps,
         
     | 
| 
      
 2316 
     | 
    
         
            +
                ...props
         
     | 
| 
      
 2317 
     | 
    
         
            +
              };
         
     | 
| 
      
 2318 
     | 
    
         
            +
            };
         
     | 
| 
      
 2319 
     | 
    
         
            +
            var withDefaults = (Component, defaultProps) => {
         
     | 
| 
      
 2320 
     | 
    
         
            +
              const getProps = withDefaultProps(defaultProps);
         
     | 
| 
      
 2321 
     | 
    
         
            +
              const WithDefaults = forwardRef16(
         
     | 
| 
      
 2322 
     | 
    
         
            +
                (props, ref) => {
         
     | 
| 
      
 2323 
     | 
    
         
            +
                  const ComponentAsAny = Component;
         
     | 
| 
      
 2324 
     | 
    
         
            +
                  return /* @__PURE__ */ jsx26(ComponentAsAny, { ...getProps(props), ref });
         
     | 
| 
      
 2325 
     | 
    
         
            +
                }
         
     | 
| 
      
 2326 
     | 
    
         
            +
              );
         
     | 
| 
      
 2327 
     | 
    
         
            +
              WithDefaults.displayName = "withDefaults(" + (typeof Component === "string" ? Component : Component.displayName) + ")";
         
     | 
| 
      
 2328 
     | 
    
         
            +
              return WithDefaults;
         
     | 
| 
      
 2329 
     | 
    
         
            +
            };
         
     | 
| 
      
 2330 
     | 
    
         
            +
             
     | 
| 
      
 2331 
     | 
    
         
            +
            // src/ui/base/tooltip.tsx
         
     | 
| 
      
 2332 
     | 
    
         
            +
            import { jsx as jsx27 } from "react/jsx-runtime";
         
     | 
| 
      
 2333 
     | 
    
         
            +
            var Tooltip = (props) => {
         
     | 
| 
      
 2334 
     | 
    
         
            +
              return /* @__PURE__ */ jsx27(TooltipPrimitive.Provider, { children: /* @__PURE__ */ jsx27(TooltipPrimitive.Root, { ...props }) });
         
     | 
| 
      
 2335 
     | 
    
         
            +
            };
         
     | 
| 
      
 2336 
     | 
    
         
            +
            Tooltip.displayName = "Tooltip";
         
     | 
| 
      
 2337 
     | 
    
         
            +
            var TooltipTrigger = TooltipPrimitive.Trigger;
         
     | 
| 
      
 2338 
     | 
    
         
            +
            var TooltipContent = withDefaults(TooltipPrimitive.Content, {
         
     | 
| 
      
 2339 
     | 
    
         
            +
              sideOffset: 4,
         
     | 
| 
      
 2340 
     | 
    
         
            +
              className: "aui-tooltip-content"
         
     | 
| 
      
 2341 
     | 
    
         
            +
            });
         
     | 
| 
      
 2342 
     | 
    
         
            +
            TooltipContent.displayName = "TooltipContent";
         
     | 
| 
      
 2343 
     | 
    
         
            +
             
     | 
| 
      
 2344 
     | 
    
         
            +
            // src/ui/base/button.tsx
         
     | 
| 
      
 2345 
     | 
    
         
            +
            import { cva } from "class-variance-authority";
         
     | 
| 
      
 2346 
     | 
    
         
            +
            import { Primitive as Primitive10 } from "@radix-ui/react-primitive";
         
     | 
| 
      
 2347 
     | 
    
         
            +
            import { forwardRef as forwardRef17 } from "react";
         
     | 
| 
      
 2348 
     | 
    
         
            +
            import { jsx as jsx28 } from "react/jsx-runtime";
         
     | 
| 
      
 2349 
     | 
    
         
            +
            var buttonVariants = cva("aui-button", {
         
     | 
| 
      
 2350 
     | 
    
         
            +
              variants: {
         
     | 
| 
      
 2351 
     | 
    
         
            +
                variant: {
         
     | 
| 
      
 2352 
     | 
    
         
            +
                  default: "aui-button-primary",
         
     | 
| 
      
 2353 
     | 
    
         
            +
                  outline: "aui-button-outline",
         
     | 
| 
      
 2354 
     | 
    
         
            +
                  ghost: "aui-button-ghost"
         
     | 
| 
      
 2355 
     | 
    
         
            +
                },
         
     | 
| 
      
 2356 
     | 
    
         
            +
                size: {
         
     | 
| 
      
 2357 
     | 
    
         
            +
                  default: "aui-button-medium",
         
     | 
| 
      
 2358 
     | 
    
         
            +
                  icon: "aui-button-icon"
         
     | 
| 
      
 2359 
     | 
    
         
            +
                }
         
     | 
| 
      
 2360 
     | 
    
         
            +
              },
         
     | 
| 
      
 2361 
     | 
    
         
            +
              defaultVariants: {
         
     | 
| 
      
 2362 
     | 
    
         
            +
                variant: "default",
         
     | 
| 
      
 2363 
     | 
    
         
            +
                size: "default"
         
     | 
| 
      
 2364 
     | 
    
         
            +
              }
         
     | 
| 
      
 2365 
     | 
    
         
            +
            });
         
     | 
| 
      
 2366 
     | 
    
         
            +
            var Button = forwardRef17(
         
     | 
| 
      
 2367 
     | 
    
         
            +
              ({ className, variant, size, ...props }, ref) => {
         
     | 
| 
      
 2368 
     | 
    
         
            +
                return /* @__PURE__ */ jsx28(
         
     | 
| 
      
 2369 
     | 
    
         
            +
                  Primitive10.button,
         
     | 
| 
      
 2370 
     | 
    
         
            +
                  {
         
     | 
| 
      
 2371 
     | 
    
         
            +
                    className: buttonVariants({ variant, size, className }),
         
     | 
| 
      
 2372 
     | 
    
         
            +
                    ...props,
         
     | 
| 
      
 2373 
     | 
    
         
            +
                    ref
         
     | 
| 
      
 2374 
     | 
    
         
            +
                  }
         
     | 
| 
      
 2375 
     | 
    
         
            +
                );
         
     | 
| 
      
 2376 
     | 
    
         
            +
              }
         
     | 
| 
      
 2377 
     | 
    
         
            +
            );
         
     | 
| 
      
 2378 
     | 
    
         
            +
            Button.displayName = "Button";
         
     | 
| 
      
 2379 
     | 
    
         
            +
             
     | 
| 
      
 2380 
     | 
    
         
            +
            // src/ui/base/tooltip-icon-button.tsx
         
     | 
| 
      
 2381 
     | 
    
         
            +
            import { jsx as jsx29, jsxs as jsxs4 } from "react/jsx-runtime";
         
     | 
| 
      
 2382 
     | 
    
         
            +
            var TooltipIconButton = forwardRef18(({ children, tooltip, side = "bottom", ...rest }, ref) => {
         
     | 
| 
      
 2383 
     | 
    
         
            +
              return /* @__PURE__ */ jsxs4(Tooltip, { children: [
         
     | 
| 
      
 2384 
     | 
    
         
            +
                /* @__PURE__ */ jsx29(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs4(Button, { variant: "ghost", size: "icon", ...rest, ref, children: [
         
     | 
| 
      
 2385 
     | 
    
         
            +
                  children,
         
     | 
| 
      
 2386 
     | 
    
         
            +
                  /* @__PURE__ */ jsx29("span", { className: "aui-sr-only", children: tooltip })
         
     | 
| 
      
 2387 
     | 
    
         
            +
                ] }) }),
         
     | 
| 
      
 2388 
     | 
    
         
            +
                /* @__PURE__ */ jsx29(TooltipContent, { side, children: tooltip })
         
     | 
| 
      
 2389 
     | 
    
         
            +
              ] });
         
     | 
| 
      
 2390 
     | 
    
         
            +
            });
         
     | 
| 
      
 2391 
     | 
    
         
            +
            TooltipIconButton.displayName = "TooltipIconButton";
         
     | 
| 
       1818 
2392 
     | 
    
         | 
| 
       1819 
2393 
     | 
    
         
             
            // src/runtimes/edge/converters/fromLanguageModelMessages.ts
         
     | 
| 
       1820 
2394 
     | 
    
         
             
            var fromLanguageModelMessages = (lm, { mergeRoundtrips }) => {
         
     | 
| 
         @@ -1934,7 +2508,7 @@ var fromLanguageModelTools = (tools) => { 
     | 
|
| 
       1934 
2508 
     | 
    
         
             
            };
         
     | 
| 
       1935 
2509 
     | 
    
         | 
| 
       1936 
2510 
     | 
    
         
             
            // src/runtimes/edge/useEdgeRuntime.ts
         
     | 
| 
       1937 
     | 
    
         
            -
            import { useState as  
     | 
| 
      
 2511 
     | 
    
         
            +
            import { useState as useState8 } from "react";
         
     | 
| 
       1938 
2512 
     | 
    
         | 
| 
       1939 
2513 
     | 
    
         
             
            // src/runtimes/edge/streams/assistantDecoderStream.ts
         
     | 
| 
       1940 
2514 
     | 
    
         
             
            function assistantDecoderStream() {
         
     | 
| 
         @@ -2091,7 +2665,7 @@ var useEdgeRuntime = ({ 
     | 
|
| 
       2091 
2665 
     | 
    
         
             
              initialMessages,
         
     | 
| 
       2092 
2666 
     | 
    
         
             
              ...options
         
     | 
| 
       2093 
2667 
     | 
    
         
             
            }) => {
         
     | 
| 
       2094 
     | 
    
         
            -
              const [adapter] =  
     | 
| 
      
 2668 
     | 
    
         
            +
              const [adapter] = useState8(() => new EdgeChatAdapter(options));
         
     | 
| 
       2095 
2669 
     | 
    
         
             
              return useLocalRuntime(adapter, { initialMessages });
         
     | 
| 
       2096 
2670 
     | 
    
         
             
            };
         
     | 
| 
       2097 
2671 
     | 
    
         | 
| 
         @@ -2276,6 +2850,13 @@ var LocalThreadRuntime = class { 
     | 
|
| 
       2276 
2850 
     | 
    
         
             
                  this.performRoundtrip(parentId, message);
         
     | 
| 
       2277 
2851 
     | 
    
         
             
                }
         
     | 
| 
       2278 
2852 
     | 
    
         
             
              }
         
     | 
| 
      
 2853 
     | 
    
         
            +
              export() {
         
     | 
| 
      
 2854 
     | 
    
         
            +
                return this.repository.export();
         
     | 
| 
      
 2855 
     | 
    
         
            +
              }
         
     | 
| 
      
 2856 
     | 
    
         
            +
              import(data) {
         
     | 
| 
      
 2857 
     | 
    
         
            +
                this.repository.import(data);
         
     | 
| 
      
 2858 
     | 
    
         
            +
                this.notifySubscribers();
         
     | 
| 
      
 2859 
     | 
    
         
            +
              }
         
     | 
| 
       2279 
2860 
     | 
    
         
             
            };
         
     | 
| 
       2280 
2861 
     | 
    
         | 
| 
       2281 
2862 
     | 
    
         
             
            // src/runtimes/local/LocalRuntime.tsx
         
     | 
| 
         @@ -2305,7 +2886,7 @@ var LocalRuntime = class extends BaseAssistantRuntime { 
     | 
|
| 
       2305 
2886 
     | 
    
         | 
| 
       2306 
2887 
     | 
    
         
             
            // src/runtimes/local/useLocalRuntime.tsx
         
     | 
| 
       2307 
2888 
     | 
    
         
             
            var useLocalRuntime = (adapter, options) => {
         
     | 
| 
       2308 
     | 
    
         
            -
              const [runtime] =  
     | 
| 
      
 2889 
     | 
    
         
            +
              const [runtime] = useState9(() => new LocalRuntime(adapter, options));
         
     | 
| 
       2309 
2890 
     | 
    
         
             
              useInsertionEffect3(() => {
         
     | 
| 
       2310 
2891 
     | 
    
         
             
                runtime.adapter = adapter;
         
     | 
| 
       2311 
2892 
     | 
    
         
             
              });
         
     | 
| 
         @@ -2313,7 +2894,7 @@ var useLocalRuntime = (adapter, options) => { 
     | 
|
| 
       2313 
2894 
     | 
    
         
             
            };
         
     | 
| 
       2314 
2895 
     | 
    
         | 
| 
       2315 
2896 
     | 
    
         
             
            // src/runtimes/external-store/ExternalStoreThreadRuntime.tsx
         
     | 
| 
       2316 
     | 
    
         
            -
            import { create as  
     | 
| 
      
 2897 
     | 
    
         
            +
            import { create as create15 } from "zustand";
         
     | 
| 
       2317 
2898 
     | 
    
         | 
| 
       2318 
2899 
     | 
    
         
             
            // src/runtimes/external-store/getExternalStoreMessage.tsx
         
     | 
| 
       2319 
2900 
     | 
    
         
             
            var symbolInnerMessage = Symbol("innerMessage");
         
     | 
| 
         @@ -2322,7 +2903,7 @@ var getExternalStoreMessage = (message) => { 
     | 
|
| 
       2322 
2903 
     | 
    
         
             
            };
         
     | 
| 
       2323 
2904 
     | 
    
         | 
| 
       2324 
2905 
     | 
    
         
             
            // src/runtimes/external-store/useExternalStoreSync.tsx
         
     | 
| 
       2325 
     | 
    
         
            -
            import { useEffect as  
     | 
| 
      
 2906 
     | 
    
         
            +
            import { useEffect as useEffect11, useInsertionEffect as useInsertionEffect4, useMemo as useMemo4, useRef as useRef6 } from "react";
         
     | 
| 
       2326 
2907 
     | 
    
         | 
| 
       2327 
2908 
     | 
    
         
             
            // src/runtimes/external-store/ThreadMessageConverter.ts
         
     | 
| 
       2328 
2909 
     | 
    
         
             
            var ThreadMessageConverter = class {
         
     | 
| 
         @@ -2416,11 +2997,11 @@ var fromThreadMessageLike = (like, fallbackId, fallbackStatus) => { 
     | 
|
| 
       2416 
2997 
     | 
    
         | 
| 
       2417 
2998 
     | 
    
         
             
            // src/runtimes/external-store/useExternalStoreSync.tsx
         
     | 
| 
       2418 
2999 
     | 
    
         
             
            var useExternalStoreSync = (adapter, updateData) => {
         
     | 
| 
       2419 
     | 
    
         
            -
              const adapterRef =  
     | 
| 
      
 3000 
     | 
    
         
            +
              const adapterRef = useRef6(adapter);
         
     | 
| 
       2420 
3001 
     | 
    
         
             
              useInsertionEffect4(() => {
         
     | 
| 
       2421 
3002 
     | 
    
         
             
                adapterRef.current = adapter;
         
     | 
| 
       2422 
3003 
     | 
    
         
             
              });
         
     | 
| 
       2423 
     | 
    
         
            -
              const [converter, convertCallback] =  
     | 
| 
      
 3004 
     | 
    
         
            +
              const [converter, convertCallback] = useMemo4(() => {
         
     | 
| 
       2424 
3005 
     | 
    
         
             
                const converter2 = adapter.convertMessage ?? ((m) => m);
         
     | 
| 
       2425 
3006 
     | 
    
         
             
                const convertCallback2 = (cache, m, idx) => {
         
     | 
| 
       2426 
3007 
     | 
    
         
             
                  const autoStatus = getAutoStatus(
         
     | 
| 
         @@ -2439,7 +3020,7 @@ var useExternalStoreSync = (adapter, updateData) => { 
     | 
|
| 
       2439 
3020 
     | 
    
         
             
                };
         
     | 
| 
       2440 
3021 
     | 
    
         
             
                return [new ThreadMessageConverter(), convertCallback2];
         
     | 
| 
       2441 
3022 
     | 
    
         
             
              }, [adapter.convertMessage]);
         
     | 
| 
       2442 
     | 
    
         
            -
               
     | 
| 
      
 3023 
     | 
    
         
            +
              useEffect11(() => {
         
     | 
| 
       2443 
3024 
     | 
    
         
             
                updateData(
         
     | 
| 
       2444 
3025 
     | 
    
         
             
                  adapter.isDisabled ?? false,
         
     | 
| 
       2445 
3026 
     | 
    
         
             
                  adapter.isRunning ?? false,
         
     | 
| 
         @@ -2467,7 +3048,7 @@ var ExternalStoreThreadRuntime = class { 
     | 
|
| 
       2467 
3048 
     | 
    
         
             
                  store.isRunning ?? false,
         
     | 
| 
       2468 
3049 
     | 
    
         
             
                  store.messages
         
     | 
| 
       2469 
3050 
     | 
    
         
             
                );
         
     | 
| 
       2470 
     | 
    
         
            -
                this.useStore =  
     | 
| 
      
 3051 
     | 
    
         
            +
                this.useStore = create15(() => ({
         
     | 
| 
       2471 
3052 
     | 
    
         
             
                  store
         
     | 
| 
       2472 
3053 
     | 
    
         
             
                }));
         
     | 
| 
       2473 
3054 
     | 
    
         
             
              }
         
     | 
| 
         @@ -2608,13 +3189,13 @@ var ExternalStoreRuntime = class extends BaseAssistantRuntime { 
     | 
|
| 
       2608 
3189 
     | 
    
         
             
            };
         
     | 
| 
       2609 
3190 
     | 
    
         | 
| 
       2610 
3191 
     | 
    
         
             
            // src/runtimes/external-store/useExternalStoreRuntime.tsx
         
     | 
| 
       2611 
     | 
    
         
            -
            import { useEffect as  
     | 
| 
      
 3192 
     | 
    
         
            +
            import { useEffect as useEffect12, useInsertionEffect as useInsertionEffect5, useState as useState10 } from "react";
         
     | 
| 
       2612 
3193 
     | 
    
         
             
            var useExternalStoreRuntime = (store) => {
         
     | 
| 
       2613 
     | 
    
         
            -
              const [runtime] =  
     | 
| 
      
 3194 
     | 
    
         
            +
              const [runtime] = useState10(() => new ExternalStoreRuntime(store));
         
     | 
| 
       2614 
3195 
     | 
    
         
             
              useInsertionEffect5(() => {
         
     | 
| 
       2615 
3196 
     | 
    
         
             
                runtime.store = store;
         
     | 
| 
       2616 
3197 
     | 
    
         
             
              });
         
     | 
| 
       2617 
     | 
    
         
            -
               
     | 
| 
      
 3198 
     | 
    
         
            +
              useEffect12(() => {
         
     | 
| 
       2618 
3199 
     | 
    
         
             
                runtime.onStoreUpdated();
         
     | 
| 
       2619 
3200 
     | 
    
         
             
              });
         
     | 
| 
       2620 
3201 
     | 
    
         
             
              return runtime;
         
     | 
| 
         @@ -2622,34 +3203,34 @@ var useExternalStoreRuntime = (store) => { 
     | 
|
| 
       2622 
3203 
     | 
    
         | 
| 
       2623 
3204 
     | 
    
         
             
            // src/ui/thread-config.tsx
         
     | 
| 
       2624 
3205 
     | 
    
         
             
            import {
         
     | 
| 
       2625 
     | 
    
         
            -
              createContext,
         
     | 
| 
       2626 
     | 
    
         
            -
              useContext
         
     | 
| 
      
 3206 
     | 
    
         
            +
              createContext as createContext6,
         
     | 
| 
      
 3207 
     | 
    
         
            +
              useContext as useContext6
         
     | 
| 
       2627 
3208 
     | 
    
         
             
            } from "react";
         
     | 
| 
       2628 
     | 
    
         
            -
            import { Fragment as Fragment3, jsx as  
     | 
| 
       2629 
     | 
    
         
            -
            var ThreadConfigContext =  
     | 
| 
      
 3209 
     | 
    
         
            +
            import { Fragment as Fragment3, jsx as jsx30 } from "react/jsx-runtime";
         
     | 
| 
      
 3210 
     | 
    
         
            +
            var ThreadConfigContext = createContext6({});
         
     | 
| 
       2630 
3211 
     | 
    
         
             
            var useThreadConfig = () => {
         
     | 
| 
       2631 
     | 
    
         
            -
              return  
     | 
| 
      
 3212 
     | 
    
         
            +
              return useContext6(ThreadConfigContext);
         
     | 
| 
       2632 
3213 
     | 
    
         
             
            };
         
     | 
| 
       2633 
3214 
     | 
    
         
             
            var ThreadConfigProvider = ({
         
     | 
| 
       2634 
3215 
     | 
    
         
             
              children,
         
     | 
| 
       2635 
3216 
     | 
    
         
             
              config
         
     | 
| 
       2636 
3217 
     | 
    
         
             
            }) => {
         
     | 
| 
       2637 
3218 
     | 
    
         
             
              const assistant = useAssistantContext({ optional: true });
         
     | 
| 
       2638 
     | 
    
         
            -
              const configProvider = config && Object.keys(config ?? {}).length > 0 ? /* @__PURE__ */  
     | 
| 
      
 3219 
     | 
    
         
            +
              const configProvider = config && Object.keys(config ?? {}).length > 0 ? /* @__PURE__ */ jsx30(ThreadConfigContext.Provider, { value: config, children }) : /* @__PURE__ */ jsx30(Fragment3, { children });
         
     | 
| 
       2639 
3220 
     | 
    
         
             
              if (!config?.runtime) return configProvider;
         
     | 
| 
       2640 
3221 
     | 
    
         
             
              if (assistant) {
         
     | 
| 
       2641 
3222 
     | 
    
         
             
                throw new Error(
         
     | 
| 
       2642 
3223 
     | 
    
         
             
                  "You provided a runtime to <Thread> while simulataneously using <AssistantRuntimeProvider>. This is not allowed."
         
     | 
| 
       2643 
3224 
     | 
    
         
             
                );
         
     | 
| 
       2644 
3225 
     | 
    
         
             
              }
         
     | 
| 
       2645 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 3226 
     | 
    
         
            +
              return /* @__PURE__ */ jsx30(AssistantRuntimeProvider, { runtime: config.runtime, children: configProvider });
         
     | 
| 
       2646 
3227 
     | 
    
         
             
            };
         
     | 
| 
       2647 
3228 
     | 
    
         
             
            ThreadConfigProvider.displayName = "ThreadConfigProvider";
         
     | 
| 
       2648 
3229 
     | 
    
         | 
| 
       2649 
3230 
     | 
    
         
             
            // src/ui/assistant-action-bar.tsx
         
     | 
| 
       2650 
     | 
    
         
            -
            import { forwardRef as  
     | 
| 
      
 3231 
     | 
    
         
            +
            import { forwardRef as forwardRef19 } from "react";
         
     | 
| 
       2651 
3232 
     | 
    
         
             
            import { CheckIcon, CopyIcon, RefreshCwIcon } from "lucide-react";
         
     | 
| 
       2652 
     | 
    
         
            -
            import { Fragment as Fragment4, jsx as  
     | 
| 
      
 3233 
     | 
    
         
            +
            import { Fragment as Fragment4, jsx as jsx31, jsxs as jsxs5 } from "react/jsx-runtime";
         
     | 
| 
       2653 
3234 
     | 
    
         
             
            var useAllowCopy = () => {
         
     | 
| 
       2654 
3235 
     | 
    
         
             
              const { assistantMessage: { allowCopy = true } = {} } = useThreadConfig();
         
     | 
| 
       2655 
3236 
     | 
    
         
             
              const { useThreadActions } = useThreadContext();
         
     | 
| 
         @@ -2666,15 +3247,15 @@ var AssistantActionBar = () => { 
     | 
|
| 
       2666 
3247 
     | 
    
         
             
              const allowCopy = useAllowCopy();
         
     | 
| 
       2667 
3248 
     | 
    
         
             
              const allowReload = useAllowReload();
         
     | 
| 
       2668 
3249 
     | 
    
         
             
              if (!allowCopy && !allowReload) return null;
         
     | 
| 
       2669 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 3250 
     | 
    
         
            +
              return /* @__PURE__ */ jsxs5(
         
     | 
| 
       2670 
3251 
     | 
    
         
             
                AssistantActionBarRoot,
         
     | 
| 
       2671 
3252 
     | 
    
         
             
                {
         
     | 
| 
       2672 
3253 
     | 
    
         
             
                  hideWhenRunning: true,
         
     | 
| 
       2673 
3254 
     | 
    
         
             
                  autohide: "not-last",
         
     | 
| 
       2674 
3255 
     | 
    
         
             
                  autohideFloat: "single-branch",
         
     | 
| 
       2675 
3256 
     | 
    
         
             
                  children: [
         
     | 
| 
       2676 
     | 
    
         
            -
                    /* @__PURE__ */  
     | 
| 
       2677 
     | 
    
         
            -
                    /* @__PURE__ */  
     | 
| 
      
 3257 
     | 
    
         
            +
                    /* @__PURE__ */ jsx31(AssistantActionBarCopy, {}),
         
     | 
| 
      
 3258 
     | 
    
         
            +
                    /* @__PURE__ */ jsx31(AssistantActionBarReload, {})
         
     | 
| 
       2678 
3259 
     | 
    
         
             
                  ]
         
     | 
| 
       2679 
3260 
     | 
    
         
             
                }
         
     | 
| 
       2680 
3261 
     | 
    
         
             
              );
         
     | 
| 
         @@ -2684,7 +3265,7 @@ var AssistantActionBarRoot = withDefaults(actionBar_exports.Root, { 
     | 
|
| 
       2684 
3265 
     | 
    
         
             
              className: "aui-assistant-action-bar-root"
         
     | 
| 
       2685 
3266 
     | 
    
         
             
            });
         
     | 
| 
       2686 
3267 
     | 
    
         
             
            AssistantActionBarRoot.displayName = "AssistantActionBarRoot";
         
     | 
| 
       2687 
     | 
    
         
            -
            var AssistantActionBarCopy =  
     | 
| 
      
 3268 
     | 
    
         
            +
            var AssistantActionBarCopy = forwardRef19((props, ref) => {
         
     | 
| 
       2688 
3269 
     | 
    
         
             
              const {
         
     | 
| 
       2689 
3270 
     | 
    
         
             
                strings: {
         
     | 
| 
       2690 
3271 
     | 
    
         
             
                  assistantMessage: { reload: { tooltip = "Copy" } = {} } = {}
         
     | 
| 
         @@ -2692,13 +3273,13 @@ var AssistantActionBarCopy = forwardRef15((props, ref) => { 
     | 
|
| 
       2692 
3273 
     | 
    
         
             
              } = useThreadConfig();
         
     | 
| 
       2693 
3274 
     | 
    
         
             
              const allowCopy = useAllowCopy();
         
     | 
| 
       2694 
3275 
     | 
    
         
             
              if (!allowCopy) return null;
         
     | 
| 
       2695 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
       2696 
     | 
    
         
            -
                /* @__PURE__ */  
     | 
| 
       2697 
     | 
    
         
            -
                /* @__PURE__ */  
     | 
| 
      
 3276 
     | 
    
         
            +
              return /* @__PURE__ */ jsx31(actionBar_exports.Copy, { asChild: true, children: /* @__PURE__ */ jsx31(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsxs5(Fragment4, { children: [
         
     | 
| 
      
 3277 
     | 
    
         
            +
                /* @__PURE__ */ jsx31(message_exports.If, { copied: true, children: /* @__PURE__ */ jsx31(CheckIcon, {}) }),
         
     | 
| 
      
 3278 
     | 
    
         
            +
                /* @__PURE__ */ jsx31(message_exports.If, { copied: false, children: /* @__PURE__ */ jsx31(CopyIcon, {}) })
         
     | 
| 
       2698 
3279 
     | 
    
         
             
              ] }) }) });
         
     | 
| 
       2699 
3280 
     | 
    
         
             
            });
         
     | 
| 
       2700 
3281 
     | 
    
         
             
            AssistantActionBarCopy.displayName = "AssistantActionBarCopy";
         
     | 
| 
       2701 
     | 
    
         
            -
            var AssistantActionBarReload =  
     | 
| 
      
 3282 
     | 
    
         
            +
            var AssistantActionBarReload = forwardRef19((props, ref) => {
         
     | 
| 
       2702 
3283 
     | 
    
         
             
              const {
         
     | 
| 
       2703 
3284 
     | 
    
         
             
                strings: {
         
     | 
| 
       2704 
3285 
     | 
    
         
             
                  assistantMessage: { reload: { tooltip = "Refresh" } = {} } = {}
         
     | 
| 
         @@ -2706,7 +3287,7 @@ var AssistantActionBarReload = forwardRef15((props, ref) => { 
     | 
|
| 
       2706 
3287 
     | 
    
         
             
              } = useThreadConfig();
         
     | 
| 
       2707 
3288 
     | 
    
         
             
              const allowReload = useAllowReload();
         
     | 
| 
       2708 
3289 
     | 
    
         
             
              if (!allowReload) return null;
         
     | 
| 
       2709 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 3290 
     | 
    
         
            +
              return /* @__PURE__ */ jsx31(actionBar_exports.Reload, { asChild: true, children: /* @__PURE__ */ jsx31(TooltipIconButton, { tooltip, ...props, ref, children: /* @__PURE__ */ jsx31(RefreshCwIcon, {}) }) });
         
     | 
| 
       2710 
3291 
     | 
    
         
             
            });
         
     | 
| 
       2711 
3292 
     | 
    
         
             
            AssistantActionBarReload.displayName = "AssistantActionBarReload";
         
     | 
| 
       2712 
3293 
     | 
    
         
             
            var exports = {
         
     | 
| 
         @@ -2720,12 +3301,12 @@ var assistant_action_bar_default = Object.assign( 
     | 
|
| 
       2720 
3301 
     | 
    
         
             
            );
         
     | 
| 
       2721 
3302 
     | 
    
         | 
| 
       2722 
3303 
     | 
    
         
             
            // src/ui/assistant-message.tsx
         
     | 
| 
       2723 
     | 
    
         
            -
            import { forwardRef as  
     | 
| 
      
 3304 
     | 
    
         
            +
            import { forwardRef as forwardRef21 } from "react";
         
     | 
| 
       2724 
3305 
     | 
    
         | 
| 
       2725 
3306 
     | 
    
         
             
            // src/ui/branch-picker.tsx
         
     | 
| 
       2726 
     | 
    
         
            -
            import { forwardRef as  
     | 
| 
      
 3307 
     | 
    
         
            +
            import { forwardRef as forwardRef20 } from "react";
         
     | 
| 
       2727 
3308 
     | 
    
         
             
            import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
         
     | 
| 
       2728 
     | 
    
         
            -
            import { jsx as  
     | 
| 
      
 3309 
     | 
    
         
            +
            import { jsx as jsx32, jsxs as jsxs6 } from "react/jsx-runtime";
         
     | 
| 
       2729 
3310 
     | 
    
         
             
            var useAllowBranchPicker = () => {
         
     | 
| 
       2730 
3311 
     | 
    
         
             
              const { branchPicker: { allowBranchPicker = true } = {} } = useThreadConfig();
         
     | 
| 
       2731 
3312 
     | 
    
         
             
              const { useThreadActions } = useThreadContext();
         
     | 
| 
         @@ -2735,10 +3316,10 @@ var useAllowBranchPicker = () => { 
     | 
|
| 
       2735 
3316 
     | 
    
         
             
            var BranchPicker = () => {
         
     | 
| 
       2736 
3317 
     | 
    
         
             
              const allowBranchPicker = useAllowBranchPicker();
         
     | 
| 
       2737 
3318 
     | 
    
         
             
              if (!allowBranchPicker) return null;
         
     | 
| 
       2738 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
       2739 
     | 
    
         
            -
                /* @__PURE__ */  
     | 
| 
       2740 
     | 
    
         
            -
                /* @__PURE__ */  
     | 
| 
       2741 
     | 
    
         
            -
                /* @__PURE__ */  
     | 
| 
      
 3319 
     | 
    
         
            +
              return /* @__PURE__ */ jsxs6(BranchPickerRoot, { hideWhenSingleBranch: true, children: [
         
     | 
| 
      
 3320 
     | 
    
         
            +
                /* @__PURE__ */ jsx32(BranchPickerPrevious2, {}),
         
     | 
| 
      
 3321 
     | 
    
         
            +
                /* @__PURE__ */ jsx32(BranchPickerState, {}),
         
     | 
| 
      
 3322 
     | 
    
         
            +
                /* @__PURE__ */ jsx32(BranchPickerNext, {})
         
     | 
| 
       2742 
3323 
     | 
    
         
             
              ] });
         
     | 
| 
       2743 
3324 
     | 
    
         
             
            };
         
     | 
| 
       2744 
3325 
     | 
    
         
             
            BranchPicker.displayName = "BranchPicker";
         
     | 
| 
         @@ -2746,31 +3327,31 @@ var BranchPickerRoot = withDefaults(branchPicker_exports.Root, { 
     | 
|
| 
       2746 
3327 
     | 
    
         
             
              className: "aui-branch-picker-root"
         
     | 
| 
       2747 
3328 
     | 
    
         
             
            });
         
     | 
| 
       2748 
3329 
     | 
    
         
             
            BranchPickerRoot.displayName = "BranchPickerRoot";
         
     | 
| 
       2749 
     | 
    
         
            -
            var BranchPickerPrevious2 =  
     | 
| 
      
 3330 
     | 
    
         
            +
            var BranchPickerPrevious2 = forwardRef20((props, ref) => {
         
     | 
| 
       2750 
3331 
     | 
    
         
             
              const {
         
     | 
| 
       2751 
3332 
     | 
    
         
             
                strings: {
         
     | 
| 
       2752 
3333 
     | 
    
         
             
                  branchPicker: { previous: { tooltip = "Previous" } = {} } = {}
         
     | 
| 
       2753 
3334 
     | 
    
         
             
                } = {}
         
     | 
| 
       2754 
3335 
     | 
    
         
             
              } = useThreadConfig();
         
     | 
| 
       2755 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 3336 
     | 
    
         
            +
              return /* @__PURE__ */ jsx32(branchPicker_exports.Previous, { asChild: true, children: /* @__PURE__ */ jsx32(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx32(ChevronLeftIcon, {}) }) });
         
     | 
| 
       2756 
3337 
     | 
    
         
             
            });
         
     | 
| 
       2757 
3338 
     | 
    
         
             
            BranchPickerPrevious2.displayName = "BranchPickerPrevious";
         
     | 
| 
       2758 
3339 
     | 
    
         
             
            var BranchPickerStateWrapper = withDefaults("span", {
         
     | 
| 
       2759 
3340 
     | 
    
         
             
              className: "aui-branch-picker-state"
         
     | 
| 
       2760 
3341 
     | 
    
         
             
            });
         
     | 
| 
       2761 
     | 
    
         
            -
            var BranchPickerState =  
     | 
| 
       2762 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
       2763 
     | 
    
         
            -
                /* @__PURE__ */  
     | 
| 
      
 3342 
     | 
    
         
            +
            var BranchPickerState = forwardRef20((props, ref) => {
         
     | 
| 
      
 3343 
     | 
    
         
            +
              return /* @__PURE__ */ jsxs6(BranchPickerStateWrapper, { ...props, ref, children: [
         
     | 
| 
      
 3344 
     | 
    
         
            +
                /* @__PURE__ */ jsx32(branchPicker_exports.Number, {}),
         
     | 
| 
       2764 
3345 
     | 
    
         
             
                " / ",
         
     | 
| 
       2765 
     | 
    
         
            -
                /* @__PURE__ */  
     | 
| 
      
 3346 
     | 
    
         
            +
                /* @__PURE__ */ jsx32(branchPicker_exports.Count, {})
         
     | 
| 
       2766 
3347 
     | 
    
         
             
              ] });
         
     | 
| 
       2767 
3348 
     | 
    
         
             
            });
         
     | 
| 
       2768 
3349 
     | 
    
         
             
            BranchPickerState.displayName = "BranchPickerState";
         
     | 
| 
       2769 
     | 
    
         
            -
            var BranchPickerNext =  
     | 
| 
      
 3350 
     | 
    
         
            +
            var BranchPickerNext = forwardRef20((props, ref) => {
         
     | 
| 
       2770 
3351 
     | 
    
         
             
              const {
         
     | 
| 
       2771 
3352 
     | 
    
         
             
                strings: { branchPicker: { next: { tooltip = "Next" } = {} } = {} } = {}
         
     | 
| 
       2772 
3353 
     | 
    
         
             
              } = useThreadConfig();
         
     | 
| 
       2773 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 3354 
     | 
    
         
            +
              return /* @__PURE__ */ jsx32(branchPicker_exports.Next, { asChild: true, children: /* @__PURE__ */ jsx32(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx32(ChevronRightIcon, {}) }) });
         
     | 
| 
       2774 
3355 
     | 
    
         
             
            });
         
     | 
| 
       2775 
3356 
     | 
    
         
             
            BranchPickerNext.displayName = "BranchPickerNext";
         
     | 
| 
       2776 
3357 
     | 
    
         
             
            var exports2 = {
         
     | 
| 
         @@ -2782,12 +3363,12 @@ var branch_picker_default = Object.assign(BranchPicker, exports2); 
     | 
|
| 
       2782 
3363 
     | 
    
         | 
| 
       2783 
3364 
     | 
    
         
             
            // src/ui/base/avatar.tsx
         
     | 
| 
       2784 
3365 
     | 
    
         
             
            import * as AvatarPrimitive from "@radix-ui/react-avatar";
         
     | 
| 
       2785 
     | 
    
         
            -
            import { jsx as  
     | 
| 
      
 3366 
     | 
    
         
            +
            import { jsx as jsx33, jsxs as jsxs7 } from "react/jsx-runtime";
         
     | 
| 
       2786 
3367 
     | 
    
         
             
            var Avatar = ({ src, alt, fallback }) => {
         
     | 
| 
       2787 
3368 
     | 
    
         
             
              if (src == null && fallback == null) return null;
         
     | 
| 
       2788 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
       2789 
     | 
    
         
            -
                src != null && /* @__PURE__ */  
     | 
| 
       2790 
     | 
    
         
            -
                fallback != null && /* @__PURE__ */  
     | 
| 
      
 3369 
     | 
    
         
            +
              return /* @__PURE__ */ jsxs7(AvatarRoot, { children: [
         
     | 
| 
      
 3370 
     | 
    
         
            +
                src != null && /* @__PURE__ */ jsx33(AvatarImage, { src, alt }),
         
     | 
| 
      
 3371 
     | 
    
         
            +
                fallback != null && /* @__PURE__ */ jsx33(AvatarFallback, { children: fallback })
         
     | 
| 
       2791 
3372 
     | 
    
         
             
              ] });
         
     | 
| 
       2792 
3373 
     | 
    
         
             
            };
         
     | 
| 
       2793 
3374 
     | 
    
         
             
            Avatar.displayName = "Avatar";
         
     | 
| 
         @@ -2805,14 +3386,14 @@ var AvatarFallback = withDefaults(AvatarPrimitive.Fallback, { 
     | 
|
| 
       2805 
3386 
     | 
    
         
             
            AvatarFallback.displayName = "AvatarFallback";
         
     | 
| 
       2806 
3387 
     | 
    
         | 
| 
       2807 
3388 
     | 
    
         
             
            // src/ui/content-part.tsx
         
     | 
| 
       2808 
     | 
    
         
            -
            import  
     | 
| 
       2809 
     | 
    
         
            -
            import { jsx as  
     | 
| 
      
 3389 
     | 
    
         
            +
            import classNames2 from "classnames";
         
     | 
| 
      
 3390 
     | 
    
         
            +
            import { jsx as jsx34 } from "react/jsx-runtime";
         
     | 
| 
       2810 
3391 
     | 
    
         
             
            var Text = () => {
         
     | 
| 
       2811 
3392 
     | 
    
         
             
              const status = useSmoothStatus();
         
     | 
| 
       2812 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 3393 
     | 
    
         
            +
              return /* @__PURE__ */ jsx34(
         
     | 
| 
       2813 
3394 
     | 
    
         
             
                contentPart_exports.Text,
         
     | 
| 
       2814 
3395 
     | 
    
         
             
                {
         
     | 
| 
       2815 
     | 
    
         
            -
                  className:  
     | 
| 
      
 3396 
     | 
    
         
            +
                  className: classNames2(
         
     | 
| 
       2816 
3397 
     | 
    
         
             
                    "aui-text",
         
     | 
| 
       2817 
3398 
     | 
    
         
             
                    status.type === "running" && "aui-text-running"
         
     | 
| 
       2818 
3399 
     | 
    
         
             
                  ),
         
     | 
| 
         @@ -2824,19 +3405,19 @@ var exports3 = { Text: withSmoothContextProvider(Text) }; 
     | 
|
| 
       2824 
3405 
     | 
    
         
             
            var content_part_default = exports3;
         
     | 
| 
       2825 
3406 
     | 
    
         | 
| 
       2826 
3407 
     | 
    
         
             
            // src/ui/assistant-message.tsx
         
     | 
| 
       2827 
     | 
    
         
            -
            import { jsx as  
     | 
| 
      
 3408 
     | 
    
         
            +
            import { jsx as jsx35, jsxs as jsxs8 } from "react/jsx-runtime";
         
     | 
| 
       2828 
3409 
     | 
    
         
             
            var AssistantMessage = () => {
         
     | 
| 
       2829 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
       2830 
     | 
    
         
            -
                /* @__PURE__ */  
     | 
| 
       2831 
     | 
    
         
            -
                /* @__PURE__ */  
     | 
| 
       2832 
     | 
    
         
            -
                /* @__PURE__ */  
     | 
| 
       2833 
     | 
    
         
            -
                /* @__PURE__ */  
     | 
| 
      
 3410 
     | 
    
         
            +
              return /* @__PURE__ */ jsxs8(AssistantMessageRoot, { children: [
         
     | 
| 
      
 3411 
     | 
    
         
            +
                /* @__PURE__ */ jsx35(AssistantMessageAvatar, {}),
         
     | 
| 
      
 3412 
     | 
    
         
            +
                /* @__PURE__ */ jsx35(AssistantMessageContent, {}),
         
     | 
| 
      
 3413 
     | 
    
         
            +
                /* @__PURE__ */ jsx35(branch_picker_default, {}),
         
     | 
| 
      
 3414 
     | 
    
         
            +
                /* @__PURE__ */ jsx35(assistant_action_bar_default, {})
         
     | 
| 
       2834 
3415 
     | 
    
         
             
              ] });
         
     | 
| 
       2835 
3416 
     | 
    
         
             
            };
         
     | 
| 
       2836 
3417 
     | 
    
         
             
            AssistantMessage.displayName = "AssistantMessage";
         
     | 
| 
       2837 
3418 
     | 
    
         
             
            var AssistantMessageAvatar = () => {
         
     | 
| 
       2838 
3419 
     | 
    
         
             
              const { assistantAvatar: avatar = { fallback: "A" } } = useThreadConfig();
         
     | 
| 
       2839 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 3420 
     | 
    
         
            +
              return /* @__PURE__ */ jsx35(Avatar, { ...avatar });
         
     | 
| 
       2840 
3421 
     | 
    
         
             
            };
         
     | 
| 
       2841 
3422 
     | 
    
         
             
            var AssistantMessageRoot = withDefaults(message_exports.Root, {
         
     | 
| 
       2842 
3423 
     | 
    
         
             
              className: "aui-assistant-message-root"
         
     | 
| 
         @@ -2845,9 +3426,9 @@ AssistantMessageRoot.displayName = "AssistantMessageRoot"; 
     | 
|
| 
       2845 
3426 
     | 
    
         
             
            var AssistantMessageContentWrapper = withDefaults("div", {
         
     | 
| 
       2846 
3427 
     | 
    
         
             
              className: "aui-assistant-message-content"
         
     | 
| 
       2847 
3428 
     | 
    
         
             
            });
         
     | 
| 
       2848 
     | 
    
         
            -
            var AssistantMessageContent =  
     | 
| 
      
 3429 
     | 
    
         
            +
            var AssistantMessageContent = forwardRef21(({ components: componentsProp, ...rest }, ref) => {
         
     | 
| 
       2849 
3430 
     | 
    
         
             
              const { assistantMessage: { components = {} } = {} } = useThreadConfig();
         
     | 
| 
       2850 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 3431 
     | 
    
         
            +
              return /* @__PURE__ */ jsx35(AssistantMessageContentWrapper, { ...rest, ref, children: /* @__PURE__ */ jsx35(
         
     | 
| 
       2851 
3432 
     | 
    
         
             
                message_exports.Content,
         
     | 
| 
       2852 
3433 
     | 
    
         
             
                {
         
     | 
| 
       2853 
3434 
     | 
    
         
             
                  components: {
         
     | 
| 
         @@ -2869,38 +3450,38 @@ var assistant_message_default = Object.assign( 
     | 
|
| 
       2869 
3450 
     | 
    
         
             
            );
         
     | 
| 
       2870 
3451 
     | 
    
         | 
| 
       2871 
3452 
     | 
    
         
             
            // src/ui/assistant-modal.tsx
         
     | 
| 
       2872 
     | 
    
         
            -
            import { forwardRef as  
     | 
| 
      
 3453 
     | 
    
         
            +
            import { forwardRef as forwardRef28 } from "react";
         
     | 
| 
       2873 
3454 
     | 
    
         
             
            import { BotIcon, ChevronDownIcon } from "lucide-react";
         
     | 
| 
       2874 
3455 
     | 
    
         | 
| 
       2875 
3456 
     | 
    
         
             
            // src/ui/thread.tsx
         
     | 
| 
       2876 
     | 
    
         
            -
            import { forwardRef as  
     | 
| 
      
 3457 
     | 
    
         
            +
            import { forwardRef as forwardRef27 } from "react";
         
     | 
| 
       2877 
3458 
     | 
    
         
             
            import { ArrowDownIcon } from "lucide-react";
         
     | 
| 
       2878 
3459 
     | 
    
         | 
| 
       2879 
3460 
     | 
    
         
             
            // src/ui/composer.tsx
         
     | 
| 
       2880 
     | 
    
         
            -
            import { forwardRef as  
     | 
| 
      
 3461 
     | 
    
         
            +
            import { forwardRef as forwardRef22 } from "react";
         
     | 
| 
       2881 
3462 
     | 
    
         
             
            import { SendHorizontalIcon } from "lucide-react";
         
     | 
| 
       2882 
3463 
     | 
    
         | 
| 
       2883 
3464 
     | 
    
         
             
            // src/ui/base/CircleStopIcon.tsx
         
     | 
| 
       2884 
     | 
    
         
            -
            import { jsx as  
     | 
| 
      
 3465 
     | 
    
         
            +
            import { jsx as jsx36 } from "react/jsx-runtime";
         
     | 
| 
       2885 
3466 
     | 
    
         
             
            var CircleStopIcon = () => {
         
     | 
| 
       2886 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 3467 
     | 
    
         
            +
              return /* @__PURE__ */ jsx36(
         
     | 
| 
       2887 
3468 
     | 
    
         
             
                "svg",
         
     | 
| 
       2888 
3469 
     | 
    
         
             
                {
         
     | 
| 
       2889 
3470 
     | 
    
         
             
                  xmlns: "http://www.w3.org/2000/svg",
         
     | 
| 
       2890 
3471 
     | 
    
         
             
                  viewBox: "0 0 16 16",
         
     | 
| 
       2891 
3472 
     | 
    
         
             
                  fill: "currentColor",
         
     | 
| 
       2892 
     | 
    
         
            -
                  children: /* @__PURE__ */  
     | 
| 
      
 3473 
     | 
    
         
            +
                  children: /* @__PURE__ */ jsx36("rect", { width: "10", height: "10", x: "3", y: "3", rx: "2" })
         
     | 
| 
       2893 
3474 
     | 
    
         
             
                }
         
     | 
| 
       2894 
3475 
     | 
    
         
             
              );
         
     | 
| 
       2895 
3476 
     | 
    
         
             
            };
         
     | 
| 
       2896 
3477 
     | 
    
         
             
            CircleStopIcon.displayName = "CircleStopIcon";
         
     | 
| 
       2897 
3478 
     | 
    
         | 
| 
       2898 
3479 
     | 
    
         
             
            // src/ui/composer.tsx
         
     | 
| 
       2899 
     | 
    
         
            -
            import { Fragment as Fragment5, jsx as  
     | 
| 
      
 3480 
     | 
    
         
            +
            import { Fragment as Fragment5, jsx as jsx37, jsxs as jsxs9 } from "react/jsx-runtime";
         
     | 
| 
       2900 
3481 
     | 
    
         
             
            var Composer = () => {
         
     | 
| 
       2901 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
       2902 
     | 
    
         
            -
                /* @__PURE__ */  
     | 
| 
       2903 
     | 
    
         
            -
                /* @__PURE__ */  
     | 
| 
      
 3482 
     | 
    
         
            +
              return /* @__PURE__ */ jsxs9(ComposerRoot, { children: [
         
     | 
| 
      
 3483 
     | 
    
         
            +
                /* @__PURE__ */ jsx37(ComposerInput, { autoFocus: true }),
         
     | 
| 
      
 3484 
     | 
    
         
            +
                /* @__PURE__ */ jsx37(ComposerAction, {})
         
     | 
| 
       2904 
3485 
     | 
    
         
             
              ] });
         
     | 
| 
       2905 
3486 
     | 
    
         
             
            };
         
     | 
| 
       2906 
3487 
     | 
    
         
             
            Composer.displayName = "Composer";
         
     | 
| 
         @@ -2913,14 +3494,14 @@ var ComposerInputStyled = withDefaults(composer_exports.Input, { 
     | 
|
| 
       2913 
3494 
     | 
    
         
             
              autoFocus: true,
         
     | 
| 
       2914 
3495 
     | 
    
         
             
              className: "aui-composer-input"
         
     | 
| 
       2915 
3496 
     | 
    
         
             
            });
         
     | 
| 
       2916 
     | 
    
         
            -
            var ComposerInput =  
     | 
| 
      
 3497 
     | 
    
         
            +
            var ComposerInput = forwardRef22(
         
     | 
| 
       2917 
3498 
     | 
    
         
             
              (props, ref) => {
         
     | 
| 
       2918 
3499 
     | 
    
         
             
                const {
         
     | 
| 
       2919 
3500 
     | 
    
         
             
                  strings: {
         
     | 
| 
       2920 
3501 
     | 
    
         
             
                    composer: { input: { placeholder = "Write a message..." } = {} } = {}
         
     | 
| 
       2921 
3502 
     | 
    
         
             
                  } = {}
         
     | 
| 
       2922 
3503 
     | 
    
         
             
                } = useThreadConfig();
         
     | 
| 
       2923 
     | 
    
         
            -
                return /* @__PURE__ */  
     | 
| 
      
 3504 
     | 
    
         
            +
                return /* @__PURE__ */ jsx37(ComposerInputStyled, { placeholder, ...props, ref });
         
     | 
| 
       2924 
3505 
     | 
    
         
             
              }
         
     | 
| 
       2925 
3506 
     | 
    
         
             
            );
         
     | 
| 
       2926 
3507 
     | 
    
         
             
            ComposerInput.displayName = "ComposerInput";
         
     | 
| 
         @@ -2931,10 +3512,10 @@ var useAllowCancel = () => { 
     | 
|
| 
       2931 
3512 
     | 
    
         
             
            };
         
     | 
| 
       2932 
3513 
     | 
    
         
             
            var ComposerAction = () => {
         
     | 
| 
       2933 
3514 
     | 
    
         
             
              const allowCancel = useAllowCancel();
         
     | 
| 
       2934 
     | 
    
         
            -
              if (!allowCancel) return /* @__PURE__ */  
     | 
| 
       2935 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
       2936 
     | 
    
         
            -
                /* @__PURE__ */  
     | 
| 
       2937 
     | 
    
         
            -
                /* @__PURE__ */  
     | 
| 
      
 3515 
     | 
    
         
            +
              if (!allowCancel) return /* @__PURE__ */ jsx37(ComposerSend, {});
         
     | 
| 
      
 3516 
     | 
    
         
            +
              return /* @__PURE__ */ jsxs9(Fragment5, { children: [
         
     | 
| 
      
 3517 
     | 
    
         
            +
                /* @__PURE__ */ jsx37(thread_exports.If, { running: false, children: /* @__PURE__ */ jsx37(ComposerSend, {}) }),
         
     | 
| 
      
 3518 
     | 
    
         
            +
                /* @__PURE__ */ jsx37(thread_exports.If, { running: true, children: /* @__PURE__ */ jsx37(ComposerCancel, {}) })
         
     | 
| 
       2938 
3519 
     | 
    
         
             
              ] });
         
     | 
| 
       2939 
3520 
     | 
    
         
             
            };
         
     | 
| 
       2940 
3521 
     | 
    
         
             
            ComposerAction.displayName = "ComposerAction";
         
     | 
| 
         @@ -2942,22 +3523,22 @@ var ComposerSendButton = withDefaults(TooltipIconButton, { 
     | 
|
| 
       2942 
3523 
     | 
    
         
             
              variant: "default",
         
     | 
| 
       2943 
3524 
     | 
    
         
             
              className: "aui-composer-send"
         
     | 
| 
       2944 
3525 
     | 
    
         
             
            });
         
     | 
| 
       2945 
     | 
    
         
            -
            var ComposerSend =  
     | 
| 
      
 3526 
     | 
    
         
            +
            var ComposerSend = forwardRef22((props, ref) => {
         
     | 
| 
       2946 
3527 
     | 
    
         
             
              const {
         
     | 
| 
       2947 
3528 
     | 
    
         
             
                strings: { composer: { send: { tooltip = "Send" } = {} } = {} } = {}
         
     | 
| 
       2948 
3529 
     | 
    
         
             
              } = useThreadConfig();
         
     | 
| 
       2949 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 3530 
     | 
    
         
            +
              return /* @__PURE__ */ jsx37(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx37(ComposerSendButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx37(SendHorizontalIcon, {}) }) });
         
     | 
| 
       2950 
3531 
     | 
    
         
             
            });
         
     | 
| 
       2951 
3532 
     | 
    
         
             
            ComposerSend.displayName = "ComposerSend";
         
     | 
| 
       2952 
3533 
     | 
    
         
             
            var ComposerCancelButton = withDefaults(TooltipIconButton, {
         
     | 
| 
       2953 
3534 
     | 
    
         
             
              variant: "default",
         
     | 
| 
       2954 
3535 
     | 
    
         
             
              className: "aui-composer-cancel"
         
     | 
| 
       2955 
3536 
     | 
    
         
             
            });
         
     | 
| 
       2956 
     | 
    
         
            -
            var ComposerCancel =  
     | 
| 
      
 3537 
     | 
    
         
            +
            var ComposerCancel = forwardRef22((props, ref) => {
         
     | 
| 
       2957 
3538 
     | 
    
         
             
              const {
         
     | 
| 
       2958 
3539 
     | 
    
         
             
                strings: { composer: { cancel: { tooltip = "Cancel" } = {} } = {} } = {}
         
     | 
| 
       2959 
3540 
     | 
    
         
             
              } = useThreadConfig();
         
     | 
| 
       2960 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 3541 
     | 
    
         
            +
              return /* @__PURE__ */ jsx37(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx37(ComposerCancelButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx37(CircleStopIcon, {}) }) });
         
     | 
| 
       2961 
3542 
     | 
    
         
             
            });
         
     | 
| 
       2962 
3543 
     | 
    
         
             
            ComposerCancel.displayName = "ComposerCancel";
         
     | 
| 
       2963 
3544 
     | 
    
         
             
            var exports5 = {
         
     | 
| 
         @@ -2970,15 +3551,15 @@ var exports5 = { 
     | 
|
| 
       2970 
3551 
     | 
    
         
             
            var composer_default = Object.assign(Composer, exports5);
         
     | 
| 
       2971 
3552 
     | 
    
         | 
| 
       2972 
3553 
     | 
    
         
             
            // src/ui/thread-welcome.tsx
         
     | 
| 
       2973 
     | 
    
         
            -
            import { forwardRef as  
     | 
| 
       2974 
     | 
    
         
            -
            import { jsx as  
     | 
| 
      
 3554 
     | 
    
         
            +
            import { forwardRef as forwardRef23 } from "react";
         
     | 
| 
      
 3555 
     | 
    
         
            +
            import { jsx as jsx38, jsxs as jsxs10 } from "react/jsx-runtime";
         
     | 
| 
       2975 
3556 
     | 
    
         
             
            var ThreadWelcome = () => {
         
     | 
| 
       2976 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
       2977 
     | 
    
         
            -
                /* @__PURE__ */  
     | 
| 
       2978 
     | 
    
         
            -
                  /* @__PURE__ */  
     | 
| 
       2979 
     | 
    
         
            -
                  /* @__PURE__ */  
     | 
| 
      
 3557 
     | 
    
         
            +
              return /* @__PURE__ */ jsxs10(ThreadWelcomeRoot, { children: [
         
     | 
| 
      
 3558 
     | 
    
         
            +
                /* @__PURE__ */ jsxs10(ThreadWelcomeCenter, { children: [
         
     | 
| 
      
 3559 
     | 
    
         
            +
                  /* @__PURE__ */ jsx38(ThreadWelcomeAvatar, {}),
         
     | 
| 
      
 3560 
     | 
    
         
            +
                  /* @__PURE__ */ jsx38(ThreadWelcomeMessage, {})
         
     | 
| 
       2980 
3561 
     | 
    
         
             
                ] }),
         
     | 
| 
       2981 
     | 
    
         
            -
                /* @__PURE__ */  
     | 
| 
      
 3562 
     | 
    
         
            +
                /* @__PURE__ */ jsx38(ThreadWelcomeSuggestions, {})
         
     | 
| 
       2982 
3563 
     | 
    
         
             
              ] });
         
     | 
| 
       2983 
3564 
     | 
    
         
             
            };
         
     | 
| 
       2984 
3565 
     | 
    
         
             
            ThreadWelcome.displayName = "ThreadWelcome";
         
     | 
| 
         @@ -2988,22 +3569,22 @@ var ThreadWelcomeRootStyled = withDefaults("div", { 
     | 
|
| 
       2988 
3569 
     | 
    
         
             
            var ThreadWelcomeCenter = withDefaults("div", {
         
     | 
| 
       2989 
3570 
     | 
    
         
             
              className: "aui-thread-welcome-center"
         
     | 
| 
       2990 
3571 
     | 
    
         
             
            });
         
     | 
| 
       2991 
     | 
    
         
            -
            var ThreadWelcomeRoot =  
     | 
| 
      
 3572 
     | 
    
         
            +
            var ThreadWelcomeRoot = forwardRef23(
         
     | 
| 
       2992 
3573 
     | 
    
         
             
              (props, ref) => {
         
     | 
| 
       2993 
     | 
    
         
            -
                return /* @__PURE__ */  
     | 
| 
      
 3574 
     | 
    
         
            +
                return /* @__PURE__ */ jsx38(thread_exports.Empty, { children: /* @__PURE__ */ jsx38(ThreadWelcomeRootStyled, { ...props, ref }) });
         
     | 
| 
       2994 
3575 
     | 
    
         
             
              }
         
     | 
| 
       2995 
3576 
     | 
    
         
             
            );
         
     | 
| 
       2996 
3577 
     | 
    
         
             
            ThreadWelcomeRoot.displayName = "ThreadWelcomeRoot";
         
     | 
| 
       2997 
3578 
     | 
    
         
             
            var ThreadWelcomeAvatar = () => {
         
     | 
| 
       2998 
3579 
     | 
    
         
             
              const { assistantAvatar: avatar = { fallback: "A" } } = useThreadConfig();
         
     | 
| 
       2999 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 3580 
     | 
    
         
            +
              return /* @__PURE__ */ jsx38(Avatar, { ...avatar });
         
     | 
| 
       3000 
3581 
     | 
    
         
             
            };
         
     | 
| 
       3001 
3582 
     | 
    
         
             
            var ThreadWelcomeMessageStyled = withDefaults("p", {
         
     | 
| 
       3002 
3583 
     | 
    
         
             
              className: "aui-thread-welcome-message"
         
     | 
| 
       3003 
3584 
     | 
    
         
             
            });
         
     | 
| 
       3004 
     | 
    
         
            -
            var ThreadWelcomeMessage =  
     | 
| 
      
 3585 
     | 
    
         
            +
            var ThreadWelcomeMessage = forwardRef23(({ message: messageProp, ...rest }, ref) => {
         
     | 
| 
       3005 
3586 
     | 
    
         
             
              const { welcome: { message = "How can I help you today?" } = {} } = useThreadConfig();
         
     | 
| 
       3006 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 3587 
     | 
    
         
            +
              return /* @__PURE__ */ jsx38(ThreadWelcomeMessageStyled, { ...rest, ref, children: messageProp ?? message });
         
     | 
| 
       3007 
3588 
     | 
    
         
             
            });
         
     | 
| 
       3008 
3589 
     | 
    
         
             
            ThreadWelcomeMessage.displayName = "ThreadWelcomeMessage";
         
     | 
| 
       3009 
3590 
     | 
    
         
             
            var ThreadWelcomeSuggestionContainer = withDefaults("div", {
         
     | 
| 
         @@ -3015,21 +3596,21 @@ var ThreadWelcomeSuggestionStyled = withDefaults(thread_exports.Suggestion, { 
     | 
|
| 
       3015 
3596 
     | 
    
         
             
            var ThreadWelcomeSuggestion = ({
         
     | 
| 
       3016 
3597 
     | 
    
         
             
              suggestion: { text, prompt }
         
     | 
| 
       3017 
3598 
     | 
    
         
             
            }) => {
         
     | 
| 
       3018 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 3599 
     | 
    
         
            +
              return /* @__PURE__ */ jsx38(
         
     | 
| 
       3019 
3600 
     | 
    
         
             
                ThreadWelcomeSuggestionStyled,
         
     | 
| 
       3020 
3601 
     | 
    
         
             
                {
         
     | 
| 
       3021 
3602 
     | 
    
         
             
                  prompt,
         
     | 
| 
       3022 
3603 
     | 
    
         
             
                  method: "replace",
         
     | 
| 
       3023 
3604 
     | 
    
         
             
                  autoSend: true,
         
     | 
| 
       3024 
     | 
    
         
            -
                  children: /* @__PURE__ */  
     | 
| 
      
 3605 
     | 
    
         
            +
                  children: /* @__PURE__ */ jsx38("span", { className: "aui-thread-welcome-suggestion-text", children: text ?? prompt })
         
     | 
| 
       3025 
3606 
     | 
    
         
             
                }
         
     | 
| 
       3026 
3607 
     | 
    
         
             
              );
         
     | 
| 
       3027 
3608 
     | 
    
         
             
            };
         
     | 
| 
       3028 
3609 
     | 
    
         
             
            var ThreadWelcomeSuggestions = () => {
         
     | 
| 
       3029 
3610 
     | 
    
         
             
              const { welcome: { suggestions } = {} } = useThreadConfig();
         
     | 
| 
       3030 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 3611 
     | 
    
         
            +
              return /* @__PURE__ */ jsx38(ThreadWelcomeSuggestionContainer, { children: suggestions?.map((suggestion, idx) => {
         
     | 
| 
       3031 
3612 
     | 
    
         
             
                const key = `${suggestion.prompt}-${idx}`;
         
     | 
| 
       3032 
     | 
    
         
            -
                return /* @__PURE__ */  
     | 
| 
      
 3613 
     | 
    
         
            +
                return /* @__PURE__ */ jsx38(ThreadWelcomeSuggestion, { suggestion }, key);
         
     | 
| 
       3033 
3614 
     | 
    
         
             
              }) });
         
     | 
| 
       3034 
3615 
     | 
    
         
             
            };
         
     | 
| 
       3035 
3616 
     | 
    
         
             
            ThreadWelcomeSuggestions.displayName = "ThreadWelcomeSuggestions";
         
     | 
| 
         @@ -3044,12 +3625,12 @@ var exports6 = { 
     | 
|
| 
       3044 
3625 
     | 
    
         
             
            var thread_welcome_default = Object.assign(ThreadWelcome, exports6);
         
     | 
| 
       3045 
3626 
     | 
    
         | 
| 
       3046 
3627 
     | 
    
         
             
            // src/ui/user-message.tsx
         
     | 
| 
       3047 
     | 
    
         
            -
            import { forwardRef as  
     | 
| 
      
 3628 
     | 
    
         
            +
            import { forwardRef as forwardRef25 } from "react";
         
     | 
| 
       3048 
3629 
     | 
    
         | 
| 
       3049 
3630 
     | 
    
         
             
            // src/ui/user-action-bar.tsx
         
     | 
| 
       3050 
     | 
    
         
            -
            import { forwardRef as  
     | 
| 
      
 3631 
     | 
    
         
            +
            import { forwardRef as forwardRef24 } from "react";
         
     | 
| 
       3051 
3632 
     | 
    
         
             
            import { PencilIcon } from "lucide-react";
         
     | 
| 
       3052 
     | 
    
         
            -
            import { jsx as  
     | 
| 
      
 3633 
     | 
    
         
            +
            import { jsx as jsx39 } from "react/jsx-runtime";
         
     | 
| 
       3053 
3634 
     | 
    
         
             
            var useAllowEdit = () => {
         
     | 
| 
       3054 
3635 
     | 
    
         
             
              const { userMessage: { allowEdit = true } = {} } = useThreadConfig();
         
     | 
| 
       3055 
3636 
     | 
    
         
             
              const { useThreadActions } = useThreadContext();
         
     | 
| 
         @@ -3059,20 +3640,20 @@ var useAllowEdit = () => { 
     | 
|
| 
       3059 
3640 
     | 
    
         
             
            var UserActionBar = () => {
         
     | 
| 
       3060 
3641 
     | 
    
         
             
              const allowEdit = useAllowEdit();
         
     | 
| 
       3061 
3642 
     | 
    
         
             
              if (!allowEdit) return null;
         
     | 
| 
       3062 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 3643 
     | 
    
         
            +
              return /* @__PURE__ */ jsx39(UserActionBarRoot, { hideWhenRunning: true, autohide: "not-last", children: /* @__PURE__ */ jsx39(UserActionBarEdit, {}) });
         
     | 
| 
       3063 
3644 
     | 
    
         
             
            };
         
     | 
| 
       3064 
3645 
     | 
    
         
             
            UserActionBar.displayName = "UserActionBar";
         
     | 
| 
       3065 
3646 
     | 
    
         
             
            var UserActionBarRoot = withDefaults(actionBar_exports.Root, {
         
     | 
| 
       3066 
3647 
     | 
    
         
             
              className: "aui-user-action-bar-root"
         
     | 
| 
       3067 
3648 
     | 
    
         
             
            });
         
     | 
| 
       3068 
3649 
     | 
    
         
             
            UserActionBarRoot.displayName = "UserActionBarRoot";
         
     | 
| 
       3069 
     | 
    
         
            -
            var UserActionBarEdit =  
     | 
| 
      
 3650 
     | 
    
         
            +
            var UserActionBarEdit = forwardRef24((props, ref) => {
         
     | 
| 
       3070 
3651 
     | 
    
         
             
              const {
         
     | 
| 
       3071 
3652 
     | 
    
         
             
                strings: { userMessage: { edit: { tooltip = "Edit" } = {} } = {} } = {}
         
     | 
| 
       3072 
3653 
     | 
    
         
             
              } = useThreadConfig();
         
     | 
| 
       3073 
3654 
     | 
    
         
             
              const allowEdit = useAllowEdit();
         
     | 
| 
       3074 
3655 
     | 
    
         
             
              if (!allowEdit) return null;
         
     | 
| 
       3075 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 3656 
     | 
    
         
            +
              return /* @__PURE__ */ jsx39(actionBar_exports.Edit, { asChild: true, children: /* @__PURE__ */ jsx39(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx39(PencilIcon, {}) }) });
         
     | 
| 
       3076 
3657 
     | 
    
         
             
            });
         
     | 
| 
       3077 
3658 
     | 
    
         
             
            UserActionBarEdit.displayName = "UserActionBarEdit";
         
     | 
| 
       3078 
3659 
     | 
    
         
             
            var exports7 = {
         
     | 
| 
         @@ -3082,12 +3663,12 @@ var exports7 = { 
     | 
|
| 
       3082 
3663 
     | 
    
         
             
            var user_action_bar_default = Object.assign(UserActionBar, exports7);
         
     | 
| 
       3083 
3664 
     | 
    
         | 
| 
       3084 
3665 
     | 
    
         
             
            // src/ui/user-message.tsx
         
     | 
| 
       3085 
     | 
    
         
            -
            import { jsx as  
     | 
| 
      
 3666 
     | 
    
         
            +
            import { jsx as jsx40, jsxs as jsxs11 } from "react/jsx-runtime";
         
     | 
| 
       3086 
3667 
     | 
    
         
             
            var UserMessage = () => {
         
     | 
| 
       3087 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
       3088 
     | 
    
         
            -
                /* @__PURE__ */  
     | 
| 
       3089 
     | 
    
         
            -
                /* @__PURE__ */  
     | 
| 
       3090 
     | 
    
         
            -
                /* @__PURE__ */  
     | 
| 
      
 3668 
     | 
    
         
            +
              return /* @__PURE__ */ jsxs11(UserMessageRoot, { children: [
         
     | 
| 
      
 3669 
     | 
    
         
            +
                /* @__PURE__ */ jsx40(user_action_bar_default, {}),
         
     | 
| 
      
 3670 
     | 
    
         
            +
                /* @__PURE__ */ jsx40(UserMessageContent, {}),
         
     | 
| 
      
 3671 
     | 
    
         
            +
                /* @__PURE__ */ jsx40(branch_picker_default, {})
         
     | 
| 
       3091 
3672 
     | 
    
         
             
              ] });
         
     | 
| 
       3092 
3673 
     | 
    
         
             
            };
         
     | 
| 
       3093 
3674 
     | 
    
         
             
            UserMessage.displayName = "UserMessage";
         
     | 
| 
         @@ -3098,9 +3679,9 @@ UserMessageRoot.displayName = "UserMessageRoot"; 
     | 
|
| 
       3098 
3679 
     | 
    
         
             
            var UserMessageContentWrapper = withDefaults("div", {
         
     | 
| 
       3099 
3680 
     | 
    
         
             
              className: "aui-user-message-content"
         
     | 
| 
       3100 
3681 
     | 
    
         
             
            });
         
     | 
| 
       3101 
     | 
    
         
            -
            var UserMessageContent =  
     | 
| 
      
 3682 
     | 
    
         
            +
            var UserMessageContent = forwardRef25(
         
     | 
| 
       3102 
3683 
     | 
    
         
             
              ({ components, ...props }, ref) => {
         
     | 
| 
       3103 
     | 
    
         
            -
                return /* @__PURE__ */  
     | 
| 
      
 3684 
     | 
    
         
            +
                return /* @__PURE__ */ jsx40(UserMessageContentWrapper, { ...props, ref, children: /* @__PURE__ */ jsx40(
         
     | 
| 
       3104 
3685 
     | 
    
         
             
                  message_exports.Content,
         
     | 
| 
       3105 
3686 
     | 
    
         
             
                  {
         
     | 
| 
       3106 
3687 
     | 
    
         
             
                    components: {
         
     | 
| 
         @@ -3119,14 +3700,14 @@ var exports8 = { 
     | 
|
| 
       3119 
3700 
     | 
    
         
             
            var user_message_default = Object.assign(UserMessage, exports8);
         
     | 
| 
       3120 
3701 
     | 
    
         | 
| 
       3121 
3702 
     | 
    
         
             
            // src/ui/edit-composer.tsx
         
     | 
| 
       3122 
     | 
    
         
            -
            import { forwardRef as  
     | 
| 
       3123 
     | 
    
         
            -
            import { jsx as  
     | 
| 
      
 3703 
     | 
    
         
            +
            import { forwardRef as forwardRef26 } from "react";
         
     | 
| 
      
 3704 
     | 
    
         
            +
            import { jsx as jsx41, jsxs as jsxs12 } from "react/jsx-runtime";
         
     | 
| 
       3124 
3705 
     | 
    
         
             
            var EditComposer = () => {
         
     | 
| 
       3125 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
       3126 
     | 
    
         
            -
                /* @__PURE__ */  
     | 
| 
       3127 
     | 
    
         
            -
                /* @__PURE__ */  
     | 
| 
       3128 
     | 
    
         
            -
                  /* @__PURE__ */  
     | 
| 
       3129 
     | 
    
         
            -
                  /* @__PURE__ */  
     | 
| 
      
 3706 
     | 
    
         
            +
              return /* @__PURE__ */ jsxs12(EditComposerRoot, { children: [
         
     | 
| 
      
 3707 
     | 
    
         
            +
                /* @__PURE__ */ jsx41(EditComposerInput, {}),
         
     | 
| 
      
 3708 
     | 
    
         
            +
                /* @__PURE__ */ jsxs12(EditComposerFooter, { children: [
         
     | 
| 
      
 3709 
     | 
    
         
            +
                  /* @__PURE__ */ jsx41(EditComposerCancel, {}),
         
     | 
| 
      
 3710 
     | 
    
         
            +
                  /* @__PURE__ */ jsx41(EditComposerSend, {})
         
     | 
| 
       3130 
3711 
     | 
    
         
             
                ] })
         
     | 
| 
       3131 
3712 
     | 
    
         
             
              ] });
         
     | 
| 
       3132 
3713 
     | 
    
         
             
            };
         
     | 
| 
         @@ -3143,23 +3724,23 @@ var EditComposerFooter = withDefaults("div", { 
     | 
|
| 
       3143 
3724 
     | 
    
         
             
              className: "aui-edit-composer-footer"
         
     | 
| 
       3144 
3725 
     | 
    
         
             
            });
         
     | 
| 
       3145 
3726 
     | 
    
         
             
            EditComposerFooter.displayName = "EditComposerFooter";
         
     | 
| 
       3146 
     | 
    
         
            -
            var EditComposerCancel =  
     | 
| 
      
 3727 
     | 
    
         
            +
            var EditComposerCancel = forwardRef26(
         
     | 
| 
       3147 
3728 
     | 
    
         
             
              (props, ref) => {
         
     | 
| 
       3148 
3729 
     | 
    
         
             
                const {
         
     | 
| 
       3149 
3730 
     | 
    
         
             
                  strings: {
         
     | 
| 
       3150 
3731 
     | 
    
         
             
                    editComposer: { cancel: { label = "Cancel" } = {} } = {}
         
     | 
| 
       3151 
3732 
     | 
    
         
             
                  } = {}
         
     | 
| 
       3152 
3733 
     | 
    
         
             
                } = useThreadConfig();
         
     | 
| 
       3153 
     | 
    
         
            -
                return /* @__PURE__ */  
     | 
| 
      
 3734 
     | 
    
         
            +
                return /* @__PURE__ */ jsx41(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx41(Button, { variant: "ghost", ...props, ref, children: props.children ?? label }) });
         
     | 
| 
       3154 
3735 
     | 
    
         
             
              }
         
     | 
| 
       3155 
3736 
     | 
    
         
             
            );
         
     | 
| 
       3156 
3737 
     | 
    
         
             
            EditComposerCancel.displayName = "EditComposerCancel";
         
     | 
| 
       3157 
     | 
    
         
            -
            var EditComposerSend =  
     | 
| 
      
 3738 
     | 
    
         
            +
            var EditComposerSend = forwardRef26(
         
     | 
| 
       3158 
3739 
     | 
    
         
             
              (props, ref) => {
         
     | 
| 
       3159 
3740 
     | 
    
         
             
                const {
         
     | 
| 
       3160 
3741 
     | 
    
         
             
                  strings: { editComposer: { send: { label = "Send" } = {} } = {} } = {}
         
     | 
| 
       3161 
3742 
     | 
    
         
             
                } = useThreadConfig();
         
     | 
| 
       3162 
     | 
    
         
            -
                return /* @__PURE__ */  
     | 
| 
      
 3743 
     | 
    
         
            +
                return /* @__PURE__ */ jsx41(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx41(Button, { ...props, ref, children: props.children ?? label }) });
         
     | 
| 
       3163 
3744 
     | 
    
         
             
              }
         
     | 
| 
       3164 
3745 
     | 
    
         
             
            );
         
     | 
| 
       3165 
3746 
     | 
    
         
             
            EditComposerSend.displayName = "EditComposerSend";
         
     | 
| 
         @@ -3173,23 +3754,23 @@ var exports9 = { 
     | 
|
| 
       3173 
3754 
     | 
    
         
             
            var edit_composer_default = Object.assign(EditComposer, exports9);
         
     | 
| 
       3174 
3755 
     | 
    
         | 
| 
       3175 
3756 
     | 
    
         
             
            // src/ui/thread.tsx
         
     | 
| 
       3176 
     | 
    
         
            -
            import { jsx as  
     | 
| 
      
 3757 
     | 
    
         
            +
            import { jsx as jsx42, jsxs as jsxs13 } from "react/jsx-runtime";
         
     | 
| 
       3177 
3758 
     | 
    
         
             
            var Thread = (config) => {
         
     | 
| 
       3178 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
       3179 
     | 
    
         
            -
                /* @__PURE__ */  
     | 
| 
       3180 
     | 
    
         
            -
                /* @__PURE__ */  
     | 
| 
       3181 
     | 
    
         
            -
                /* @__PURE__ */  
     | 
| 
       3182 
     | 
    
         
            -
                  /* @__PURE__ */  
     | 
| 
       3183 
     | 
    
         
            -
                  /* @__PURE__ */  
     | 
| 
      
 3759 
     | 
    
         
            +
              return /* @__PURE__ */ jsx42(ThreadRoot, { config, children: /* @__PURE__ */ jsxs13(ThreadViewport, { children: [
         
     | 
| 
      
 3760 
     | 
    
         
            +
                /* @__PURE__ */ jsx42(thread_welcome_default, {}),
         
     | 
| 
      
 3761 
     | 
    
         
            +
                /* @__PURE__ */ jsx42(ThreadMessages, {}),
         
     | 
| 
      
 3762 
     | 
    
         
            +
                /* @__PURE__ */ jsxs13(ThreadViewportFooter, { children: [
         
     | 
| 
      
 3763 
     | 
    
         
            +
                  /* @__PURE__ */ jsx42(ThreadScrollToBottom, {}),
         
     | 
| 
      
 3764 
     | 
    
         
            +
                  /* @__PURE__ */ jsx42(composer_default, {})
         
     | 
| 
       3184 
3765 
     | 
    
         
             
                ] })
         
     | 
| 
       3185 
3766 
     | 
    
         
             
              ] }) });
         
     | 
| 
       3186 
3767 
     | 
    
         
             
            };
         
     | 
| 
       3187 
3768 
     | 
    
         
             
            var ThreadRootStyled = withDefaults(thread_exports.Root, {
         
     | 
| 
       3188 
3769 
     | 
    
         
             
              className: "aui-root aui-thread-root"
         
     | 
| 
       3189 
3770 
     | 
    
         
             
            });
         
     | 
| 
       3190 
     | 
    
         
            -
            var ThreadRoot =  
     | 
| 
      
 3771 
     | 
    
         
            +
            var ThreadRoot = forwardRef27(
         
     | 
| 
       3191 
3772 
     | 
    
         
             
              ({ config, ...props }, ref) => {
         
     | 
| 
       3192 
     | 
    
         
            -
                return /* @__PURE__ */  
     | 
| 
      
 3773 
     | 
    
         
            +
                return /* @__PURE__ */ jsx42(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx42(ThreadRootStyled, { ...props, ref }) });
         
     | 
| 
       3193 
3774 
     | 
    
         
             
              }
         
     | 
| 
       3194 
3775 
     | 
    
         
             
            );
         
     | 
| 
       3195 
3776 
     | 
    
         
             
            ThreadRoot.displayName = "ThreadRoot";
         
     | 
| 
         @@ -3203,7 +3784,7 @@ var ThreadViewportFooter = withDefaults("div", { 
     | 
|
| 
       3203 
3784 
     | 
    
         
             
            ThreadViewportFooter.displayName = "ThreadViewportFooter";
         
     | 
| 
       3204 
3785 
     | 
    
         
             
            var SystemMessage = () => null;
         
     | 
| 
       3205 
3786 
     | 
    
         
             
            var ThreadMessages = ({ components, ...rest }) => {
         
     | 
| 
       3206 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 3787 
     | 
    
         
            +
              return /* @__PURE__ */ jsx42(
         
     | 
| 
       3207 
3788 
     | 
    
         
             
                thread_exports.Messages,
         
     | 
| 
       3208 
3789 
     | 
    
         
             
                {
         
     | 
| 
       3209 
3790 
     | 
    
         
             
                  components: {
         
     | 
| 
         @@ -3221,13 +3802,13 @@ var ThreadScrollToBottomIconButton = withDefaults(TooltipIconButton, { 
     | 
|
| 
       3221 
3802 
     | 
    
         
             
              variant: "outline",
         
     | 
| 
       3222 
3803 
     | 
    
         
             
              className: "aui-thread-scroll-to-bottom"
         
     | 
| 
       3223 
3804 
     | 
    
         
             
            });
         
     | 
| 
       3224 
     | 
    
         
            -
            var ThreadScrollToBottom =  
     | 
| 
      
 3805 
     | 
    
         
            +
            var ThreadScrollToBottom = forwardRef27((props, ref) => {
         
     | 
| 
       3225 
3806 
     | 
    
         
             
              const {
         
     | 
| 
       3226 
3807 
     | 
    
         
             
                strings: {
         
     | 
| 
       3227 
3808 
     | 
    
         
             
                  thread: { scrollToBottom: { tooltip = "Scroll to bottom" } = {} } = {}
         
     | 
| 
       3228 
3809 
     | 
    
         
             
                } = {}
         
     | 
| 
       3229 
3810 
     | 
    
         
             
              } = useThreadConfig();
         
     | 
| 
       3230 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 3811 
     | 
    
         
            +
              return /* @__PURE__ */ jsx42(thread_exports.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsx42(ThreadScrollToBottomIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx42(ArrowDownIcon, {}) }) });
         
     | 
| 
       3231 
3812 
     | 
    
         
             
            });
         
     | 
| 
       3232 
3813 
     | 
    
         
             
            ThreadScrollToBottom.displayName = "ThreadScrollToBottom";
         
     | 
| 
       3233 
3814 
     | 
    
         
             
            var exports10 = {
         
     | 
| 
         @@ -3240,20 +3821,20 @@ var exports10 = { 
     | 
|
| 
       3240 
3821 
     | 
    
         
             
            var thread_default = Object.assign(Thread, exports10);
         
     | 
| 
       3241 
3822 
     | 
    
         | 
| 
       3242 
3823 
     | 
    
         
             
            // src/ui/assistant-modal.tsx
         
     | 
| 
       3243 
     | 
    
         
            -
            import { Fragment as Fragment6, jsx as  
     | 
| 
      
 3824 
     | 
    
         
            +
            import { Fragment as Fragment6, jsx as jsx43, jsxs as jsxs14 } from "react/jsx-runtime";
         
     | 
| 
       3244 
3825 
     | 
    
         
             
            var AssistantModal = (config) => {
         
     | 
| 
       3245 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
       3246 
     | 
    
         
            -
                /* @__PURE__ */  
     | 
| 
       3247 
     | 
    
         
            -
                /* @__PURE__ */  
     | 
| 
      
 3826 
     | 
    
         
            +
              return /* @__PURE__ */ jsxs14(AssistantModalRoot, { config, children: [
         
     | 
| 
      
 3827 
     | 
    
         
            +
                /* @__PURE__ */ jsx43(AssistantModalTrigger, {}),
         
     | 
| 
      
 3828 
     | 
    
         
            +
                /* @__PURE__ */ jsx43(AssistantModalContent, { children: /* @__PURE__ */ jsx43(thread_default, {}) })
         
     | 
| 
       3248 
3829 
     | 
    
         
             
              ] });
         
     | 
| 
       3249 
3830 
     | 
    
         
             
            };
         
     | 
| 
       3250 
3831 
     | 
    
         
             
            AssistantModal.displayName = "AssistantModal";
         
     | 
| 
       3251 
3832 
     | 
    
         
             
            var AssistantModalRoot = ({ config, ...props }) => {
         
     | 
| 
       3252 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 3833 
     | 
    
         
            +
              return /* @__PURE__ */ jsx43(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx43(assistantModal_exports.Root, { ...props }) });
         
     | 
| 
       3253 
3834 
     | 
    
         
             
            };
         
     | 
| 
       3254 
3835 
     | 
    
         
             
            AssistantModalRoot.displayName = "AssistantModalRoot";
         
     | 
| 
       3255 
     | 
    
         
            -
            var AssistantModalTrigger =  
     | 
| 
       3256 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 3836 
     | 
    
         
            +
            var AssistantModalTrigger = forwardRef28((props, ref) => {
         
     | 
| 
      
 3837 
     | 
    
         
            +
              return /* @__PURE__ */ jsx43(AssistantModalAnchor, { children: /* @__PURE__ */ jsx43(assistantModal_exports.Trigger, { asChild: true, children: /* @__PURE__ */ jsx43(AssistantModalButton, { ...props, ref }) }) });
         
     | 
| 
       3257 
3838 
     | 
    
         
             
            });
         
     | 
| 
       3258 
3839 
     | 
    
         
             
            AssistantModalTrigger.displayName = "AssistantModalTrigger";
         
     | 
| 
       3259 
3840 
     | 
    
         
             
            var AssistantModalAnchor = withDefaults(assistantModal_exports.Anchor, {
         
     | 
| 
         @@ -3264,7 +3845,7 @@ var ModalButtonStyled = withDefaults(TooltipIconButton, { 
     | 
|
| 
       3264 
3845 
     | 
    
         
             
              variant: "default",
         
     | 
| 
       3265 
3846 
     | 
    
         
             
              className: "aui-modal-button"
         
     | 
| 
       3266 
3847 
     | 
    
         
             
            });
         
     | 
| 
       3267 
     | 
    
         
            -
            var AssistantModalButton =  
     | 
| 
      
 3848 
     | 
    
         
            +
            var AssistantModalButton = forwardRef28(({ "data-state": state, ...rest }, ref) => {
         
     | 
| 
       3268 
3849 
     | 
    
         
             
              const {
         
     | 
| 
       3269 
3850 
     | 
    
         
             
                strings: {
         
     | 
| 
       3270 
3851 
     | 
    
         
             
                  assistantModal: {
         
     | 
| 
         @@ -3278,7 +3859,7 @@ var AssistantModalButton = forwardRef24(({ "data-state": state, ...rest }, ref) 
     | 
|
| 
       3278 
3859 
     | 
    
         
             
                } = {}
         
     | 
| 
       3279 
3860 
     | 
    
         
             
              } = useThreadConfig();
         
     | 
| 
       3280 
3861 
     | 
    
         
             
              const tooltip = state === "open" ? openTooltip : closedTooltip;
         
     | 
| 
       3281 
     | 
    
         
            -
              return /* @__PURE__ */  
     | 
| 
      
 3862 
     | 
    
         
            +
              return /* @__PURE__ */ jsx43(
         
     | 
| 
       3282 
3863 
     | 
    
         
             
                ModalButtonStyled,
         
     | 
| 
       3283 
3864 
     | 
    
         
             
                {
         
     | 
| 
       3284 
3865 
     | 
    
         
             
                  side: "left",
         
     | 
| 
         @@ -3286,15 +3867,15 @@ var AssistantModalButton = forwardRef24(({ "data-state": state, ...rest }, ref) 
     | 
|
| 
       3286 
3867 
     | 
    
         
             
                  "data-state": state,
         
     | 
| 
       3287 
3868 
     | 
    
         
             
                  ...rest,
         
     | 
| 
       3288 
3869 
     | 
    
         
             
                  ref,
         
     | 
| 
       3289 
     | 
    
         
            -
                  children: rest.children ?? /* @__PURE__ */  
     | 
| 
       3290 
     | 
    
         
            -
                    /* @__PURE__ */  
     | 
| 
      
 3870 
     | 
    
         
            +
                  children: rest.children ?? /* @__PURE__ */ jsxs14(Fragment6, { children: [
         
     | 
| 
      
 3871 
     | 
    
         
            +
                    /* @__PURE__ */ jsx43(
         
     | 
| 
       3291 
3872 
     | 
    
         
             
                      BotIcon,
         
     | 
| 
       3292 
3873 
     | 
    
         
             
                      {
         
     | 
| 
       3293 
3874 
     | 
    
         
             
                        "data-state": state,
         
     | 
| 
       3294 
3875 
     | 
    
         
             
                        className: "aui-modal-button-closed-icon"
         
     | 
| 
       3295 
3876 
     | 
    
         
             
                      }
         
     | 
| 
       3296 
3877 
     | 
    
         
             
                    ),
         
     | 
| 
       3297 
     | 
    
         
            -
                    /* @__PURE__ */  
     | 
| 
      
 3878 
     | 
    
         
            +
                    /* @__PURE__ */ jsx43(
         
     | 
| 
       3298 
3879 
     | 
    
         
             
                      ChevronDownIcon,
         
     | 
| 
       3299 
3880 
     | 
    
         
             
                      {
         
     | 
| 
       3300 
3881 
     | 
    
         
             
                        "data-state": state,
         
     |