@memberjunction/ng-conversations 3.4.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/dist/lib/components/active-tasks/active-tasks-panel.component.d.ts.map +1 -1
  2. package/dist/lib/components/active-tasks/active-tasks-panel.component.js +46 -41
  3. package/dist/lib/components/active-tasks/active-tasks-panel.component.js.map +1 -1
  4. package/dist/lib/components/agent/active-agent-indicator.component.d.ts.map +1 -1
  5. package/dist/lib/components/agent/active-agent-indicator.component.js +70 -68
  6. package/dist/lib/components/agent/active-agent-indicator.component.js.map +1 -1
  7. package/dist/lib/components/agent/agent-process-panel.component.d.ts.map +1 -1
  8. package/dist/lib/components/agent/agent-process-panel.component.js +13 -12
  9. package/dist/lib/components/agent/agent-process-panel.component.js.map +1 -1
  10. package/dist/lib/components/artifact/artifact-share-modal.component.js +17 -15
  11. package/dist/lib/components/artifact/artifact-share-modal.component.js.map +1 -1
  12. package/dist/lib/components/artifact/artifact-viewer-panel.component.d.ts +48 -0
  13. package/dist/lib/components/artifact/artifact-viewer-panel.component.d.ts.map +1 -0
  14. package/dist/lib/components/artifact/artifact-viewer-panel.component.js +457 -0
  15. package/dist/lib/components/artifact/artifact-viewer-panel.component.js.map +1 -0
  16. package/dist/lib/components/attachment/image-viewer.component.d.ts.map +1 -1
  17. package/dist/lib/components/attachment/image-viewer.component.js +20 -21
  18. package/dist/lib/components/attachment/image-viewer.component.js.map +1 -1
  19. package/dist/lib/components/collection/artifact-collection-picker-modal.component.d.ts.map +1 -1
  20. package/dist/lib/components/collection/artifact-collection-picker-modal.component.js +230 -233
  21. package/dist/lib/components/collection/artifact-collection-picker-modal.component.js.map +1 -1
  22. package/dist/lib/components/collection/artifact-create-modal.component.d.ts.map +1 -1
  23. package/dist/lib/components/collection/artifact-create-modal.component.js +100 -103
  24. package/dist/lib/components/collection/artifact-create-modal.component.js.map +1 -1
  25. package/dist/lib/components/collection/collection-artifact-card.component.d.ts.map +1 -1
  26. package/dist/lib/components/collection/collection-artifact-card.component.js +41 -33
  27. package/dist/lib/components/collection/collection-artifact-card.component.js.map +1 -1
  28. package/dist/lib/components/collection/collection-form-modal.component.d.ts.map +1 -1
  29. package/dist/lib/components/collection/collection-form-modal.component.js +85 -84
  30. package/dist/lib/components/collection/collection-form-modal.component.js.map +1 -1
  31. package/dist/lib/components/collection/collection-share-modal.component.js +20 -15
  32. package/dist/lib/components/collection/collection-share-modal.component.js.map +1 -1
  33. package/dist/lib/components/collection/collection-tree.component.d.ts.map +1 -1
  34. package/dist/lib/components/collection/collection-tree.component.js +13 -11
  35. package/dist/lib/components/collection/collection-tree.component.js.map +1 -1
  36. package/dist/lib/components/collection/collection-view.component.d.ts.map +1 -1
  37. package/dist/lib/components/collection/collection-view.component.js +67 -60
  38. package/dist/lib/components/collection/collection-view.component.js.map +1 -1
  39. package/dist/lib/components/collection/collections-full-view.component.d.ts +4 -3
  40. package/dist/lib/components/collection/collections-full-view.component.d.ts.map +1 -1
  41. package/dist/lib/components/collection/collections-full-view.component.js +619 -549
  42. package/dist/lib/components/collection/collections-full-view.component.js.map +1 -1
  43. package/dist/lib/components/conversation/conversation-chat-area.component.d.ts +3 -3
  44. package/dist/lib/components/conversation/conversation-chat-area.component.d.ts.map +1 -1
  45. package/dist/lib/components/conversation/conversation-chat-area.component.js +145 -143
  46. package/dist/lib/components/conversation/conversation-chat-area.component.js.map +1 -1
  47. package/dist/lib/components/conversation/conversation-empty-state.component.d.ts.map +1 -1
  48. package/dist/lib/components/conversation/conversation-empty-state.component.js +44 -44
  49. package/dist/lib/components/conversation/conversation-empty-state.component.js.map +1 -1
  50. package/dist/lib/components/conversation/conversation-list.component.d.ts.map +1 -1
  51. package/dist/lib/components/conversation/conversation-list.component.js +18 -18
  52. package/dist/lib/components/conversation/conversation-list.component.js.map +1 -1
  53. package/dist/lib/components/delete-confirm/delete-confirm-modal.component.d.ts +52 -0
  54. package/dist/lib/components/delete-confirm/delete-confirm-modal.component.d.ts.map +1 -0
  55. package/dist/lib/components/delete-confirm/delete-confirm-modal.component.js +276 -0
  56. package/dist/lib/components/delete-confirm/delete-confirm-modal.component.js.map +1 -0
  57. package/dist/lib/components/dialogs/input-dialog.component.d.ts.map +1 -1
  58. package/dist/lib/components/dialogs/input-dialog.component.js +65 -57
  59. package/dist/lib/components/dialogs/input-dialog.component.js.map +1 -1
  60. package/dist/lib/components/export/export-modal.component.d.ts.map +1 -1
  61. package/dist/lib/components/export/export-modal.component.js +126 -134
  62. package/dist/lib/components/export/export-modal.component.js.map +1 -1
  63. package/dist/lib/components/global-tasks/global-tasks-panel.component.d.ts.map +1 -1
  64. package/dist/lib/components/global-tasks/global-tasks-panel.component.js +86 -79
  65. package/dist/lib/components/global-tasks/global-tasks-panel.component.js.map +1 -1
  66. package/dist/lib/components/library/library-full-view.component.d.ts.map +1 -1
  67. package/dist/lib/components/library/library-full-view.component.js +99 -87
  68. package/dist/lib/components/library/library-full-view.component.js.map +1 -1
  69. package/dist/lib/components/members/members-modal.component.d.ts.map +1 -1
  70. package/dist/lib/components/members/members-modal.component.js +124 -119
  71. package/dist/lib/components/members/members-modal.component.js.map +1 -1
  72. package/dist/lib/components/mention/mention-dropdown.component.d.ts.map +1 -1
  73. package/dist/lib/components/mention/mention-dropdown.component.js +50 -46
  74. package/dist/lib/components/mention/mention-dropdown.component.js.map +1 -1
  75. package/dist/lib/components/mention/mention-editor.component.d.ts.map +1 -1
  76. package/dist/lib/components/mention/mention-editor.component.js +39 -38
  77. package/dist/lib/components/mention/mention-editor.component.js.map +1 -1
  78. package/dist/lib/components/message/actionable-commands.component.d.ts.map +1 -1
  79. package/dist/lib/components/message/actionable-commands.component.js +20 -21
  80. package/dist/lib/components/message/actionable-commands.component.js.map +1 -1
  81. package/dist/lib/components/message/agent-response-form.component.d.ts.map +1 -1
  82. package/dist/lib/components/message/agent-response-form.component.js +79 -77
  83. package/dist/lib/components/message/agent-response-form.component.js.map +1 -1
  84. package/dist/lib/components/message/conversation-message-rating.component.d.ts.map +1 -1
  85. package/dist/lib/components/message/conversation-message-rating.component.js +40 -39
  86. package/dist/lib/components/message/conversation-message-rating.component.js.map +1 -1
  87. package/dist/lib/components/message/form-question.component.d.ts.map +1 -1
  88. package/dist/lib/components/message/form-question.component.js +142 -125
  89. package/dist/lib/components/message/form-question.component.js.map +1 -1
  90. package/dist/lib/components/message/message-input-box.component.d.ts.map +1 -1
  91. package/dist/lib/components/message/message-input-box.component.js +10 -11
  92. package/dist/lib/components/message/message-input-box.component.js.map +1 -1
  93. package/dist/lib/components/message/message-input.component.d.ts +2 -2
  94. package/dist/lib/components/message/message-input.component.d.ts.map +1 -1
  95. package/dist/lib/components/message/message-input.component.js +10 -11
  96. package/dist/lib/components/message/message-input.component.js.map +1 -1
  97. package/dist/lib/components/message/message-item.component.d.ts +2 -2
  98. package/dist/lib/components/message/message-item.component.d.ts.map +1 -1
  99. package/dist/lib/components/message/message-item.component.js +121 -107
  100. package/dist/lib/components/message/message-item.component.js.map +1 -1
  101. package/dist/lib/components/message/message-list.component.d.ts +2 -2
  102. package/dist/lib/components/message/message-list.component.d.ts.map +1 -1
  103. package/dist/lib/components/message/message-list.component.js +25 -27
  104. package/dist/lib/components/message/message-list.component.js.map +1 -1
  105. package/dist/lib/components/message/suggested-responses.component.d.ts +1 -1
  106. package/dist/lib/components/message/suggested-responses.component.d.ts.map +1 -1
  107. package/dist/lib/components/message/suggested-responses.component.js +34 -34
  108. package/dist/lib/components/message/suggested-responses.component.js.map +1 -1
  109. package/dist/lib/components/navigation/conversation-navigation.component.d.ts.map +1 -1
  110. package/dist/lib/components/navigation/conversation-navigation.component.js +3 -3
  111. package/dist/lib/components/navigation/conversation-navigation.component.js.map +1 -1
  112. package/dist/lib/components/notification/activity-indicator.component.d.ts.map +1 -1
  113. package/dist/lib/components/notification/activity-indicator.component.js +5 -5
  114. package/dist/lib/components/notification/activity-indicator.component.js.map +1 -1
  115. package/dist/lib/components/notification/notification-badge.component.d.ts.map +1 -1
  116. package/dist/lib/components/notification/notification-badge.component.js +9 -6
  117. package/dist/lib/components/notification/notification-badge.component.js.map +1 -1
  118. package/dist/lib/components/project/project-form-modal.component.d.ts.map +1 -1
  119. package/dist/lib/components/project/project-form-modal.component.js +7 -7
  120. package/dist/lib/components/project/project-form-modal.component.js.map +1 -1
  121. package/dist/lib/components/project/project-selector.component.d.ts.map +1 -1
  122. package/dist/lib/components/project/project-selector.component.js +8 -8
  123. package/dist/lib/components/project/project-selector.component.js.map +1 -1
  124. package/dist/lib/components/search/search-panel.component.d.ts.map +1 -1
  125. package/dist/lib/components/search/search-panel.component.js +32 -27
  126. package/dist/lib/components/search/search-panel.component.js.map +1 -1
  127. package/dist/lib/components/share/share-modal.component.d.ts.map +1 -1
  128. package/dist/lib/components/share/share-modal.component.js +129 -131
  129. package/dist/lib/components/share/share-modal.component.js.map +1 -1
  130. package/dist/lib/components/shared/user-picker.component.js +6 -6
  131. package/dist/lib/components/shared/user-picker.component.js.map +1 -1
  132. package/dist/lib/components/sidebar/conversation-sidebar.component.d.ts.map +1 -1
  133. package/dist/lib/components/sidebar/conversation-sidebar.component.js +41 -37
  134. package/dist/lib/components/sidebar/conversation-sidebar.component.js.map +1 -1
  135. package/dist/lib/components/task/tasks-full-view.component.js +4 -5
  136. package/dist/lib/components/task/tasks-full-view.component.js.map +1 -1
  137. package/dist/lib/components/tasks/task-widget.component.d.ts.map +1 -1
  138. package/dist/lib/components/tasks/task-widget.component.js +144 -118
  139. package/dist/lib/components/tasks/task-widget.component.js.map +1 -1
  140. package/dist/lib/components/tasks/tasks-dropdown.component.d.ts.map +1 -1
  141. package/dist/lib/components/tasks/tasks-dropdown.component.js +176 -149
  142. package/dist/lib/components/tasks/tasks-dropdown.component.js.map +1 -1
  143. package/dist/lib/components/thread/thread-panel.component.d.ts.map +1 -1
  144. package/dist/lib/components/thread/thread-panel.component.js +7 -5
  145. package/dist/lib/components/thread/thread-panel.component.js.map +1 -1
  146. package/dist/lib/components/toast/toast.component.d.ts.map +1 -1
  147. package/dist/lib/components/toast/toast.component.js +10 -11
  148. package/dist/lib/components/toast/toast.component.js.map +1 -1
  149. package/dist/lib/components/workspace/conversation-workspace.component.d.ts +5 -5
  150. package/dist/lib/components/workspace/conversation-workspace.component.d.ts.map +1 -1
  151. package/dist/lib/components/workspace/conversation-workspace.component.js +54 -49
  152. package/dist/lib/components/workspace/conversation-workspace.component.js.map +1 -1
  153. package/dist/lib/directives/search-shortcut.directive.d.ts.map +1 -1
  154. package/dist/lib/directives/search-shortcut.directive.js +3 -2
  155. package/dist/lib/directives/search-shortcut.directive.js.map +1 -1
  156. package/dist/lib/services/conversation-state.service.d.ts +160 -0
  157. package/dist/lib/services/conversation-state.service.d.ts.map +1 -0
  158. package/dist/lib/services/conversation-state.service.js +334 -0
  159. package/dist/lib/services/conversation-state.service.js.map +1 -0
  160. package/dist/lib/services/mention-autocomplete.service.d.ts +6 -0
  161. package/dist/lib/services/mention-autocomplete.service.d.ts.map +1 -1
  162. package/dist/lib/services/mention-autocomplete.service.js +25 -2
  163. package/dist/lib/services/mention-autocomplete.service.js.map +1 -1
  164. package/package.json +38 -38
@@ -0,0 +1,160 @@
1
+ import { ConversationEntity } from '@memberjunction/core-entities';
2
+ import { UserInfo } from '@memberjunction/core';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * Simplified state management for conversations
6
+ * Uses simple arrays with Angular change detection instead of complex observables
7
+ * This prevents synchronization issues when updating conversation properties
8
+ */
9
+ export declare class ConversationStateService {
10
+ conversations: ConversationEntity[];
11
+ private _activeConversationId;
12
+ searchQuery: string;
13
+ isLoading: boolean;
14
+ activeThreadId: string | null;
15
+ private _activeConversationId$;
16
+ readonly activeConversationId$: import("rxjs").Observable<string | null>;
17
+ pendingMessageToSend: string | null;
18
+ isNewUnsavedConversation: boolean;
19
+ pendingArtifactId: string | null;
20
+ pendingArtifactVersionNumber: number | null;
21
+ constructor();
22
+ /**
23
+ * Gets the active conversation ID
24
+ */
25
+ get activeConversationId(): string | null;
26
+ /**
27
+ * Sets the active conversation ID and emits change event
28
+ */
29
+ set activeConversationId(value: string | null);
30
+ /**
31
+ * Gets the active conversation object
32
+ */
33
+ get activeConversation(): ConversationEntity | null;
34
+ /**
35
+ * Gets filtered conversations based on search query
36
+ */
37
+ get filteredConversations(): ConversationEntity[];
38
+ /**
39
+ * Gets pinned conversations
40
+ */
41
+ get pinnedConversations(): ConversationEntity[];
42
+ /**
43
+ * Sets the active conversation
44
+ * @param id The conversation ID to activate (or null to clear)
45
+ */
46
+ setActiveConversation(id: string | null): void;
47
+ /**
48
+ * Initiates a new unsaved conversation (doesn't create DB record yet)
49
+ * This shows the welcome screen and delays DB creation until first message
50
+ */
51
+ startNewConversation(): void;
52
+ /**
53
+ * Clears the new unsaved conversation state
54
+ * Called when the conversation is actually created or cancelled
55
+ */
56
+ clearNewConversationState(): void;
57
+ /**
58
+ * Gets the current active conversation ID
59
+ */
60
+ getActiveConversationId(): string | null;
61
+ /**
62
+ * Adds a conversation to the list
63
+ * @param conversation The conversation to add
64
+ */
65
+ addConversation(conversation: ConversationEntity): void;
66
+ /**
67
+ * Updates a conversation in the list by directly modifying the entity object
68
+ * Angular change detection will pick up the changes automatically
69
+ * @param id The conversation ID
70
+ * @param updates The fields to update
71
+ */
72
+ updateConversationInPlace(id: string, updates: Partial<ConversationEntity>): void;
73
+ /**
74
+ * Removes a conversation from the list
75
+ * @param id The conversation ID to remove
76
+ */
77
+ removeConversation(id: string): void;
78
+ /**
79
+ * Sets the search query
80
+ * @param query The search query string
81
+ */
82
+ setSearchQuery(query: string): void;
83
+ /**
84
+ * Clears the search query
85
+ */
86
+ clearSearchQuery(): void;
87
+ /**
88
+ * Loads conversations from the database
89
+ * @param environmentId The environment ID to filter by
90
+ * @param currentUser The current user context
91
+ */
92
+ loadConversations(environmentId: string, currentUser: UserInfo): Promise<void>;
93
+ /**
94
+ * Creates a new conversation
95
+ * @param name The conversation name
96
+ * @param environmentId The environment ID
97
+ * @param currentUser The current user context
98
+ * @param description Optional description
99
+ * @param projectId Optional project ID
100
+ * @returns The created conversation entity
101
+ */
102
+ createConversation(name: string, environmentId: string, currentUser: UserInfo, description?: string, projectId?: string): Promise<ConversationEntity>;
103
+ /**
104
+ * Deletes a conversation
105
+ * @param id The conversation ID
106
+ * @param currentUser The current user context
107
+ * @returns True if successful
108
+ */
109
+ deleteConversation(id: string, currentUser: UserInfo): Promise<boolean>;
110
+ /**
111
+ * Deletes multiple conversations in a batch operation
112
+ * @param ids - Array of conversation IDs to delete
113
+ * @param currentUser - Current user info
114
+ * @returns Object with successful deletions and failed deletions with error info
115
+ */
116
+ deleteMultipleConversations(ids: string[], currentUser: UserInfo): Promise<{
117
+ successful: string[];
118
+ failed: Array<{
119
+ id: string;
120
+ name: string;
121
+ error: string;
122
+ }>;
123
+ }>;
124
+ /**
125
+ * Updates a conversation - saves to database AND updates in-place in the array
126
+ * @param id The conversation ID
127
+ * @param updates The fields to update
128
+ * @param currentUser The current user context
129
+ * @returns True if successful
130
+ */
131
+ saveConversation(id: string, updates: Partial<ConversationEntity>, currentUser: UserInfo): Promise<boolean>;
132
+ /**
133
+ * Toggles the pinned status of a conversation
134
+ * @param id The conversation ID
135
+ * @param currentUser The current user context
136
+ */
137
+ togglePin(id: string, currentUser: UserInfo): Promise<void>;
138
+ /**
139
+ * Archives a conversation
140
+ * @param id The conversation ID
141
+ * @param currentUser The current user context
142
+ */
143
+ archiveConversation(id: string, currentUser: UserInfo): Promise<void>;
144
+ /**
145
+ * Opens a thread panel for a specific message
146
+ * @param messageId The parent message ID
147
+ */
148
+ openThread(messageId: string): void;
149
+ /**
150
+ * Closes the currently open thread panel
151
+ */
152
+ closeThread(): void;
153
+ /**
154
+ * Gets the currently active thread ID
155
+ */
156
+ getActiveThreadId(): string | null;
157
+ static ɵfac: i0.ɵɵFactoryDeclaration<ConversationStateService, never>;
158
+ static ɵprov: i0.ɵɵInjectableDeclaration<ConversationStateService>;
159
+ }
160
+ //# sourceMappingURL=conversation-state.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-state.service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/conversation-state.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAqB,QAAQ,EAAE,MAAM,sBAAsB,CAAC;;AAEnE;;;;GAIG;AACH,qBAGa,wBAAwB;IAE5B,aAAa,EAAE,kBAAkB,EAAE,CAAM;IAChD,OAAO,CAAC,qBAAqB,CAAuB;IAC7C,WAAW,EAAE,MAAM,CAAM;IACzB,SAAS,EAAE,OAAO,CAAS;IAC3B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAQ;IAG5C,OAAO,CAAC,sBAAsB,CAA4C;IAC1E,SAAgB,qBAAqB,2CAA8C;IAG5E,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAQ;IAG3C,wBAAwB,EAAE,OAAO,CAAS;IAG1C,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAQ;IACxC,4BAA4B,EAAE,MAAM,GAAG,IAAI,CAAQ;;IAI1D;;OAEG;IACH,IAAI,oBAAoB,IAAI,MAAM,GAAG,IAAI,CAExC;IAED;;OAEG;IACH,IAAI,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAK5C;IAED;;OAEG;IACH,IAAI,kBAAkB,IAAI,kBAAkB,GAAG,IAAI,CAGlD;IAED;;OAEG;IACH,IAAI,qBAAqB,IAAI,kBAAkB,EAAE,CAShD;IAED;;OAEG;IACH,IAAI,mBAAmB,IAAI,kBAAkB,EAAE,CAE9C;IAED;;;OAGG;IACH,qBAAqB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAS9C;;;OAGG;IACH,oBAAoB,IAAI,IAAI;IAO5B;;;OAGG;IACH,yBAAyB,IAAI,IAAI;IAIjC;;OAEG;IACH,uBAAuB,IAAI,MAAM,GAAG,IAAI;IAIxC;;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S,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAOjE;;;;OAIG;IACG,mBAAmB,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3E;;;OAGG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAInC;;OAEG;IACH,WAAW,IAAI,IAAI;IAInB;;OAEG;IACH,iBAAiB,IAAI,MAAM,GAAG,IAAI;yCA3WvB,wBAAwB;6CAAxB,wBAAwB;CA8WpC"}
@@ -0,0 +1,334 @@
1
+ import { Injectable } from '@angular/core';
2
+ import { BehaviorSubject } from 'rxjs';
3
+ import { Metadata, RunView } from '@memberjunction/core';
4
+ import * as i0 from "@angular/core";
5
+ /**
6
+ * Simplified state management for conversations
7
+ * Uses simple arrays with Angular change detection instead of complex observables
8
+ * This prevents synchronization issues when updating conversation properties
9
+ */
10
+ export class ConversationStateService {
11
+ // Simple properties - Angular change detection will handle updates
12
+ conversations = [];
13
+ _activeConversationId = null;
14
+ searchQuery = '';
15
+ isLoading = false;
16
+ activeThreadId = null;
17
+ // Observable for conversation ID changes (for URL tracking)
18
+ _activeConversationId$ = new BehaviorSubject(null);
19
+ activeConversationId$ = this._activeConversationId$.asObservable();
20
+ // Pending message from empty state - persists across component lifecycle
21
+ pendingMessageToSend = null;
22
+ // New unsaved conversation state - delays DB creation until first message
23
+ isNewUnsavedConversation = false;
24
+ // Pending artifact navigation - used when jumping from collection to conversation
25
+ pendingArtifactId = null;
26
+ pendingArtifactVersionNumber = null;
27
+ constructor() { }
28
+ /**
29
+ * Gets the active conversation ID
30
+ */
31
+ get activeConversationId() {
32
+ return this._activeConversationId;
33
+ }
34
+ /**
35
+ * Sets the active conversation ID and emits change event
36
+ */
37
+ set activeConversationId(value) {
38
+ if (this._activeConversationId !== value) {
39
+ this._activeConversationId = value;
40
+ this._activeConversationId$.next(value);
41
+ }
42
+ }
43
+ /**
44
+ * Gets the active conversation object
45
+ */
46
+ get activeConversation() {
47
+ if (!this.activeConversationId)
48
+ return null;
49
+ return this.conversations.find(c => c.ID === this.activeConversationId) || null;
50
+ }
51
+ /**
52
+ * Gets filtered conversations based on search query
53
+ */
54
+ get filteredConversations() {
55
+ if (!this.searchQuery || this.searchQuery.trim() === '') {
56
+ return this.conversations;
57
+ }
58
+ const lowerQuery = this.searchQuery.toLowerCase();
59
+ return this.conversations.filter(c => (c.Name?.toLowerCase().includes(lowerQuery)) ||
60
+ (c.Description?.toLowerCase().includes(lowerQuery)));
61
+ }
62
+ /**
63
+ * Gets pinned conversations
64
+ */
65
+ get pinnedConversations() {
66
+ return this.conversations.filter(c => c.IsPinned);
67
+ }
68
+ /**
69
+ * Sets the active conversation
70
+ * @param id The conversation ID to activate (or null to clear)
71
+ */
72
+ setActiveConversation(id) {
73
+ console.log('🎯 Setting active conversation:', id);
74
+ this.activeConversationId = id;
75
+ // Clear unsaved state when switching to an existing conversation
76
+ if (id) {
77
+ this.isNewUnsavedConversation = false;
78
+ }
79
+ }
80
+ /**
81
+ * Initiates a new unsaved conversation (doesn't create DB record yet)
82
+ * This shows the welcome screen and delays DB creation until first message
83
+ */
84
+ startNewConversation() {
85
+ console.log('✨ Starting new unsaved conversation');
86
+ this.activeConversationId = null;
87
+ this.isNewUnsavedConversation = true;
88
+ this.pendingMessageToSend = null;
89
+ }
90
+ /**
91
+ * Clears the new unsaved conversation state
92
+ * Called when the conversation is actually created or cancelled
93
+ */
94
+ clearNewConversationState() {
95
+ this.isNewUnsavedConversation = false;
96
+ }
97
+ /**
98
+ * Gets the current active conversation ID
99
+ */
100
+ getActiveConversationId() {
101
+ return this.activeConversationId;
102
+ }
103
+ /**
104
+ * Adds a conversation to the list
105
+ * @param conversation The conversation to add
106
+ */
107
+ addConversation(conversation) {
108
+ this.conversations = [conversation, ...this.conversations];
109
+ }
110
+ /**
111
+ * Updates a conversation in the list by directly modifying the entity object
112
+ * Angular change detection will pick up the changes automatically
113
+ * @param id The conversation ID
114
+ * @param updates The fields to update
115
+ */
116
+ updateConversationInPlace(id, updates) {
117
+ const conversation = this.conversations.find(c => c.ID === id);
118
+ if (conversation) {
119
+ Object.assign(conversation, updates);
120
+ console.log('📝 Updated conversation in-place:', { id, updates });
121
+ }
122
+ }
123
+ /**
124
+ * Removes a conversation from the list
125
+ * @param id The conversation ID to remove
126
+ */
127
+ removeConversation(id) {
128
+ this.conversations = this.conversations.filter(c => c.ID !== id);
129
+ }
130
+ /**
131
+ * Sets the search query
132
+ * @param query The search query string
133
+ */
134
+ setSearchQuery(query) {
135
+ this.searchQuery = query;
136
+ }
137
+ /**
138
+ * Clears the search query
139
+ */
140
+ clearSearchQuery() {
141
+ this.searchQuery = '';
142
+ }
143
+ /**
144
+ * Loads conversations from the database
145
+ * @param environmentId The environment ID to filter by
146
+ * @param currentUser The current user context
147
+ */
148
+ async loadConversations(environmentId, currentUser) {
149
+ this.isLoading = true;
150
+ try {
151
+ const rv = new RunView();
152
+ const filter = `EnvironmentID='${environmentId}' AND UserID='${currentUser.ID}' AND (IsArchived IS NULL OR IsArchived=0)`;
153
+ const result = await rv.RunView({
154
+ EntityName: 'Conversations',
155
+ ExtraFilter: filter,
156
+ OrderBy: 'IsPinned DESC, __mj_UpdatedAt DESC',
157
+ MaxRows: 1000,
158
+ ResultType: 'entity_object'
159
+ }, currentUser);
160
+ if (result.Success) {
161
+ this.conversations = result.Results || [];
162
+ }
163
+ else {
164
+ console.error('Failed to load conversations:', result.ErrorMessage);
165
+ this.conversations = [];
166
+ }
167
+ }
168
+ catch (error) {
169
+ console.error('Error loading conversations:', error);
170
+ this.conversations = [];
171
+ }
172
+ finally {
173
+ this.isLoading = false;
174
+ }
175
+ }
176
+ /**
177
+ * Creates a new conversation
178
+ * @param name The conversation name
179
+ * @param environmentId The environment ID
180
+ * @param currentUser The current user context
181
+ * @param description Optional description
182
+ * @param projectId Optional project ID
183
+ * @returns The created conversation entity
184
+ */
185
+ async createConversation(name, environmentId, currentUser, description, projectId) {
186
+ const md = new Metadata();
187
+ const conversation = await md.GetEntityObject('Conversations', currentUser);
188
+ conversation.Name = name;
189
+ conversation.EnvironmentID = environmentId;
190
+ conversation.UserID = currentUser.ID;
191
+ if (description)
192
+ conversation.Description = description;
193
+ if (projectId)
194
+ conversation.ProjectID = projectId;
195
+ const saved = await conversation.Save();
196
+ if (saved) {
197
+ this.addConversation(conversation);
198
+ return conversation;
199
+ }
200
+ else {
201
+ throw new Error(conversation.LatestResult?.Message || 'Failed to create conversation');
202
+ }
203
+ }
204
+ /**
205
+ * Deletes a conversation
206
+ * @param id The conversation ID
207
+ * @param currentUser The current user context
208
+ * @returns True if successful
209
+ */
210
+ async deleteConversation(id, currentUser) {
211
+ const md = new Metadata();
212
+ const conversation = await md.GetEntityObject('Conversations', currentUser);
213
+ const loaded = await conversation.Load(id);
214
+ if (!loaded) {
215
+ throw new Error('Conversation not found');
216
+ }
217
+ const deleted = await conversation.Delete();
218
+ if (deleted) {
219
+ this.removeConversation(id);
220
+ if (this.getActiveConversationId() === id) {
221
+ this.setActiveConversation(null);
222
+ }
223
+ return true;
224
+ }
225
+ else {
226
+ throw new Error(conversation.LatestResult?.Message || 'Failed to delete conversation');
227
+ }
228
+ }
229
+ /**
230
+ * Deletes multiple conversations in a batch operation
231
+ * @param ids - Array of conversation IDs to delete
232
+ * @param currentUser - Current user info
233
+ * @returns Object with successful deletions and failed deletions with error info
234
+ */
235
+ async deleteMultipleConversations(ids, currentUser) {
236
+ const successful = [];
237
+ const failed = [];
238
+ for (const id of ids) {
239
+ try {
240
+ const conversation = this.conversations.find(c => c.ID === id);
241
+ const name = conversation?.Name || 'Unknown';
242
+ const deleted = await this.deleteConversation(id, currentUser);
243
+ if (deleted) {
244
+ successful.push(id);
245
+ }
246
+ else {
247
+ failed.push({ id, name, error: 'Delete returned false' });
248
+ }
249
+ }
250
+ catch (error) {
251
+ const conversation = this.conversations.find(c => c.ID === id);
252
+ failed.push({
253
+ id,
254
+ name: conversation?.Name || 'Unknown',
255
+ error: error instanceof Error ? error.message : 'Unknown error'
256
+ });
257
+ }
258
+ }
259
+ return { successful, failed };
260
+ }
261
+ /**
262
+ * Updates a conversation - saves to database AND updates in-place in the array
263
+ * @param id The conversation ID
264
+ * @param updates The fields to update
265
+ * @param currentUser The current user context
266
+ * @returns True if successful
267
+ */
268
+ async saveConversation(id, updates, currentUser) {
269
+ const md = new Metadata();
270
+ const conversation = await md.GetEntityObject('Conversations', currentUser);
271
+ const loaded = await conversation.Load(id);
272
+ if (!loaded) {
273
+ throw new Error('Conversation not found');
274
+ }
275
+ // Apply updates
276
+ Object.assign(conversation, updates);
277
+ const saved = await conversation.Save();
278
+ if (saved) {
279
+ // Update the in-memory conversation directly
280
+ this.updateConversationInPlace(id, updates);
281
+ return true;
282
+ }
283
+ else {
284
+ throw new Error(conversation.LatestResult?.Message || 'Failed to update conversation');
285
+ }
286
+ }
287
+ /**
288
+ * Toggles the pinned status of a conversation
289
+ * @param id The conversation ID
290
+ * @param currentUser The current user context
291
+ */
292
+ async togglePin(id, currentUser) {
293
+ const conversation = this.conversations.find(c => c.ID === id);
294
+ if (conversation) {
295
+ await this.saveConversation(id, { IsPinned: !conversation.IsPinned }, currentUser);
296
+ }
297
+ }
298
+ /**
299
+ * Archives a conversation
300
+ * @param id The conversation ID
301
+ * @param currentUser The current user context
302
+ */
303
+ async archiveConversation(id, currentUser) {
304
+ await this.saveConversation(id, { IsArchived: true }, currentUser);
305
+ }
306
+ /**
307
+ * Opens a thread panel for a specific message
308
+ * @param messageId The parent message ID
309
+ */
310
+ openThread(messageId) {
311
+ this.activeThreadId = messageId;
312
+ }
313
+ /**
314
+ * Closes the currently open thread panel
315
+ */
316
+ closeThread() {
317
+ this.activeThreadId = null;
318
+ }
319
+ /**
320
+ * Gets the currently active thread ID
321
+ */
322
+ getActiveThreadId() {
323
+ return this.activeThreadId;
324
+ }
325
+ static ɵfac = function ConversationStateService_Factory(t) { return new (t || ConversationStateService)(); };
326
+ static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: ConversationStateService, factory: ConversationStateService.ɵfac, providedIn: 'root' });
327
+ }
328
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ConversationStateService, [{
329
+ type: Injectable,
330
+ args: [{
331
+ providedIn: 'root'
332
+ }]
333
+ }], () => [], null); })();
334
+ //# sourceMappingURL=conversation-state.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-state.service.js","sourceRoot":"","sources":["../../../src/lib/services/conversation-state.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAEvC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAY,MAAM,sBAAsB,CAAC;;AAEnE;;;;GAIG;AAIH,MAAM,OAAO,wBAAwB;IACnC,mEAAmE;IAC5D,aAAa,GAAyB,EAAE,CAAC;IACxC,qBAAqB,GAAkB,IAAI,CAAC;IAC7C,WAAW,GAAW,EAAE,CAAC;IACzB,SAAS,GAAY,KAAK,CAAC;IAC3B,cAAc,GAAkB,IAAI,CAAC;IAE5C,4DAA4D;IACpD,sBAAsB,GAAG,IAAI,eAAe,CAAgB,IAAI,CAAC,CAAC;IAC1D,qBAAqB,GAAG,IAAI,CAAC,sBAAsB,CAAC,YAAY,EAAE,CAAC;IAEnF,yEAAyE;IAClE,oBAAoB,GAAkB,IAAI,CAAC;IAElD,0EAA0E;IACnE,wBAAwB,GAAY,KAAK,CAAC;IAEjD,kFAAkF;IAC3E,iBAAiB,GAAkB,IAAI,CAAC;IACxC,4BAA4B,GAAkB,IAAI,CAAC;IAE1D,gBAAe,CAAC;IAEhB;;OAEG;IACH,IAAI,oBAAoB;QACtB,OAAO,IAAI,CAAC,qBAAqB,CAAC;IACpC,CAAC;IAED;;OAEG;IACH,IAAI,oBAAoB,CA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CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,WAAW,CAAC,CAAC;QACrF,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,mBAAmB,CAAC,EAAU,EAAE,WAAqB;QACzD,MAAM,IAAI,CAAC,gBAAgB,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,WAAW,CAAC,CAAC;IACrE,CAAC;IAED;;;OAGG;IACH,UAAU,CAAC,SAAiB;QAC1B,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,WAAW;QACT,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,iBAAiB;QACf,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;kFA7WU,wBAAwB;gEAAxB,wBAAwB,WAAxB,wBAAwB,mBAFvB,MAAM;;iFAEP,wBAAwB;cAHpC,UAAU;eAAC;gBACV,UAAU,EAAE,MAAM;aACnB"}
@@ -32,6 +32,12 @@ export declare class MentionAutocompleteService {
32
32
  * Internal initialization logic
33
33
  */
34
34
  private _initializeInternal;
35
+ /**
36
+ * Filter agents to only those the current user has 'run' permission for.
37
+ * Agents with no permission records are open to everyone (canRun = true).
38
+ * Agents with explicit permission records are checked against the user.
39
+ */
40
+ private filterAgentsByRunPermission;
35
41
  /**
36
42
  * Get suggestions based on search query
37
43
  * @param query The search text after @ symbol
@@ -1 +1 @@
1
- {"version":3,"file":"mention-autocomplete.service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/mention-autocomplete.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;;AAGhD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,qBAGa,0BAA0B;IACrC,OAAO,CAAC,WAAW,CAA+B;IAClD,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,qBAAqB,CAA8B;;IAI3D;;;OAGG;IACG,UAAU,CAAC,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBtD;;OAEG;YACW,mBAAmB;IAsBjC;;;;;OAKG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,GAAE,OAAc,GAAG,iBAAiB,EAAE;IAmDhF;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAwB3B;;OAEG;IACH,OAAO,CAAC,YAAY;IAepB;;OAEG;IACH,kBAAkB,IAAI,qBAAqB,EAAE;IAI7C;;OAEG;IACH,iBAAiB,IAAI,QAAQ,EAAE;IAI/B;;;OAGG;IACG,OAAO,CAAC,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;yCAnLxC,0BAA0B;6CAA1B,0BAA0B;CAwLtC"}
1
+ {"version":3,"file":"mention-autocomplete.service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/mention-autocomplete.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;;AAGhD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,qBAGa,0BAA0B;IACrC,OAAO,CAAC,WAAW,CAA+B;IAClD,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,qBAAqB,CAA8B;;IAI3D;;;OAGG;IACG,UAAU,CAAC,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBtD;;OAEG;YACW,mBAAmB;IA0BjC;;;;OAIG;YACW,2BAA2B;IAkBzC;;;;;OAKG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,GAAE,OAAc,GAAG,iBAAiB,EAAE;IAmDhF;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAwB3B;;OAEG;IACH,OAAO,CAAC,YAAY;IAepB;;OAEG;IACH,kBAAkB,IAAI,qBAAqB,EAAE;IAI7C;;OAEG;IACH,iBAAiB,IAAI,QAAQ,EAAE;IAI/B;;;OAGG;IACG,OAAO,CAAC,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;yCA9MxC,0BAA0B;6CAA1B,0BAA0B;CAmNtC"}
@@ -1,5 +1,5 @@
1
1
  import { Injectable } from '@angular/core';
2
- import { AIEngineBase } from '@memberjunction/ai-engine-base';
2
+ import { AIEngineBase, AIAgentPermissionHelper } from '@memberjunction/ai-engine-base';
3
3
  import * as i0 from "@angular/core";
4
4
  /**
5
5
  * Service for autocomplete suggestions when typing @mentions
@@ -40,7 +40,10 @@ export class MentionAutocompleteService {
40
40
  // Load agents from AIEngineBase
41
41
  await AIEngineBase.Instance.Config(false);
42
42
  const allAgents = AIEngineBase.Instance.Agents || [];
43
- this.agentsCache = allAgents.filter(a => !a.ParentID && a.Status === 'Active' && a.InvocationMode !== 'Sub-Agent' && !a.IsRestricted);
43
+ // Filter by status, hierarchy, and invocation mode first
44
+ const candidateAgents = allAgents.filter(a => !a.ParentID && a.Status === 'Active' && a.InvocationMode !== 'Sub-Agent' && !a.IsRestricted);
45
+ // Filter by user's 'run' permission — respects open-by-default + explicit permissions
46
+ this.agentsCache = await this.filterAgentsByRunPermission(candidateAgents, currentUser);
44
47
  // Load users from the system (optional - can be expanded later)
45
48
  // For now, we'll just use the current user
46
49
  this.usersCache = [currentUser];
@@ -51,6 +54,26 @@ export class MentionAutocompleteService {
51
54
  throw error;
52
55
  }
53
56
  }
57
+ /**
58
+ * Filter agents to only those the current user has 'run' permission for.
59
+ * Agents with no permission records are open to everyone (canRun = true).
60
+ * Agents with explicit permission records are checked against the user.
61
+ */
62
+ async filterAgentsByRunPermission(agents, user) {
63
+ const permitted = [];
64
+ for (const agent of agents) {
65
+ try {
66
+ const canRun = await AIAgentPermissionHelper.HasPermission(agent.ID, user, 'run');
67
+ if (canRun) {
68
+ permitted.push(agent);
69
+ }
70
+ }
71
+ catch {
72
+ // Fail closed — exclude agent on error
73
+ }
74
+ }
75
+ return permitted;
76
+ }
54
77
  /**
55
78
  * Get suggestions based on search query
56
79
  * @param query The search text after @ symbol
@@ -1 +1 @@
1
- {"version":3,"file":"mention-autocomplete.service.js","sourceRoot":"","sources":["../../../src/lib/services/mention-autocomplete.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;;AAgB9D;;GAEG;AAIH,MAAM,OAAO,0BAA0B;IAC7B,WAAW,GAA4B,EAAE,CAAC;IAC1C,UAAU,GAAe,EAAE,CAAC;IAC5B,aAAa,GAAG,KAAK,CAAC;IACtB,qBAAqB,GAAyB,IAAI,CAAC;IAE3D,gBAAe,CAAC;IAEhB;;;OAG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AG,KAAK,CAAC;QAC3B,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;QAClC,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IACrC,CAAC;oHAvLU,0BAA0B;gEAA1B,0BAA0B,WAA1B,0BAA0B,mBAFzB,MAAM;;iFAEP,0BAA0B;cAHtC,UAAU;eAAC;gBACV,UAAU,EAAE,MAAM;aACnB"}
1
+ {"version":3,"file":"mention-autocomplete.service.js","sourceRoot":"","sources":["../../../src/lib/services/mention-autocomplete.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;;AAgBvF;;GAEG;AAIH,MAAM,OAAO,0BAA0B;IAC7B,WAAW,GAA4B,EAAE,CAAC;IAC1C,UAAU,GAAe,EAAE,CAAC;IAC5B,aAAa,GAAG,KAAK,CAAC;IACtB,qBAAqB,GAAyB,IAAI,CAAC;IAE3D,gBAAe,CAAC;IAEhB;;;OAGG;IACH,KAAK,CAAC,UAAU,CAAC,WAAqB;QACpC,6CAA6C;QAC7C,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,OAAO;QACT,CAAC;QAED,gDAAgD;QAChD,IAAI,IAAI,CAAC,qBAAqB,EAAE,CAAC;YAC/B,OAAO,IAAI,CAAC,qBAAqB,CAAC;QACpC,CAAC;QAED,6CAA6C;QAC7C,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;QAEnE,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,qBAAqB,CAAC;QACnC,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;QACpC,CAAC;IACH,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,mBAAmB,CAAC,WAAqB;QACrD,IAAI,CAAC;YACH,gCAAgC;YAChC,MAAM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