@cossistant/react 0.0.26 → 0.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/README.md +1 -1
  2. package/api.d.ts +1 -1
  3. package/api.d.ts.map +1 -1
  4. package/checks.d.ts +1 -1
  5. package/checks.d.ts.map +1 -1
  6. package/coerce.d.ts +1 -1
  7. package/coerce.d.ts.map +1 -1
  8. package/conversation.d.ts +6 -3
  9. package/conversation.d.ts.map +1 -1
  10. package/core.d.ts +1 -1
  11. package/core.d.ts.map +1 -1
  12. package/errors.d.ts +12 -3
  13. package/errors.d.ts.map +1 -1
  14. package/errors2.d.ts +1 -1
  15. package/errors2.d.ts.map +1 -1
  16. package/hooks/index.d.ts +3 -2
  17. package/hooks/index.js +6 -5
  18. package/hooks/private/store/use-website-store.js +2 -1
  19. package/hooks/private/store/use-website-store.js.map +1 -1
  20. package/hooks/private/use-client-query.d.ts +6 -0
  21. package/hooks/private/use-client-query.d.ts.map +1 -1
  22. package/hooks/private/use-client-query.js +26 -3
  23. package/hooks/private/use-client-query.js.map +1 -1
  24. package/hooks/private/use-grouped-messages.d.ts +8 -5
  25. package/hooks/private/use-grouped-messages.d.ts.map +1 -1
  26. package/hooks/private/use-grouped-messages.js +44 -11
  27. package/hooks/private/use-grouped-messages.js.map +1 -1
  28. package/hooks/private/use-multimodal-input.d.ts.map +1 -1
  29. package/hooks/private/use-multimodal-input.js +7 -5
  30. package/hooks/private/use-multimodal-input.js.map +1 -1
  31. package/hooks/private/use-visitor-typing-reporter.d.ts +18 -1
  32. package/hooks/private/use-visitor-typing-reporter.d.ts.map +1 -1
  33. package/hooks/private/use-visitor-typing-reporter.js +34 -4
  34. package/hooks/private/use-visitor-typing-reporter.js.map +1 -1
  35. package/hooks/use-conversation-page.d.ts +1 -0
  36. package/hooks/use-conversation-page.d.ts.map +1 -1
  37. package/hooks/use-conversation-page.js +6 -1
  38. package/hooks/use-conversation-page.js.map +1 -1
  39. package/hooks/use-conversation-preview.d.ts +2 -1
  40. package/hooks/use-conversation-preview.d.ts.map +1 -1
  41. package/hooks/use-conversation-preview.js +1 -1
  42. package/hooks/use-conversation-preview.js.map +1 -1
  43. package/hooks/use-conversation-seen.js +1 -1
  44. package/hooks/use-conversation-seen.js.map +1 -1
  45. package/hooks/use-conversation-timeline-items.js +2 -1
  46. package/hooks/use-conversation-timeline-items.js.map +1 -1
  47. package/hooks/use-conversation-timeline.d.ts.map +1 -1
  48. package/hooks/use-conversation-timeline.js +1 -3
  49. package/hooks/use-conversation-timeline.js.map +1 -1
  50. package/hooks/use-conversation.js +2 -1
  51. package/hooks/use-conversation.js.map +1 -1
  52. package/hooks/use-conversations.js +1 -0
  53. package/hooks/use-conversations.js.map +1 -1
  54. package/hooks/use-create-conversation.d.ts.map +1 -1
  55. package/hooks/use-file-upload.d.ts +55 -0
  56. package/hooks/use-file-upload.d.ts.map +1 -0
  57. package/hooks/use-file-upload.js +100 -0
  58. package/hooks/use-file-upload.js.map +1 -0
  59. package/hooks/use-message-composer.d.ts +11 -0
  60. package/hooks/use-message-composer.d.ts.map +1 -1
  61. package/hooks/use-message-composer.js +7 -3
  62. package/hooks/use-message-composer.js.map +1 -1
  63. package/hooks/use-send-message.d.ts +1 -0
  64. package/hooks/use-send-message.d.ts.map +1 -1
  65. package/hooks/use-send-message.js +63 -11
  66. package/hooks/use-send-message.js.map +1 -1
  67. package/index.d.ts +7 -4
  68. package/index.js +13 -10
  69. package/json-schema.d.ts +70 -0
  70. package/json-schema.d.ts.map +1 -0
  71. package/package.json +4 -3
  72. package/parse.d.ts +1 -1
  73. package/parse.d.ts.map +1 -1
  74. package/primitives/avatar/fallback.d.ts.map +1 -1
  75. package/primitives/avatar/fallback.js +1 -1
  76. package/primitives/avatar/fallback.js.map +1 -1
  77. package/primitives/conversation-timeline.d.ts.map +1 -1
  78. package/primitives/conversation-timeline.js +10 -5
  79. package/primitives/conversation-timeline.js.map +1 -1
  80. package/primitives/day-separator.d.ts +76 -0
  81. package/primitives/day-separator.d.ts.map +1 -0
  82. package/primitives/day-separator.js +111 -0
  83. package/primitives/day-separator.js.map +1 -0
  84. package/primitives/index.d.ts +5 -3
  85. package/primitives/index.js +17 -5
  86. package/primitives/index.parts.d.ts +4 -2
  87. package/primitives/index.parts.js +5 -3
  88. package/primitives/timeline-item-attachments.d.ts +100 -0
  89. package/primitives/timeline-item-attachments.d.ts.map +1 -0
  90. package/primitives/timeline-item-attachments.js +151 -0
  91. package/primitives/timeline-item-attachments.js.map +1 -0
  92. package/primitives/timeline-item-group.d.ts.map +1 -1
  93. package/primitives/timeline-item-group.js +1 -1
  94. package/primitives/timeline-item-group.js.map +1 -1
  95. package/primitives/timeline-item.js +1 -1
  96. package/primitives/timeline-item.js.map +1 -1
  97. package/primitives/trigger.d.ts +91 -0
  98. package/primitives/trigger.d.ts.map +1 -0
  99. package/primitives/trigger.js +74 -0
  100. package/primitives/trigger.js.map +1 -0
  101. package/primitives/window.d.ts +22 -1
  102. package/primitives/window.d.ts.map +1 -1
  103. package/primitives/window.js +91 -5
  104. package/primitives/window.js.map +1 -1
  105. package/provider.d.ts.map +1 -1
  106. package/provider.js +8 -3
  107. package/provider.js.map +1 -1
  108. package/realtime/index.js +1 -1
  109. package/realtime/provider.js +1 -1
  110. package/realtime/support-provider.js +5 -1
  111. package/realtime/support-provider.js.map +1 -1
  112. package/realtime-events.d.ts +165 -2
  113. package/realtime-events.d.ts.map +1 -1
  114. package/registries.d.ts +1 -1
  115. package/registries.d.ts.map +1 -1
  116. package/schemas.d.ts +305 -7
  117. package/schemas.d.ts.map +1 -1
  118. package/schemas2.d.ts +29 -4
  119. package/schemas2.d.ts.map +1 -1
  120. package/schemas3.d.ts +2 -1
  121. package/schemas3.d.ts.map +1 -1
  122. package/standard-schema.d.ts +83 -21
  123. package/standard-schema.d.ts.map +1 -1
  124. package/support/components/button.d.ts +1 -1
  125. package/support/components/content.d.ts +30 -0
  126. package/support/components/content.d.ts.map +1 -0
  127. package/support/components/content.js +282 -0
  128. package/support/components/content.js.map +1 -0
  129. package/support/components/conversation-button-link.js +1 -1
  130. package/support/components/conversation-timeline.d.ts +5 -0
  131. package/support/components/conversation-timeline.d.ts.map +1 -1
  132. package/support/components/conversation-timeline.js +25 -5
  133. package/support/components/conversation-timeline.js.map +1 -1
  134. package/support/components/header.js +1 -1
  135. package/support/components/image-lightbox.d.ts +49 -0
  136. package/support/components/image-lightbox.d.ts.map +1 -0
  137. package/support/components/image-lightbox.js +142 -0
  138. package/support/components/image-lightbox.js.map +1 -0
  139. package/support/components/index.d.ts +5 -4
  140. package/support/components/index.js +4 -4
  141. package/support/components/multimodal-input.d.ts +4 -1
  142. package/support/components/multimodal-input.d.ts.map +1 -1
  143. package/support/components/multimodal-input.js +71 -45
  144. package/support/components/multimodal-input.js.map +1 -1
  145. package/support/components/navigation-tab.js +1 -1
  146. package/support/components/root.d.ts +23 -0
  147. package/support/components/root.d.ts.map +1 -0
  148. package/support/components/root.js +36 -0
  149. package/support/components/root.js.map +1 -0
  150. package/support/components/timeline-message-item.d.ts.map +1 -1
  151. package/support/components/timeline-message-item.js +82 -18
  152. package/support/components/timeline-message-item.js.map +1 -1
  153. package/support/components/trigger.d.ts +14 -0
  154. package/support/components/trigger.d.ts.map +1 -0
  155. package/support/components/{bubble.js → trigger.js} +16 -12
  156. package/support/components/trigger.js.map +1 -0
  157. package/support/components/typing-indicator.d.ts.map +1 -1
  158. package/support/components/typing-indicator.js +1 -0
  159. package/support/components/typing-indicator.js.map +1 -1
  160. package/support/context/controlled-state.d.ts +46 -0
  161. package/support/context/controlled-state.d.ts.map +1 -0
  162. package/support/context/controlled-state.js +34 -0
  163. package/support/context/controlled-state.js.map +1 -0
  164. package/support/context/events.d.ts +103 -0
  165. package/support/context/events.d.ts.map +1 -0
  166. package/support/context/events.js +139 -0
  167. package/support/context/events.js.map +1 -0
  168. package/support/context/handle.d.ts +90 -0
  169. package/support/context/handle.d.ts.map +1 -0
  170. package/support/context/handle.js +79 -0
  171. package/support/context/handle.js.map +1 -0
  172. package/support/context/positioning.d.ts +17 -0
  173. package/support/context/positioning.d.ts.map +1 -0
  174. package/support/context/positioning.js +26 -0
  175. package/support/context/positioning.js.map +1 -0
  176. package/support/context/slots.d.ts +85 -0
  177. package/support/context/slots.d.ts.map +1 -0
  178. package/support/context/slots.js +115 -0
  179. package/support/context/slots.js.map +1 -0
  180. package/support/context/websocket.d.ts +8 -1
  181. package/support/context/websocket.d.ts.map +1 -1
  182. package/support/context/websocket.js +8 -1
  183. package/support/context/websocket.js.map +1 -1
  184. package/support/index.d.ts +239 -54
  185. package/support/index.d.ts.map +1 -1
  186. package/support/index.js +254 -33
  187. package/support/index.js.map +1 -1
  188. package/support/pages/articles.d.ts.map +1 -1
  189. package/support/pages/articles.js +3 -4
  190. package/support/pages/articles.js.map +1 -1
  191. package/support/pages/conversation-history.js +2 -2
  192. package/support/pages/conversation.js +6 -5
  193. package/support/pages/conversation.js.map +1 -1
  194. package/support/pages/home.js +2 -2
  195. package/support/router.d.ts +52 -12
  196. package/support/router.d.ts.map +1 -1
  197. package/support/router.js +78 -30
  198. package/support/router.js.map +1 -1
  199. package/support/store/index.d.ts +2 -2
  200. package/support/store/support-store.d.ts +26 -20
  201. package/support/store/support-store.d.ts.map +1 -1
  202. package/support/store/support-store.js +47 -6
  203. package/support/store/support-store.js.map +1 -1
  204. package/support/{support-D2EgfIts.css → support-C7Xaw-N6.css} +1 -2
  205. package/support/support-C7Xaw-N6.css.map +1 -0
  206. package/support/text/index.d.ts +1 -1
  207. package/support/text/index.d.ts.map +1 -1
  208. package/support/text/index.js.map +1 -1
  209. package/support/types.d.ts +75 -12
  210. package/support/types.d.ts.map +1 -1
  211. package/support.css +2 -2
  212. package/tailwind.css +0 -1
  213. package/timeline-item.d.ts +68 -2
  214. package/timeline-item.d.ts.map +1 -1
  215. package/to-json-schema.d.ts +96 -0
  216. package/to-json-schema.d.ts.map +1 -0
  217. package/util.d.ts +6 -2
  218. package/util.d.ts.map +1 -1
  219. package/utils/index.d.ts +2 -1
  220. package/utils/index.js +2 -1
  221. package/utils/merge-refs.d.ts +30 -0
  222. package/utils/merge-refs.d.ts.map +1 -0
  223. package/utils/merge-refs.js +46 -0
  224. package/utils/merge-refs.js.map +1 -0
  225. package/utils/use-render-element.d.ts.map +1 -1
  226. package/utils/use-render-element.js +36 -8
  227. package/utils/use-render-element.js.map +1 -1
  228. package/versions.d.ts +2 -2
  229. package/versions.d.ts.map +1 -1
  230. package/zod-extensions.d.ts +1 -1
  231. package/zod-extensions.d.ts.map +1 -1
  232. package/primitives/bubble.d.ts +0 -38
  233. package/primitives/bubble.d.ts.map +0 -1
  234. package/primitives/bubble.js +0 -57
  235. package/primitives/bubble.js.map +0 -1
  236. package/support/components/bubble.d.ts +0 -10
  237. package/support/components/bubble.d.ts.map +0 -1
  238. package/support/components/bubble.js.map +0 -1
  239. package/support/components/container.d.ts +0 -13
  240. package/support/components/container.d.ts.map +0 -1
  241. package/support/components/container.js +0 -109
  242. package/support/components/container.js.map +0 -1
  243. package/support/components/support-content.d.ts +0 -22
  244. package/support/components/support-content.d.ts.map +0 -1
  245. package/support/components/support-content.js +0 -48
  246. package/support/components/support-content.js.map +0 -1
  247. package/support/support-D2EgfIts.css.map +0 -1
@@ -1,30 +1,55 @@
1
- //#region ../../node_modules/.bun/zod@4.1.12/node_modules/zod/v4/core/standard-schema.d.cts
2
- /** The Standard Schema interface. */
3
- interface StandardSchemaV1<Input = unknown, Output = Input> {
4
- /** The Standard Schema properties. */
5
- readonly "~standard": StandardSchemaV1.Props<Input, Output>;
1
+ //#region ../../node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/standard-schema.d.cts
2
+ /** The Standard interface. */
3
+ interface StandardTypedV1<Input = unknown, Output = Input> {
4
+ /** The Standard properties. */
5
+ readonly "~standard": StandardTypedV1.Props<Input, Output>;
6
6
  }
7
- declare namespace StandardSchemaV1 {
8
- /** The Standard Schema properties interface. */
7
+ declare namespace StandardTypedV1 {
8
+ /** The Standard properties interface. */
9
9
  interface Props<Input = unknown, Output = Input> {
10
10
  /** The version number of the standard. */
11
11
  readonly version: 1;
12
12
  /** The vendor name of the schema library. */
13
13
  readonly vendor: string;
14
- /** Validates unknown input values. */
15
- readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
16
14
  /** Inferred types associated with the schema. */
17
15
  readonly types?: Types<Input, Output> | undefined;
18
16
  }
17
+ /** The Standard types interface. */
18
+ interface Types<Input = unknown, Output = Input> {
19
+ /** The input type of the schema. */
20
+ readonly input: Input;
21
+ /** The output type of the schema. */
22
+ readonly output: Output;
23
+ }
24
+ /** Infers the input type of a Standard. */
25
+ type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["input"];
26
+ /** Infers the output type of a Standard. */
27
+ type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["output"];
28
+ }
29
+ /** The Standard Schema interface. */
30
+ interface StandardSchemaV1<Input = unknown, Output = Input> {
31
+ /** The Standard Schema properties. */
32
+ readonly "~standard": StandardSchemaV1.Props<Input, Output>;
33
+ }
34
+ declare namespace StandardSchemaV1 {
35
+ /** The Standard Schema properties interface. */
36
+ interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
37
+ /** Validates unknown input values. */
38
+ readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
39
+ }
19
40
  /** The result interface of the validate function. */
20
41
  type Result<Output> = SuccessResult<Output> | FailureResult;
21
42
  /** The result interface if validation succeeds. */
22
43
  interface SuccessResult<Output> {
23
44
  /** The typed output value. */
24
45
  readonly value: Output;
25
- /** The non-existent issues. */
46
+ /** The absence of issues indicates success. */
26
47
  readonly issues?: undefined;
27
48
  }
49
+ interface Options {
50
+ /** Implicit support for additional vendor-specific parameters, if needed. */
51
+ readonly libraryOptions?: Record<string, unknown> | undefined;
52
+ }
28
53
  /** The result interface if validation fails. */
29
54
  interface FailureResult {
30
55
  /** The issues of failed validation. */
@@ -42,18 +67,55 @@ declare namespace StandardSchemaV1 {
42
67
  /** The key representing a path segment. */
43
68
  readonly key: PropertyKey;
44
69
  }
45
- /** The Standard Schema types interface. */
46
- interface Types<Input = unknown, Output = Input> {
47
- /** The input type of the schema. */
48
- readonly input: Input;
49
- /** The output type of the schema. */
50
- readonly output: Output;
70
+ /** The Standard types interface. */
71
+ interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {}
72
+ /** Infers the input type of a Standard. */
73
+ type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
74
+ /** Infers the output type of a Standard. */
75
+ type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
76
+ }
77
+ /** The Standard JSON Schema interface. */
78
+ interface StandardJSONSchemaV1<Input = unknown, Output = Input> {
79
+ /** The Standard JSON Schema properties. */
80
+ readonly "~standard": StandardJSONSchemaV1.Props<Input, Output>;
81
+ }
82
+ declare namespace StandardJSONSchemaV1 {
83
+ /** The Standard JSON Schema properties interface. */
84
+ interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
85
+ /** Methods for generating the input/output JSON Schema. */
86
+ readonly jsonSchema: Converter;
87
+ }
88
+ /** The Standard JSON Schema converter interface. */
89
+ interface Converter {
90
+ /** Converts the input type to JSON Schema. May throw if conversion is not supported. */
91
+ readonly input: (options: StandardJSONSchemaV1.Options) => Record<string, unknown>;
92
+ /** Converts the output type to JSON Schema. May throw if conversion is not supported. */
93
+ readonly output: (options: StandardJSONSchemaV1.Options) => Record<string, unknown>;
94
+ }
95
+ /** The target version of the generated JSON Schema.
96
+ *
97
+ * It is *strongly recommended* that implementers support `"draft-2020-12"` and `"draft-07"`, as they are both in wide use.
98
+ *
99
+ * The `"openapi-3.0"` target is intended as a standardized specifier for OpenAPI 3.0 which is a superset of JSON Schema `"draft-04"`.
100
+ *
101
+ * All other targets can be implemented on a best-effort basis. Libraries should throw if they don't support a specified target.
102
+ */
103
+ type Target = "draft-2020-12" | "draft-07" | "openapi-3.0" | ({} & string);
104
+ /** The options for the input/output methods. */
105
+ interface Options {
106
+ /** Specifies the target version of the generated JSON Schema. Support for all versions is on a best-effort basis. If a given version is not supported, the library should throw. */
107
+ readonly target: Target;
108
+ /** Implicit support for additional vendor-specific parameters, if needed. */
109
+ readonly libraryOptions?: Record<string, unknown> | undefined;
51
110
  }
52
- /** Infers the input type of a Standard Schema. */
53
- type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
54
- /** Infers the output type of a Standard Schema. */
55
- type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
111
+ /** The Standard types interface. */
112
+ interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {}
113
+ /** Infers the input type of a Standard. */
114
+ type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
115
+ /** Infers the output type of a Standard. */
116
+ type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
56
117
  }
118
+ interface StandardSchemaWithJSONProps<Input = unknown, Output = Input> extends StandardSchemaV1.Props<Input, Output>, StandardJSONSchemaV1.Props<Input, Output> {}
57
119
  //#endregion
58
- export { StandardSchemaV1 };
120
+ export { StandardSchemaV1, StandardSchemaWithJSONProps };
59
121
  //# sourceMappingURL=standard-schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"standard-schema.d.ts","names":["StandardSchemaV1","Input","Output","Props","Schema","Result","Promise","Types","SuccessResult","FailureResult","Issue","ReadonlyArray","PropertyKey","PathSegment","NonNullable"],"sources":["../../../node_modules/.bun/zod@4.1.12/node_modules/zod/v4/core/standard-schema.d.cts"],"sourcesContent":["/** The Standard Schema interface. */\nexport interface StandardSchemaV1<Input = unknown, Output = Input> {\n /** The Standard Schema properties. */\n readonly \"~standard\": StandardSchemaV1.Props<Input, Output>;\n}\nexport declare namespace StandardSchemaV1 {\n /** The Standard Schema properties interface. */\n interface Props<Input = unknown, Output = Input> {\n /** The version number of the standard. */\n readonly version: 1;\n /** The vendor name of the schema library. */\n readonly vendor: string;\n /** Validates unknown input values. */\n readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;\n /** Inferred types associated with the schema. */\n readonly types?: Types<Input, Output> | undefined;\n }\n /** The result interface of the validate function. */\n type Result<Output> = SuccessResult<Output> | FailureResult;\n /** The result interface if validation succeeds. */\n interface SuccessResult<Output> {\n /** The typed output value. */\n readonly value: Output;\n /** The non-existent issues. */\n readonly issues?: undefined;\n }\n /** The result interface if validation fails. */\n interface FailureResult {\n /** The issues of failed validation. */\n readonly issues: ReadonlyArray<Issue>;\n }\n /** The issue interface of the failure output. */\n interface Issue {\n /** The error message of the issue. */\n readonly message: string;\n /** The path of the issue, if any. */\n readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;\n }\n /** The path segment interface of the issue. */\n interface PathSegment {\n /** The key representing a path segment. */\n readonly key: PropertyKey;\n }\n /** The Standard Schema types interface. */\n interface Types<Input = unknown, Output = Input> {\n /** The input type of the schema. */\n readonly input: Input;\n /** The output type of the schema. */\n readonly output: Output;\n }\n /** Infers the input type of a Standard Schema. */\n type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema[\"~standard\"][\"types\"]>[\"input\"];\n /** Infers the output type of a Standard Schema. */\n type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema[\"~standard\"][\"types\"]>[\"output\"];\n}\n"],"x_google_ignoreList":[0],"mappings":";;AACiBA,UAAAA,gBAAgBC,CAAAA,QAAAC,OAAA,EAAA,SAA2BD,KAA3B,CAAA,CAAA;EAA2BA;EAEXA,SAAAA,WAAAA,EAAvBD,gBAAAA,CAAiBG,KAAMF,CAAAA,KAAAA,EAAOC,MAAPD,CAAAA;;AAAvBD,kBAEDA,gBAAAA,CAFkBG;EAAK;EAEvBH,UAAAA,KAAAA,CAAAA,QAAgB,OAAAC,EAAAA,SAEKA,KAFLG,CAAAA,CAAAA;IAEKH;IAMQC,SAAAA,OAAAA,EAAAA,CAAAA;IAAPG;IAAgCH,SAAAA,MAAAA,EAAAA,MAAAA;IAAPG;IAARC,SAAAA,QAAAA,EAAAA,CAAAA,KAAAA,EAAAA,OAAAA,EAAAA,GAAjBD,MAAiBC,CAAVJ,MAAUI,CAAAA,GAAAA,OAAAA,CAAQD,MAARC,CAAeJ,MAAfI,CAAAA,CAAAA;IAEjCL;IAAOC,SAAAA,KAAAA,CAAAA,EAAbK,KAAaL,CAAPD,KAAOC,EAAAA,MAAAA,CAAAA,GAAAA,SAAAA;EAAbK;EAGeL;EAAdM,KAAAA,MAAAA,CAAAA,MAAAA,CAAAA,GAAAA,aAAAA,CAAcN,MAAdM,CAAAA,GAAwBC,aAAxBD;EAAwBC;EAI1BP,UAAAA,aAAAA,CAAAA,MAAAA,CAAAA,CAAAA;IAOeQ;IAAdC,SAAAA,KAAAA,EAPDT,MAOCS;IAOaC;IAAcC,SAAAA,MAAAA,CAAAA,EAAAA,SAAAA;EAA5BF;EAKFC;EAGwBX,UAAAA,aAAAA,CAAAA;IAEtBA;IAECC,SAAAA,MAAAA,EAnBAS,aAmBAT,CAnBcQ,KAmBdR,CAAAA;EAGUF;EAAgCI;EAAZU,UAAAA,KAAAA,CAAAA;IAEnBd;IAAgCI,SAAAA,OAAAA,EAAAA,MAAAA;IAAZU;IAAW,SAAA,IAAA,CAAA,EAjB3CH,aAiB2C,CAjB7BC,WAiB6B,GAjBfC,WAiBe,CAAA,GAAA,SAAA;;;;;kBAZ7CD;;;4CAGwBX;;oBAEtBA;;qBAECC;;;iCAGUF,oBAAoBc,YAAYV;;kCAE/BJ,oBAAoBc,YAAYV"}
1
+ {"version":3,"file":"standard-schema.d.ts","names":["StandardTypedV1","Input","Output","Props","Schema","Types","NonNullable","StandardSchemaV1","Options","Result","Promise","SuccessResult","FailureResult","Record","Issue","ReadonlyArray","PropertyKey","PathSegment","InferInput","InferOutput","StandardJSONSchemaV1","Converter","Target","StandardSchemaWithJSONProps","StandardSchemaWithJSON"],"sources":["../../../node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/standard-schema.d.cts"],"sourcesContent":["/** The Standard interface. */\nexport interface StandardTypedV1<Input = unknown, Output = Input> {\n /** The Standard properties. */\n readonly \"~standard\": StandardTypedV1.Props<Input, Output>;\n}\nexport declare namespace StandardTypedV1 {\n /** The Standard properties interface. */\n interface Props<Input = unknown, Output = Input> {\n /** The version number of the standard. */\n readonly version: 1;\n /** The vendor name of the schema library. */\n readonly vendor: string;\n /** Inferred types associated with the schema. */\n readonly types?: Types<Input, Output> | undefined;\n }\n /** The Standard types interface. */\n interface Types<Input = unknown, Output = Input> {\n /** The input type of the schema. */\n readonly input: Input;\n /** The output type of the schema. */\n readonly output: Output;\n }\n /** Infers the input type of a Standard. */\n type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema[\"~standard\"][\"types\"]>[\"input\"];\n /** Infers the output type of a Standard. */\n type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema[\"~standard\"][\"types\"]>[\"output\"];\n}\n/** The Standard Schema interface. */\nexport interface StandardSchemaV1<Input = unknown, Output = Input> {\n /** The Standard Schema properties. */\n readonly \"~standard\": StandardSchemaV1.Props<Input, Output>;\n}\nexport declare namespace StandardSchemaV1 {\n /** The Standard Schema properties interface. */\n interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {\n /** Validates unknown input values. */\n readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;\n }\n /** The result interface of the validate function. */\n type Result<Output> = SuccessResult<Output> | FailureResult;\n /** The result interface if validation succeeds. */\n interface SuccessResult<Output> {\n /** The typed output value. */\n readonly value: Output;\n /** The absence of issues indicates success. */\n readonly issues?: undefined;\n }\n interface Options {\n /** Implicit support for additional vendor-specific parameters, if needed. */\n readonly libraryOptions?: Record<string, unknown> | undefined;\n }\n /** The result interface if validation fails. */\n interface FailureResult {\n /** The issues of failed validation. */\n readonly issues: ReadonlyArray<Issue>;\n }\n /** The issue interface of the failure output. */\n interface Issue {\n /** The error message of the issue. */\n readonly message: string;\n /** The path of the issue, if any. */\n readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;\n }\n /** The path segment interface of the issue. */\n interface PathSegment {\n /** The key representing a path segment. */\n readonly key: PropertyKey;\n }\n /** The Standard types interface. */\n interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {\n }\n /** Infers the input type of a Standard. */\n type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;\n /** Infers the output type of a Standard. */\n type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;\n}\n/** The Standard JSON Schema interface. */\nexport interface StandardJSONSchemaV1<Input = unknown, Output = Input> {\n /** The Standard JSON Schema properties. */\n readonly \"~standard\": StandardJSONSchemaV1.Props<Input, Output>;\n}\nexport declare namespace StandardJSONSchemaV1 {\n /** The Standard JSON Schema properties interface. */\n interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {\n /** Methods for generating the input/output JSON Schema. */\n readonly jsonSchema: Converter;\n }\n /** The Standard JSON Schema converter interface. */\n interface Converter {\n /** Converts the input type to JSON Schema. May throw if conversion is not supported. */\n readonly input: (options: StandardJSONSchemaV1.Options) => Record<string, unknown>;\n /** Converts the output type to JSON Schema. May throw if conversion is not supported. */\n readonly output: (options: StandardJSONSchemaV1.Options) => Record<string, unknown>;\n }\n /** The target version of the generated JSON Schema.\n *\n * It is *strongly recommended* that implementers support `\"draft-2020-12\"` and `\"draft-07\"`, as they are both in wide use.\n *\n * The `\"openapi-3.0\"` target is intended as a standardized specifier for OpenAPI 3.0 which is a superset of JSON Schema `\"draft-04\"`.\n *\n * All other targets can be implemented on a best-effort basis. Libraries should throw if they don't support a specified target.\n */\n type Target = \"draft-2020-12\" | \"draft-07\" | \"openapi-3.0\" | ({} & string);\n /** The options for the input/output methods. */\n interface Options {\n /** Specifies the target version of the generated JSON Schema. Support for all versions is on a best-effort basis. If a given version is not supported, the library should throw. */\n readonly target: Target;\n /** Implicit support for additional vendor-specific parameters, if needed. */\n readonly libraryOptions?: Record<string, unknown> | undefined;\n }\n /** The Standard types interface. */\n interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {\n }\n /** Infers the input type of a Standard. */\n type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;\n /** Infers the output type of a Standard. */\n type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;\n}\nexport interface StandardSchemaWithJSONProps<Input = unknown, Output = Input> extends StandardSchemaV1.Props<Input, Output>, StandardJSONSchemaV1.Props<Input, Output> {\n}\n/**\n * An interface that combines StandardJSONSchema and StandardSchema.\n */\nexport interface StandardSchemaWithJSON<Input = unknown, Output = Input> {\n \"~standard\": StandardSchemaWithJSONProps<Input, Output>;\n}\n"],"x_google_ignoreList":[0],"mappings":";;AACiBA,UAAAA,eAAeC,CAAAA,QAAAC,OAAA,EAAA,SAA2BD,KAA3B,CAAA,CAAA;EAA2BA;EAEXA,SAAAA,WAAAA,EAAtBD,eAAAA,CAAgBG,KAAMF,CAAAA,KAAAA,EAAOC,MAAPD,CAAAA;;AAAtBD,kBAEDA,eAAAA,CAFiBG;EAAK;EAEtBH,UAAAA,KAAAA,CAAAA,QAAe,OAAAC,EAAAC,SAEMD,KAFNG,CAAAA,CAAAA;IAEMH;IAMfA,SAAAA,OAAAA,EAAAA,CAAAA;IAAOC;IAAbG,SAAAA,MAAAA,EAAAA,MAAAA;IAGqBJ;IAEtBA,SAAAA,KAAAA,CAAAA,EALCI,KAKDJ,CALOA,KAKPA,EALcC,MAKdD,CAAAA,GAAAA,SAAAA;EAECC;EAGUF;EAA+BI,UAAAA,KAAAA,CAAAA,QAAAA,OAAAA,EAAAA,SAPpBH,KAOoBG,CAAAA,CAAAA;IAAZE;IAElBN,SAAAA,KAAAA,EAPZC,KAO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oBAAAA,CA8BiElB;EAA7BF;EAG1BA,UAAAA,KAAAA,CAAAA,QAAAA,OAAAA,EAAAA,SA/BWC,KA+BXD,CAAAA,SA/B0BA,eAAAA,CAAgBG,KA+B1CH,CA/BgDC,KA+BhDD,EA/BuDE,MA+BvDF,CAAAA,CAAAA;IAA8CI;IAA3BJ,SAAgBkB,UAAAA,EA7BzCG,SA6ByCH;EAElClB;EAA+CI;EAA5BJ,UAAAA,SAAgBmB,CAAAA;IAAW;IAEjEI,SAAAA,KAAAA,EAAAA,CAAAA,OAAAA,EA5BiBH,oBAAAA,CAAqBZ,OA4BX,EAAA,GA5BuBK,MA4BvB,CAAA,MAAA,EAAA,OAAA,CAAA;IAA2BZ;IAAsCA,SAAAA,MAAAA,EAAAA,CAAAA,OAAAA,EA1B1EmB,oBAAAA,CAAqBZ,OA0BqDP,EAAAA,GA1BzCY,MA0ByCZ,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA;EAAOC;EAAoCD;;;;;;;;;;;;qBAZ/HqB;;8BAEST;;;4CAGYZ,eAAeD,eAAAA,CAAgBK,MAAMJ,OAAOC;;iCAGvDF,mBAAmBA,eAAAA,CAAgBkB,WAAWd;;kCAE7CJ,mBAAmBA,eAAAA,CAAgBmB,YAAYf;;UAElEmB,sDAAsDtB,eAAeM,gBAAAA,CAAiBJ,MAAMF,OAAOC,SAASkB,oBAAAA,CAAqBjB,MAAMF,OAAOC"}
@@ -4,7 +4,7 @@ import * as class_variance_authority_dist_types0 from "class-variance-authority/
4
4
 
5
5
  //#region src/support/components/button.d.ts
6
6
  declare const coButtonVariants: (props?: ({
7
- variant?: "default" | "tab" | "secondary" | "ghost" | "outline" | "tab-selected" | null | undefined;
7
+ variant?: "tab" | "default" | "secondary" | "ghost" | "outline" | "tab-selected" | null | undefined;
8
8
  size?: "default" | "large" | "icon" | null | undefined;
9
9
  } & class_variance_authority_dist_types0.ClassProp) | undefined) => string;
10
10
  type CossistantButtonProps = React$1.ComponentProps<"button"> & VariantProps<typeof coButtonVariants>;
@@ -0,0 +1,30 @@
1
+ import { CollisionPadding, ContentProps } from "../types.js";
2
+ import * as React$1 from "react";
3
+
4
+ //#region src/support/components/content.d.ts
5
+
6
+ /**
7
+ * Content component for the support window.
8
+ * Uses Floating UI for automatic collision detection on desktop.
9
+ * Fullscreen on mobile, floating on desktop.
10
+ *
11
+ * @example
12
+ * // Basic usage (uses defaults: side="top", align="end")
13
+ * <Support.Content />
14
+ *
15
+ * @example
16
+ * // Custom positioning with collision avoidance
17
+ * <Support.Content side="bottom" align="start" sideOffset={24} />
18
+ *
19
+ * @example
20
+ * // Disable collision avoidance for static positioning
21
+ * <Support.Content avoidCollisions={false} />
22
+ *
23
+ * @example
24
+ * // Custom collision padding
25
+ * <Support.Content collisionPadding={{ top: 16, bottom: 32 }} />
26
+ */
27
+ declare const Content: React$1.FC<ContentProps>;
28
+ //#endregion
29
+ export { type CollisionPadding, Content, type ContentProps };
30
+ //# sourceMappingURL=content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content.d.ts","names":[],"sources":["../../../src/support/components/content.tsx"],"sourcesContent":[],"mappings":";;;;;;AAkJA;;;;;;;;;;;;;;;;;;;;cAAa,SAAS,OAAA,CAAM,GAAG"}
@@ -0,0 +1,282 @@
1
+ "use client";
2
+
3
+
4
+ import { cn } from "../utils/index.js";
5
+ import { useTriggerRef } from "../context/positioning.js";
6
+ import { useSupportConfig } from "../store/support-store.js";
7
+ import { SupportWindow } from "../../primitives/window.js";
8
+ import { SlotProvider, useSlots } from "../context/slots.js";
9
+ import * as React$1 from "react";
10
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
+ import { autoUpdate, flip, offset, shift, useFloating } from "@floating-ui/react";
12
+ import { AnimatePresence, motion } from "motion/react";
13
+
14
+ //#region src/support/components/content.tsx
15
+ /**
16
+ * Convert side + align props to Floating UI placement
17
+ */
18
+ function getPlacement(side, align) {
19
+ if (align === "center") return side;
20
+ return `${side}-${align}`;
21
+ }
22
+ /**
23
+ * Get fallback positioning classes for when Floating UI is not available
24
+ * (e.g., trigger ref not set, or avoidCollisions is false)
25
+ */
26
+ function getFallbackPositioningClasses(side, align) {
27
+ return cn({
28
+ top: "md:bottom-full md:mb-4",
29
+ bottom: "md:top-full md:mt-4",
30
+ left: "md:right-full md:mr-4",
31
+ right: "md:left-full md:ml-4"
32
+ }[side], {
33
+ top: {
34
+ start: "md:left-0",
35
+ center: "md:left-1/2 md:-translate-x-1/2",
36
+ end: "md:right-0"
37
+ },
38
+ bottom: {
39
+ start: "md:left-0",
40
+ center: "md:left-1/2 md:-translate-x-1/2",
41
+ end: "md:right-0"
42
+ },
43
+ left: {
44
+ start: "md:top-0",
45
+ center: "md:top-1/2 md:-translate-y-1/2",
46
+ end: "md:bottom-0"
47
+ },
48
+ right: {
49
+ start: "md:top-0",
50
+ center: "md:top-1/2 md:-translate-y-1/2",
51
+ end: "md:bottom-0"
52
+ }
53
+ }[side][align]);
54
+ }
55
+ /**
56
+ * Get fallback offset styles for static positioning
57
+ */
58
+ function getFallbackOffsetStyle(side, sideOffset) {
59
+ if (sideOffset === 16) return;
60
+ return {
61
+ top: { marginBottom: sideOffset },
62
+ bottom: { marginTop: sideOffset },
63
+ left: { marginRight: sideOffset },
64
+ right: { marginLeft: sideOffset }
65
+ }[side];
66
+ }
67
+ function useIsMobile() {
68
+ const [isMobile, setIsMobile] = React$1.useState(false);
69
+ React$1.useEffect(() => {
70
+ const mediaQuery = window.matchMedia("(max-width: 767px)");
71
+ setIsMobile(mediaQuery.matches);
72
+ const handler = (event) => {
73
+ setIsMobile(event.matches);
74
+ };
75
+ mediaQuery.addEventListener("change", handler);
76
+ return () => mediaQuery.removeEventListener("change", handler);
77
+ }, []);
78
+ return isMobile;
79
+ }
80
+ /**
81
+ * Content component for the support window.
82
+ * Uses Floating UI for automatic collision detection on desktop.
83
+ * Fullscreen on mobile, floating on desktop.
84
+ *
85
+ * @example
86
+ * // Basic usage (uses defaults: side="top", align="end")
87
+ * <Support.Content />
88
+ *
89
+ * @example
90
+ * // Custom positioning with collision avoidance
91
+ * <Support.Content side="bottom" align="start" sideOffset={24} />
92
+ *
93
+ * @example
94
+ * // Disable collision avoidance for static positioning
95
+ * <Support.Content avoidCollisions={false} />
96
+ *
97
+ * @example
98
+ * // Custom collision padding
99
+ * <Support.Content collisionPadding={{ top: 16, bottom: 32 }} />
100
+ */
101
+ const Content = ({ className, children, side = "top", align = "end", sideOffset = 16, avoidCollisions = true, collisionPadding = 8 }) => {
102
+ const [showScrollIndicator, setShowScrollIndicator] = React$1.useState(false);
103
+ const containerRef = React$1.useRef(null);
104
+ const hasEverPositionedRef = React$1.useRef(false);
105
+ const isMobile = useIsMobile();
106
+ const triggerRefContext = useTriggerRef();
107
+ const { isOpen } = useSupportConfig();
108
+ const middleware = React$1.useMemo(() => {
109
+ const middlewares = [offset(sideOffset)];
110
+ if (avoidCollisions) middlewares.push(flip({
111
+ padding: collisionPadding,
112
+ fallbackAxisSideDirection: "start"
113
+ }), shift({ padding: collisionPadding }));
114
+ return middlewares;
115
+ }, [
116
+ sideOffset,
117
+ avoidCollisions,
118
+ collisionPadding
119
+ ]);
120
+ const triggerElement = triggerRefContext?.triggerElement ?? null;
121
+ const { refs, update, x, y, isPositioned } = useFloating({
122
+ placement: getPlacement(side, align),
123
+ strategy: "fixed",
124
+ middleware,
125
+ whileElementsMounted: autoUpdate,
126
+ open: isOpen,
127
+ elements: { reference: triggerElement }
128
+ });
129
+ const setFloatingRef = React$1.useCallback((node) => {
130
+ refs.setFloating(node);
131
+ }, [refs]);
132
+ React$1.useEffect(() => {
133
+ if (triggerElement && isOpen) requestAnimationFrame(() => {
134
+ update();
135
+ });
136
+ }, [
137
+ triggerElement,
138
+ isOpen,
139
+ update
140
+ ]);
141
+ const useFloatingPositioning = avoidCollisions && !isMobile && triggerElement !== null;
142
+ const checkScroll = React$1.useCallback(() => {
143
+ const container = containerRef.current;
144
+ if (!container) return;
145
+ const { scrollTop, scrollHeight, clientHeight } = container;
146
+ const isScrollable = scrollHeight > clientHeight;
147
+ const isAtBottom = Math.abs(scrollHeight - scrollTop - clientHeight) < 5;
148
+ setShowScrollIndicator(isScrollable && !isAtBottom);
149
+ }, []);
150
+ React$1.useEffect(() => {
151
+ const container = containerRef.current;
152
+ if (!container) return;
153
+ checkScroll();
154
+ const handleScroll = () => {
155
+ checkScroll();
156
+ };
157
+ container.addEventListener("scroll", handleScroll, { passive: true });
158
+ const resizeObserver = new ResizeObserver(() => {
159
+ checkScroll();
160
+ });
161
+ resizeObserver.observe(container);
162
+ const mutationObserver = new MutationObserver(() => {
163
+ checkScroll();
164
+ });
165
+ mutationObserver.observe(container, {
166
+ childList: true,
167
+ subtree: true,
168
+ characterData: true
169
+ });
170
+ return () => {
171
+ container.removeEventListener("scroll", handleScroll);
172
+ resizeObserver.disconnect();
173
+ mutationObserver.disconnect();
174
+ };
175
+ }, [checkScroll]);
176
+ if (isPositioned) hasEverPositionedRef.current = true;
177
+ const hasValidFloatingPosition = hasEverPositionedRef.current;
178
+ const computedStyles = React$1.useMemo(() => {
179
+ if (isMobile) return {};
180
+ if (useFloatingPositioning && hasValidFloatingPosition) return {
181
+ position: "fixed",
182
+ left: x,
183
+ top: y
184
+ };
185
+ return getFallbackOffsetStyle(side, sideOffset) ?? {};
186
+ }, [
187
+ isMobile,
188
+ useFloatingPositioning,
189
+ hasValidFloatingPosition,
190
+ x,
191
+ y,
192
+ side,
193
+ sideOffset
194
+ ]);
195
+ const computedClassName = cn("flex flex-col overflow-hidden overscroll-none bg-co-background", "max-md:fixed max-md:inset-0 max-md:z-[9999]", "md:z-[9999] md:aspect-[9/17] md:max-h-[calc(100vh-6rem)] md:w-[400px] md:rounded-md md:border md:border-co-border md:shadow md:dark:shadow-co-background-600/50", useFloatingPositioning && hasValidFloatingPosition ? "md:fixed" : cn("md:absolute", getFallbackPositioningClasses(side, align)), className);
196
+ return /* @__PURE__ */ jsx(SlotProvider, { children: /* @__PURE__ */ jsx(SupportWindow, {
197
+ asChild: true,
198
+ children: /* @__PURE__ */ jsx(motion.div, {
199
+ animate: "visible",
200
+ className: computedClassName,
201
+ exit: "exit",
202
+ initial: "hidden",
203
+ ref: setFloatingRef,
204
+ style: computedStyles,
205
+ transition: {
206
+ default: { ease: "anticipate" },
207
+ layout: { duration: .3 }
208
+ },
209
+ variants: {
210
+ hidden: {
211
+ opacity: 0,
212
+ scale: .95,
213
+ filter: "blur(6px)"
214
+ },
215
+ visible: {
216
+ opacity: 1,
217
+ scale: 1,
218
+ filter: "blur(0px)"
219
+ },
220
+ exit: {
221
+ opacity: 0,
222
+ scale: .95,
223
+ filter: "blur(6px)"
224
+ }
225
+ },
226
+ children: /* @__PURE__ */ jsx(ContentInner, {
227
+ containerRef,
228
+ showScrollIndicator,
229
+ children
230
+ })
231
+ })
232
+ }) });
233
+ };
234
+ /**
235
+ * Inner content component that consumes slots.
236
+ * Separated to allow slot context to be established before consuming it.
237
+ */
238
+ const ContentInner = ({ children, containerRef, showScrollIndicator }) => {
239
+ const { header, footer, hasCustomHeader, hasCustomFooter } = useSlots();
240
+ return /* @__PURE__ */ jsxs("div", {
241
+ className: "relative flex h-full w-full flex-col",
242
+ children: [
243
+ hasCustomHeader && /* @__PURE__ */ jsx("div", {
244
+ className: "flex-shrink-0",
245
+ children: header
246
+ }),
247
+ /* @__PURE__ */ jsx("div", {
248
+ className: cn("flex flex-1 flex-col overflow-y-auto", !hasCustomHeader && "pt-18"),
249
+ ref: containerRef,
250
+ children
251
+ }),
252
+ hasCustomFooter && /* @__PURE__ */ jsx("div", {
253
+ className: "flex-shrink-0",
254
+ children: footer
255
+ }),
256
+ /* @__PURE__ */ jsx(AnimatePresence, { children: showScrollIndicator && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(motion.div, {
257
+ animate: { opacity: 1 },
258
+ className: "pointer-events-none absolute inset-x-0 bottom-0 z-5 h-32 bg-gradient-to-t from-co-background via-co-background/70 to-transparent",
259
+ exit: { opacity: 0 },
260
+ initial: { opacity: 0 },
261
+ transition: {
262
+ duration: .3,
263
+ ease: "easeInOut"
264
+ }
265
+ }), /* @__PURE__ */ jsx(motion.div, {
266
+ animate: { opacity: .6 },
267
+ className: "pointer-events-none absolute inset-x-0 bottom-0 z-5 h-48 bg-gradient-to-t from-co-background/80 via-co-background/30 to-transparent",
268
+ exit: { opacity: 0 },
269
+ initial: { opacity: 0 },
270
+ transition: {
271
+ duration: .4,
272
+ ease: "easeInOut",
273
+ delay: .05
274
+ }
275
+ })] }) })
276
+ ]
277
+ });
278
+ };
279
+
280
+ //#endregion
281
+ export { Content };
282
+ //# sourceMappingURL=content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content.js","names":["React","Content: React.FC<ContentPropsType>","Primitive.Window","ContentInner: React.FC<{\n\tchildren: React.ReactNode;\n\tcontainerRef: React.RefObject<HTMLDivElement | null>;\n\tshowScrollIndicator: boolean;\n}>"],"sources":["../../../src/support/components/content.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n\tautoUpdate,\n\tflip,\n\toffset,\n\ttype Placement,\n\tshift,\n\tuseFloating,\n} from \"@floating-ui/react\";\nimport { AnimatePresence, motion } from \"motion/react\";\nimport * as React from \"react\";\nimport * as Primitive from \"../../primitives\";\nimport { useTriggerRef } from \"../context/positioning\";\nimport { SlotProvider, useSlots } from \"../context/slots\";\nimport { useSupportConfig } from \"../store/support-store\";\nimport type {\n\tAlign,\n\tCollisionPadding,\n\tContentProps as ContentPropsType,\n\tSide,\n} from \"../types\";\nimport { cn } from \"../utils\";\n\nexport type { CollisionPadding, ContentProps } from \"../types\";\n\n// =============================================================================\n// Utils\n// =============================================================================\n\n/**\n * Convert side + align props to Floating UI placement\n */\nfunction getPlacement(side: Side, align: Align): Placement {\n\tif (align === \"center\") {\n\t\treturn side;\n\t}\n\treturn `${side}-${align}` as Placement;\n}\n\n/**\n * Get fallback positioning classes for when Floating UI is not available\n * (e.g., trigger ref not set, or avoidCollisions is false)\n */\nfunction getFallbackPositioningClasses(side: Side, align: Align): string {\n\tconst sideClasses: Record<Side, string> = {\n\t\ttop: \"md:bottom-full md:mb-4\",\n\t\tbottom: \"md:top-full md:mt-4\",\n\t\tleft: \"md:right-full md:mr-4\",\n\t\tright: \"md:left-full md:ml-4\",\n\t};\n\n\tconst alignClasses: Record<Side, Record<Align, string>> = {\n\t\ttop: {\n\t\t\tstart: \"md:left-0\",\n\t\t\tcenter: \"md:left-1/2 md:-translate-x-1/2\",\n\t\t\tend: \"md:right-0\",\n\t\t},\n\t\tbottom: {\n\t\t\tstart: \"md:left-0\",\n\t\t\tcenter: \"md:left-1/2 md:-translate-x-1/2\",\n\t\t\tend: \"md:right-0\",\n\t\t},\n\t\tleft: {\n\t\t\tstart: \"md:top-0\",\n\t\t\tcenter: \"md:top-1/2 md:-translate-y-1/2\",\n\t\t\tend: \"md:bottom-0\",\n\t\t},\n\t\tright: {\n\t\t\tstart: \"md:top-0\",\n\t\t\tcenter: \"md:top-1/2 md:-translate-y-1/2\",\n\t\t\tend: \"md:bottom-0\",\n\t\t},\n\t};\n\n\treturn cn(sideClasses[side], alignClasses[side][align]);\n}\n\n/**\n * Get fallback offset styles for static positioning\n */\nfunction getFallbackOffsetStyle(\n\tside: Side,\n\tsideOffset: number\n): React.CSSProperties | undefined {\n\tif (sideOffset === 16) {\n\t\treturn;\n\t}\n\n\tconst offsetMap: Record<Side, React.CSSProperties> = {\n\t\ttop: { marginBottom: sideOffset },\n\t\tbottom: { marginTop: sideOffset },\n\t\tleft: { marginRight: sideOffset },\n\t\tright: { marginLeft: sideOffset },\n\t};\n\n\treturn offsetMap[side];\n}\n\n// =============================================================================\n// Hook for responsive detection\n// =============================================================================\n\nfunction useIsMobile(): boolean {\n\tconst [isMobile, setIsMobile] = React.useState(false);\n\n\tReact.useEffect(() => {\n\t\tconst mediaQuery = window.matchMedia(\"(max-width: 767px)\");\n\t\tsetIsMobile(mediaQuery.matches);\n\n\t\tconst handler = (event: MediaQueryListEvent) => {\n\t\t\tsetIsMobile(event.matches);\n\t\t};\n\n\t\tmediaQuery.addEventListener(\"change\", handler);\n\t\treturn () => mediaQuery.removeEventListener(\"change\", handler);\n\t}, []);\n\n\treturn isMobile;\n}\n\n// =============================================================================\n// Content Component\n// =============================================================================\n\n/**\n * Content component for the support window.\n * Uses Floating UI for automatic collision detection on desktop.\n * Fullscreen on mobile, floating on desktop.\n *\n * @example\n * // Basic usage (uses defaults: side=\"top\", align=\"end\")\n * <Support.Content />\n *\n * @example\n * // Custom positioning with collision avoidance\n * <Support.Content side=\"bottom\" align=\"start\" sideOffset={24} />\n *\n * @example\n * // Disable collision avoidance for static positioning\n * <Support.Content avoidCollisions={false} />\n *\n * @example\n * // Custom collision padding\n * <Support.Content collisionPadding={{ top: 16, bottom: 32 }} />\n */\nexport const Content: React.FC<ContentPropsType> = ({\n\tclassName,\n\tchildren,\n\tside = \"top\",\n\talign = \"end\",\n\tsideOffset = 16,\n\tavoidCollisions = true,\n\tcollisionPadding = 8,\n}) => {\n\tconst [showScrollIndicator, setShowScrollIndicator] = React.useState(false);\n\tconst containerRef = React.useRef<HTMLDivElement>(null);\n\tconst hasEverPositionedRef = React.useRef(false);\n\tconst isMobile = useIsMobile();\n\tconst triggerRefContext = useTriggerRef();\n\tconst { isOpen } = useSupportConfig();\n\n\t// Set up Floating UI middleware\n\tconst middleware = React.useMemo(() => {\n\t\tconst middlewares = [offset(sideOffset)];\n\n\t\tif (avoidCollisions) {\n\t\t\tmiddlewares.push(\n\t\t\t\tflip({\n\t\t\t\t\tpadding: collisionPadding,\n\t\t\t\t\tfallbackAxisSideDirection: \"start\",\n\t\t\t\t}),\n\t\t\t\tshift({\n\t\t\t\t\tpadding: collisionPadding,\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\n\t\treturn middlewares;\n\t}, [sideOffset, avoidCollisions, collisionPadding]);\n\n\t// Get trigger element from context (stored in state for reactivity)\n\tconst triggerElement = triggerRefContext?.triggerElement ?? null;\n\n\t// Initialize Floating UI with the trigger element as reference\n\t// Using strategy: 'fixed' because Content uses position: fixed (md:fixed class)\n\t// This ensures Floating UI calculates positions relative to the viewport\n\t// The `open` prop synchronizes Floating UI with visibility state for proper autoUpdate\n\tconst { refs, update, x, y, isPositioned } = useFloating({\n\t\tplacement: getPlacement(side, align),\n\t\tstrategy: \"fixed\",\n\t\tmiddleware,\n\t\twhileElementsMounted: autoUpdate,\n\t\topen: isOpen,\n\t\telements: {\n\t\t\treference: triggerElement,\n\t\t},\n\t});\n\n\t// Merge refs for the floating element - ensures proper ref forwarding with motion.div\n\tconst setFloatingRef = React.useCallback(\n\t\t(node: HTMLDivElement | null) => {\n\t\t\trefs.setFloating(node);\n\t\t},\n\t\t[refs]\n\t);\n\n\t// Force position recalculation when trigger element becomes available\n\t// This handles the case where content mounts before trigger\n\tReact.useEffect(() => {\n\t\tif (triggerElement && isOpen) {\n\t\t\t// Defer update to ensure DOM is ready\n\t\t\trequestAnimationFrame(() => {\n\t\t\t\tupdate();\n\t\t\t});\n\t\t}\n\t}, [triggerElement, isOpen, update]);\n\n\t// Determine if we should use Floating UI positioning\n\t// Only use Floating UI when trigger element is available\n\tconst useFloatingPositioning =\n\t\tavoidCollisions && !isMobile && triggerElement !== null;\n\n\t// Scroll indicator logic\n\tconst checkScroll = React.useCallback(() => {\n\t\tconst container = containerRef.current;\n\t\tif (!container) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { scrollTop, scrollHeight, clientHeight } = container;\n\t\tconst isScrollable = scrollHeight > clientHeight;\n\t\tconst isAtBottom = Math.abs(scrollHeight - scrollTop - clientHeight) < 5;\n\n\t\tsetShowScrollIndicator(isScrollable && !isAtBottom);\n\t}, []);\n\n\tReact.useEffect(() => {\n\t\tconst container = containerRef.current;\n\t\tif (!container) {\n\t\t\treturn;\n\t\t}\n\n\t\tcheckScroll();\n\n\t\tconst handleScroll = () => {\n\t\t\tcheckScroll();\n\t\t};\n\n\t\tcontainer.addEventListener(\"scroll\", handleScroll, { passive: true });\n\n\t\tconst resizeObserver = new ResizeObserver(() => {\n\t\t\tcheckScroll();\n\t\t});\n\n\t\tresizeObserver.observe(container);\n\n\t\tconst mutationObserver = new MutationObserver(() => {\n\t\t\tcheckScroll();\n\t\t});\n\n\t\tmutationObserver.observe(container, {\n\t\t\tchildList: true,\n\t\t\tsubtree: true,\n\t\t\tcharacterData: true,\n\t\t});\n\n\t\treturn () => {\n\t\t\tcontainer.removeEventListener(\"scroll\", handleScroll);\n\t\t\tresizeObserver.disconnect();\n\t\t\tmutationObserver.disconnect();\n\t\t};\n\t}, [checkScroll]);\n\n\t// Track when Floating UI has successfully positioned at least once\n\t// Using a ref to persist across renders - once positioned, always valid\n\t// This avoids the bug where (0,0) was wrongly treated as invalid\n\tif (isPositioned) {\n\t\thasEverPositionedRef.current = true;\n\t}\n\n\t// Check if Floating UI has successfully calculated valid positions\n\t// We use the ref to handle legitimate (0,0) positions correctly\n\tconst hasValidFloatingPosition = hasEverPositionedRef.current;\n\n\t// Compute styles based on positioning mode\n\t// Use raw x, y coordinates from Floating UI when available\n\tconst computedStyles = React.useMemo<React.CSSProperties>(() => {\n\t\tif (isMobile) {\n\t\t\t// Mobile: no positioning styles needed, handled by CSS classes\n\t\t\treturn {};\n\t\t}\n\n\t\tif (useFloatingPositioning && hasValidFloatingPosition) {\n\t\t\t// Desktop with Floating UI: use calculated coordinates\n\t\t\t// Using top/left instead of transform to avoid conflicts with motion animations\n\t\t\treturn {\n\t\t\t\tposition: \"fixed\" as const,\n\t\t\t\tleft: x,\n\t\t\t\ttop: y,\n\t\t\t};\n\t\t}\n\n\t\t// Desktop fallback: use static offset styles when Floating UI isn't ready\n\t\treturn getFallbackOffsetStyle(side, sideOffset) ?? {};\n\t}, [\n\t\tisMobile,\n\t\tuseFloatingPositioning,\n\t\thasValidFloatingPosition,\n\t\tx,\n\t\ty,\n\t\tside,\n\t\tsideOffset,\n\t]);\n\n\t// Compute className based on positioning mode\n\tconst computedClassName = cn(\n\t\t// Common base styles\n\t\t\"flex flex-col overflow-hidden overscroll-none bg-co-background\",\n\n\t\t// Mobile: fullscreen fixed\n\t\t\"max-md:fixed max-md:inset-0 max-md:z-[9999]\",\n\n\t\t// Desktop: floating window base styles\n\t\t\"md:z-[9999] md:aspect-[9/17] md:max-h-[calc(100vh-6rem)] md:w-[400px] md:rounded-md md:border md:border-co-border md:shadow md:dark:shadow-co-background-600/50\",\n\n\t\t// Positioning mode specific styles\n\t\t// Use fixed positioning when Floating UI has valid coordinates,\n\t\t// otherwise use fallback absolute positioning with CSS classes\n\t\tuseFloatingPositioning && hasValidFloatingPosition\n\t\t\t? \"md:fixed\"\n\t\t\t: cn(\"md:absolute\", getFallbackPositioningClasses(side, align)),\n\n\t\tclassName\n\t);\n\n\treturn (\n\t\t<SlotProvider>\n\t\t\t<Primitive.Window asChild>\n\t\t\t\t<motion.div\n\t\t\t\t\tanimate=\"visible\"\n\t\t\t\t\tclassName={computedClassName}\n\t\t\t\t\texit=\"exit\"\n\t\t\t\t\tinitial=\"hidden\"\n\t\t\t\t\tref={setFloatingRef}\n\t\t\t\t\tstyle={computedStyles}\n\t\t\t\t\ttransition={{\n\t\t\t\t\t\tdefault: { ease: \"anticipate\" },\n\t\t\t\t\t\tlayout: { duration: 0.3 },\n\t\t\t\t\t}}\n\t\t\t\t\tvariants={{\n\t\t\t\t\t\thidden: { opacity: 0, scale: 0.95, filter: \"blur(6px)\" },\n\t\t\t\t\t\tvisible: { opacity: 1, scale: 1, filter: \"blur(0px)\" },\n\t\t\t\t\t\texit: { opacity: 0, scale: 0.95, filter: \"blur(6px)\" },\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<ContentInner\n\t\t\t\t\t\tcontainerRef={containerRef}\n\t\t\t\t\t\tshowScrollIndicator={showScrollIndicator}\n\t\t\t\t\t>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</ContentInner>\n\t\t\t\t</motion.div>\n\t\t\t</Primitive.Window>\n\t\t</SlotProvider>\n\t);\n};\n\n/**\n * Inner content component that consumes slots.\n * Separated to allow slot context to be established before consuming it.\n */\nconst ContentInner: React.FC<{\n\tchildren: React.ReactNode;\n\tcontainerRef: React.RefObject<HTMLDivElement | null>;\n\tshowScrollIndicator: boolean;\n}> = ({ children, containerRef, showScrollIndicator }) => {\n\tconst { header, footer, hasCustomHeader, hasCustomFooter } = useSlots();\n\n\treturn (\n\t\t<div className=\"relative flex h-full w-full flex-col\">\n\t\t\t{/* Custom header slot */}\n\t\t\t{hasCustomHeader && <div className=\"flex-shrink-0\">{header}</div>}\n\n\t\t\t<div\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"flex flex-1 flex-col overflow-y-auto\",\n\t\t\t\t\t// Only add top padding if no custom header (default header is absolute positioned)\n\t\t\t\t\t!hasCustomHeader && \"pt-18\"\n\t\t\t\t)}\n\t\t\t\tref={containerRef}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\n\t\t\t{/* Custom footer slot */}\n\t\t\t{hasCustomFooter && <div className=\"flex-shrink-0\">{footer}</div>}\n\n\t\t\t<AnimatePresence>\n\t\t\t\t{showScrollIndicator && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tanimate={{ opacity: 1 }}\n\t\t\t\t\t\t\tclassName=\"pointer-events-none absolute inset-x-0 bottom-0 z-5 h-32 bg-gradient-to-t from-co-background via-co-background/70 to-transparent\"\n\t\t\t\t\t\t\texit={{ opacity: 0 }}\n\t\t\t\t\t\t\tinitial={{ opacity: 0 }}\n\t\t\t\t\t\t\ttransition={{ duration: 0.3, ease: \"easeInOut\" }}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tanimate={{ opacity: 0.6 }}\n\t\t\t\t\t\t\tclassName=\"pointer-events-none absolute inset-x-0 bottom-0 z-5 h-48 bg-gradient-to-t from-co-background/80 via-co-background/30 to-transparent\"\n\t\t\t\t\t\t\texit={{ opacity: 0 }}\n\t\t\t\t\t\t\tinitial={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a;IACtD,MAAM;KAAE,SAAS;KAAG,OAAO;KAAM,QAAQ;KAAa;IACtD;aAED,oBAAC;IACc;IACO;IAEpB;KACa;IACH;GACK,GACL;;;;;;AAQjB,MAAMC,gBAIA,EAAE,UAAU,cAAc,0BAA0B;CACzD,MAAM,EAAE,QAAQ,QAAQ,iBAAiB,oBAAoB,UAAU;AAEvE,QACC,qBAAC;EAAI,WAAU;;GAEb,mBAAmB,oBAAC;IAAI,WAAU;cAAiB;KAAa;GAEjE,oBAAC;IACA,WAAW,GACV,wCAEA,CAAC,mBAAmB,QACpB;IACD,KAAK;IAEJ;KACI;GAGL,mBAAmB,oBAAC;IAAI,WAAU;cAAiB;KAAa;GAEjE,oBAAC,6BACC,uBACA,4CACC,oBAAC,OAAO;IACP,SAAS,EAAE,SAAS,GAAG;IACvB,WAAU;IACV,MAAM,EAAE,SAAS,GAAG;IACpB,SAAS,EAAE,SAAS,GAAG;IACvB,YAAY;KAAE,UAAU;KAAK,MAAM;KAAa;KAC/C,EACF,oBAAC,OAAO;IACP,SAAS,EAAE,SAAS,IAAK;IACzB,WAAU;IACV,MAAM,EAAE,SAAS,GAAG;IACpB,SAAS,EAAE,SAAS,GAAG;IACvB,YAAY;KAAE,UAAU;KAAK,MAAM;KAAa,OAAO;KAAM;KAC5D,IACA,GAEa;;GACb"}
@@ -1,8 +1,8 @@
1
1
  import { cn } from "../utils/index.js";
2
2
  import { Avatar } from "./avatar.js";
3
3
  import { BouncingDots } from "./typing-indicator.js";
4
- import { coButtonVariants } from "./button.js";
5
4
  import icons_default from "./icons.js";
5
+ import { coButtonVariants } from "./button.js";
6
6
  import { useSupportText } from "../text/index.js";
7
7
  import { useConversationPreview } from "../../hooks/use-conversation-preview.js";
8
8
  import { ConversationStatus } from "@cossistant/types";
@@ -1,4 +1,5 @@
1
1
  import { TimelineItem } from "../../timeline-item.js";
2
+ import { DaySeparatorItem } from "../../hooks/private/use-grouped-messages.js";
2
3
  import React from "react";
3
4
  import { AvailableAIAgent, AvailableHumanAgent } from "@cossistant/types";
4
5
 
@@ -19,6 +20,10 @@ type ConversationTimelineProps = {
19
20
  availableHumanAgents: AvailableHumanAgent[];
20
21
  currentVisitorId?: string;
21
22
  tools?: ConversationTimelineTools;
23
+ renderDaySeparator?: (props: {
24
+ item: DaySeparatorItem;
25
+ formatDate: (date: Date) => string;
26
+ }) => React.ReactNode;
22
27
  };
23
28
  declare const ConversationTimelineList: React.FC<ConversationTimelineProps>;
24
29
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"conversation-timeline.d.ts","names":[],"sources":["../../../src/support/components/conversation-timeline.tsx"],"sourcesContent":[],"mappings":";;;;;KAkCY,6BAAA;QACL;EADK,cAAA,EAAA,MAAA;AAKZ,CAAA;AAIY,KAJA,kCAAA,GAMX;EAGW,SAAA,EARA,KAAA,CAAM,aAQmB,CARL,6BAQK,CAAA;CAE7B;AAEY,KATR,yBAAA,GAA4B,MASpB,CAAA,MAAA,EAPnB,kCAOmB,CAAA;AACG,KALX,yBAAA,GAKW;EAEd,cAAA,EAAA,MAAA;EAAyB,KAAA,EAL1B,YAK0B,EAAA;EAGrB,SAAA,CAAA,EAAA,MAAA;qBANO;wBACG;;UAEd;;cAGI,0BAA0B,KAAA,CAAM,GAAG"}
1
+ {"version":3,"file":"conversation-timeline.d.ts","names":[],"sources":["../../../src/support/components/conversation-timeline.tsx"],"sourcesContent":[],"mappings":";;;;;;KAyCY,6BAAA;QACL;EADK,cAAA,EAAA,MAAA;AAKZ,CAAA;AAIY,KAJA,kCAAA,GAMX;EAGW,SAAA,EARA,KAAA,CAAM,aAQmB,CARL,6BAQK,CAAA;CAE7B;AAEY,KATR,yBAAA,GAA4B,MASpB,CAAA,MAAA,EAPnB,kCAOmB,CAAA;AACG,KALX,yBAAA,GAKW;EAEd,cAAA,EAAA,MAAA;EAED,KAAA,EAPA,YAOA,EAAA;EACa,SAAA,CAAA,EAAA,MAAA;EACd,iBAAM,EAPO,gBAOP,EAAA;EAAS,oBAAA,EANC,mBAMD,EAAA;EAGT,gBAAA,CAAA,EAAA,MAAA;UAPJ;;UAED;uBACa;QACd,KAAA,CAAM;;cAGA,0BAA0B,KAAA,CAAM,GAAG"}
@@ -1,12 +1,13 @@
1
1
  import { cn } from "../utils/index.js";
2
2
  import { TypingIndicator } from "./typing-indicator.js";
3
3
  import { ConversationTimeline, ConversationTimelineContainer } from "../../primitives/conversation-timeline.js";
4
- import { useConversationTimeline } from "../../hooks/use-conversation-timeline.js";
4
+ import { DaySeparator, DaySeparatorLabel, DaySeparatorLine, defaultFormatDate } from "../../primitives/day-separator.js";
5
5
  import { useTypingSound } from "../../hooks/use-typing-sound.js";
6
+ import { useConversationTimeline } from "../../hooks/use-conversation-timeline.js";
6
7
  import { ConversationEvent } from "./conversation-event.js";
7
8
  import { TimelineMessageGroup } from "./timeline-message-group.js";
8
9
  import { useCallback, useMemo } from "react";
9
- import { jsx, jsxs } from "react/jsx-runtime";
10
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
11
 
11
12
  //#region src/support/components/conversation-timeline.tsx
12
13
  function extractEventPart(item) {
@@ -15,7 +16,7 @@ function extractEventPart(item) {
15
16
  }
16
17
  const EMPTY_SEEN_BY_IDS = Object.freeze([]);
17
18
  const EMPTY_SEEN_BY_NAMES = Object.freeze([]);
18
- const ConversationTimelineList = ({ conversationId, items: timelineItems, className, availableAIAgents = [], availableHumanAgents = [], currentVisitorId, tools }) => {
19
+ const ConversationTimelineList = ({ conversationId, items: timelineItems, className, availableAIAgents = [], availableHumanAgents = [], currentVisitorId, tools, renderDaySeparator }) => {
19
20
  const timeline = useConversationTimeline({
20
21
  conversationId,
21
22
  items: timelineItems,
@@ -50,12 +51,31 @@ const ConversationTimelineList = ({ conversationId, items: timelineItems, classN
50
51
  }, [seenNameLookup]);
51
52
  return /* @__PURE__ */ jsx(ConversationTimeline, {
52
53
  autoScroll: true,
53
- className: cn("overflow-y-scroll scroll-smooth px-3 py-6", "co-scrollbar-thin", "h-full w-full", className),
54
+ className: cn("overflow-y-scroll px-3 py-6", "co-scrollbar-thin", "h-full w-full", className),
54
55
  id: "conversation-timeline",
55
56
  items: timelineItems,
56
57
  children: /* @__PURE__ */ jsxs(ConversationTimelineContainer, {
57
- className: "flex min-h-full w-full flex-col gap-3",
58
+ className: "flex min-h-full w-full flex-col gap-5",
58
59
  children: [timeline.groupedMessages.items.map((item, index) => {
60
+ if (item.type === "day_separator") {
61
+ if (renderDaySeparator) return /* @__PURE__ */ jsx("div", { children: renderDaySeparator({
62
+ item,
63
+ formatDate: defaultFormatDate
64
+ }) }, `day-separator-${item.dateString}`);
65
+ return /* @__PURE__ */ jsx(DaySeparator, {
66
+ className: "flex items-center justify-center py-2",
67
+ date: item.date,
68
+ dateString: item.dateString,
69
+ children: ({ formattedDate }) => /* @__PURE__ */ jsxs(Fragment, { children: [
70
+ /* @__PURE__ */ jsx(DaySeparatorLine, { className: "flex-1 border-gray-200 border-t dark:border-gray-700" }),
71
+ /* @__PURE__ */ jsx(DaySeparatorLabel, {
72
+ className: "px-3 text-gray-500 text-xs dark:text-gray-400",
73
+ formattedDate
74
+ }),
75
+ /* @__PURE__ */ jsx(DaySeparatorLine, { className: "flex-1 border-gray-200 border-t dark:border-gray-700" })
76
+ ] })
77
+ }, `day-separator-${item.dateString}`);
78
+ }
59
79
  if (item.type === "timeline_event") {
60
80
  const eventPart = extractEventPart(item.item);
61
81
  if (!eventPart) return null;