@tylertech/forge-ai 0.13.1 → 0.13.3

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 (92) hide show
  1. package/custom-elements.json +4030 -2118
  2. package/dist/ai-agent-info/ai-agent-info.d.ts +1 -1
  3. package/dist/ai-agent-info/ai-agent-info.mjs +17 -62
  4. package/dist/ai-agent-info/ai-agent-info.scss.mjs +1 -1
  5. package/dist/ai-assistant-response/ai-assistant-response.scss.mjs +1 -1
  6. package/dist/ai-chat-header/ai-chat-header.d.ts +6 -0
  7. package/dist/ai-chat-header/ai-chat-header.mjs +51 -7
  8. package/dist/ai-chat-header/ai-chat-header.scss.mjs +1 -1
  9. package/dist/ai-chat-interface/ai-chat-interface.scss.mjs +1 -1
  10. package/dist/ai-chatbot/ai-chatbot-base.d.ts +37 -3
  11. package/dist/ai-chatbot/ai-chatbot-base.mjs +83 -24
  12. package/dist/ai-chatbot/ai-chatbot.d.ts +40 -1
  13. package/dist/ai-chatbot/ai-chatbot.mjs +242 -44
  14. package/dist/ai-chatbot/ai-chatbot.scss.mjs +1 -1
  15. package/dist/ai-chatbot/index.d.ts +1 -1
  16. package/dist/ai-chatbot/types.d.ts +39 -0
  17. package/dist/ai-chatbot/utils.d.ts +5 -0
  18. package/dist/ai-chatbot/utils.mjs +28 -0
  19. package/dist/ai-chatbot-launcher/ai-chatbot-launcher.d.ts +26 -0
  20. package/dist/ai-chatbot-launcher/ai-chatbot-launcher.mjs +155 -10
  21. package/dist/ai-chatbot-launcher/ai-chatbot-launcher.scss.mjs +1 -1
  22. package/dist/ai-confirmation-prompt/ai-confirmation-prompt.d.ts +6 -0
  23. package/dist/ai-confirmation-prompt/ai-confirmation-prompt.mjs +64 -19
  24. package/dist/ai-confirmation-prompt/ai-confirmation-prompt.scss.mjs +1 -1
  25. package/dist/ai-context-chip/ai-context-chip.d.ts +45 -0
  26. package/dist/ai-context-chip/ai-context-chip.mjs +169 -0
  27. package/dist/ai-context-chip/ai-context-chip.scss.mjs +4 -0
  28. package/dist/ai-context-chip/index.d.ts +2 -0
  29. package/dist/ai-context-chip/index.mjs +5 -0
  30. package/dist/ai-context-items/ai-context-items.d.ts +20 -0
  31. package/dist/ai-context-items/ai-context-items.mjs +78 -0
  32. package/dist/ai-context-items/ai-context-items.scss.mjs +4 -0
  33. package/dist/ai-context-items/index.d.ts +1 -0
  34. package/dist/ai-context-items/index.mjs +5 -0
  35. package/dist/ai-conversations-panel/ai-conversations-panel.d.ts +86 -0
  36. package/dist/ai-conversations-panel/ai-conversations-panel.mjs +558 -0
  37. package/dist/ai-conversations-panel/ai-conversations-panel.scss.mjs +4 -0
  38. package/dist/ai-conversations-panel/index.d.ts +2 -0
  39. package/dist/ai-conversations-panel/index.mjs +5 -0
  40. package/dist/ai-copy-button/ai-copy-button.d.ts +32 -0
  41. package/dist/ai-copy-button/ai-copy-button.mjs +116 -0
  42. package/dist/ai-copy-button/ai-copy-button.scss.mjs +4 -0
  43. package/dist/ai-copy-button/index.d.ts +1 -0
  44. package/dist/ai-copy-button/index.mjs +5 -0
  45. package/dist/ai-dialog/ai-dialog.scss.mjs +1 -1
  46. package/dist/ai-dropdown-menu/ai-dropdown-menu-item.scss.mjs +1 -1
  47. package/dist/ai-dropdown-menu/ai-dropdown-menu.d.ts +6 -1
  48. package/dist/ai-dropdown-menu/ai-dropdown-menu.mjs +14 -2
  49. package/dist/ai-dropdown-menu/ai-dropdown-menu.scss.mjs +1 -1
  50. package/dist/ai-edit-thread/ai-edit-thread.d.ts +34 -0
  51. package/dist/ai-edit-thread/ai-edit-thread.mjs +130 -0
  52. package/dist/ai-edit-thread/ai-edit-thread.scss.mjs +4 -0
  53. package/dist/ai-edit-thread/index.d.ts +1 -0
  54. package/dist/ai-edit-thread/index.mjs +5 -0
  55. package/dist/ai-message-thread/ai-message-thread.scss.mjs +1 -1
  56. package/dist/ai-modal/ai-modal.d.ts +11 -2
  57. package/dist/ai-modal/ai-modal.mjs +31 -6
  58. package/dist/ai-prompt/ai-prompt.d.ts +7 -1
  59. package/dist/ai-prompt/ai-prompt.mjs +29 -2
  60. package/dist/ai-sidebar/ai-sidebar.d.ts +11 -0
  61. package/dist/ai-sidebar/ai-sidebar.mjs +94 -4
  62. package/dist/ai-sidebar/ai-sidebar.scss.mjs +1 -1
  63. package/dist/ai-sidebar-chat/ai-sidebar-chat.d.ts +1 -0
  64. package/dist/ai-sidebar-chat/ai-sidebar-chat.mjs +5 -0
  65. package/dist/ai-spinner/ai-spinner.d.ts +1 -1
  66. package/dist/ai-spinner/ai-spinner.scss.mjs +1 -1
  67. package/dist/ai-thread-actions-menu/ai-thread-actions-menu.d.ts +44 -0
  68. package/dist/ai-thread-actions-menu/ai-thread-actions-menu.mjs +136 -0
  69. package/dist/ai-thread-actions-menu/ai-thread-actions-menu.scss.mjs +4 -0
  70. package/dist/ai-thread-actions-menu/index.d.ts +1 -0
  71. package/dist/ai-thread-actions-menu/index.mjs +5 -0
  72. package/dist/ai-threads/ai-threads.d.ts +45 -16
  73. package/dist/ai-threads/ai-threads.mjs +256 -98
  74. package/dist/ai-threads/ai-threads.scss.mjs +1 -1
  75. package/dist/ai-threads-search/ai-threads-search.d.ts +81 -0
  76. package/dist/ai-threads-search/ai-threads-search.mjs +414 -0
  77. package/dist/ai-threads-search/ai-threads-search.scss.mjs +4 -0
  78. package/dist/ai-threads-search/index.d.ts +1 -0
  79. package/dist/ai-threads-search/index.mjs +5 -0
  80. package/dist/core/index.d.ts +1 -0
  81. package/dist/core/index.mjs +3 -1
  82. package/dist/core/resize-controller.d.ts +25 -0
  83. package/dist/core/resize-controller.mjs +144 -0
  84. package/dist/index.d.ts +7 -0
  85. package/dist/index.mjs +21 -0
  86. package/dist/utils/delete-thread-controller.d.ts +14 -0
  87. package/dist/utils/delete-thread-controller.mjs +80 -0
  88. package/dist/utils/index.d.ts +3 -0
  89. package/dist/utils/index.mjs +8 -0
  90. package/dist/utils/infinite-scroll-controller.d.ts +33 -0
  91. package/dist/utils/infinite-scroll-controller.mjs +95 -0
  92. package/package.json +14 -14
@@ -0,0 +1,558 @@
1
+ import { unsafeCSS, LitElement, html, nothing } from "lit";
2
+ import { property, state, query, customElement } from "lit/decorators.js";
3
+ import { when } from "lit/directives/when.js";
4
+ import { DeleteThreadController } from "../utils/delete-thread-controller.mjs";
5
+ import { InfiniteScrollController } from "../utils/infinite-scroll-controller.mjs";
6
+ import "../ai-modal/ai-modal.mjs";
7
+ import "../ai-icon/ai-icon.mjs";
8
+ import "../ai-spinner/ai-spinner.mjs";
9
+ import "../ai-thread-actions-menu/ai-thread-actions-menu.mjs";
10
+ import "../ai-edit-thread/ai-edit-thread.mjs";
11
+ import styles from "./ai-conversations-panel.scss.mjs";
12
+ var __defProp = Object.defineProperty;
13
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
14
+ var __typeError = (msg) => {
15
+ throw TypeError(msg);
16
+ };
17
+ var __decorateClass = (decorators, target, key, kind) => {
18
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
19
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
20
+ if (decorator = decorators[i])
21
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
22
+ if (kind && result) __defProp(target, key, result);
23
+ return result;
24
+ };
25
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
26
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
27
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
28
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
29
+ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
30
+ var _searchDebounceTimeout, _deleteThreadController, _recentChatsScrollController, _searchChatsScrollController, _AiConversationsPanelComponent_instances, shouldEnableRecentPagination_get, shouldEnableSearchPagination_get, attachScrollController_fn, displayedThreads_get, handleSearch_fn, handleSearchInput_fn, handleRecentChatsLoadMore_fn, handleSearchChatsLoadMore_fn, transitionToSearch_fn, transitionToMain_fn, handleBackClick_fn, handleThreadSelect_fn, handleNewChatClick_fn, handleSearchChatsClick_fn, handleCloseClick_fn, handleMenuRename_fn, handleMenuOpen_fn, handleMenuClose_fn, handleMenuDeleteClick_fn, handleEditSave_fn, handleEditCancel_fn, _header, headerSearch_get, _chatsLabel, searchFieldSearch_get, emptyState_get, loadingMoreIndicator_get, threadList_get, threadListContainer_get, _chatActionsList;
31
+ const AiConversationsPanelComponentTagName = "forge-ai-conversations-panel";
32
+ let AiConversationsPanelComponent = class extends LitElement {
33
+ constructor() {
34
+ super(...arguments);
35
+ __privateAdd(this, _AiConversationsPanelComponent_instances);
36
+ this.recentThreads = [];
37
+ this.totalChats = 0;
38
+ this.selectedThreadId = null;
39
+ this.showConversationRename = false;
40
+ this.showConversationDelete = false;
41
+ this._viewState = "main";
42
+ this._isSearching = false;
43
+ this._searchResults = [];
44
+ this._searchQuery = "";
45
+ this._editingThreadId = null;
46
+ this._hiddenThreadIds = /* @__PURE__ */ new Set();
47
+ this._openMenuThreadId = null;
48
+ __privateAdd(this, _searchDebounceTimeout);
49
+ __privateAdd(this, _deleteThreadController, new DeleteThreadController(this, {
50
+ onConfirm: (thread) => {
51
+ const onSuccess = () => {
52
+ this._hiddenThreadIds.add(thread.id);
53
+ this.requestUpdate();
54
+ };
55
+ const onError = (error) => {
56
+ this._hiddenThreadIds.delete(thread.id);
57
+ this.requestUpdate();
58
+ if (error) {
59
+ console.error("Delete failed:", error);
60
+ }
61
+ };
62
+ const event = new CustomEvent("forge-ai-conversations-panel-delete", {
63
+ detail: { id: thread.id, thread, onSuccess, onError },
64
+ bubbles: true,
65
+ composed: true,
66
+ cancelable: true
67
+ });
68
+ const dispatched = this.dispatchEvent(event);
69
+ if (dispatched) {
70
+ this._hiddenThreadIds.add(thread.id);
71
+ this.requestUpdate();
72
+ }
73
+ }
74
+ }));
75
+ __privateAdd(this, _recentChatsScrollController, new InfiniteScrollController(this, {
76
+ onLoadMore: () => __privateMethod(this, _AiConversationsPanelComponent_instances, handleRecentChatsLoadMore_fn).call(this)
77
+ }));
78
+ __privateAdd(this, _searchChatsScrollController, new InfiniteScrollController(this, {
79
+ onLoadMore: () => __privateMethod(this, _AiConversationsPanelComponent_instances, handleSearchChatsLoadMore_fn).call(this)
80
+ }));
81
+ __privateAdd(this, _header, html`
82
+ <div class="header">
83
+ <forge-ai-icon></forge-ai-icon>
84
+ <button
85
+ class="close-button forge-icon-button forge-icon-button--medium"
86
+ @click=${__privateMethod(this, _AiConversationsPanelComponent_instances, handleCloseClick_fn)}
87
+ aria-label="Close conversations panel">
88
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
89
+ <path fill="none" d="M0 0h24v24H0z" />
90
+ <path
91
+ d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" />
92
+ </svg>
93
+ </button>
94
+ </div>
95
+ `);
96
+ __privateAdd(this, _chatsLabel, html`<div class="chats-label">Recent chats</div>`);
97
+ __privateAdd(this, _chatActionsList, html`
98
+ <ul class="forge-list forge-list--dense forge-list--navlist chat-actions-list" role="list">
99
+ <li class="forge-list-item new-chat-item" role="listitem">
100
+ <button @click=${__privateMethod(this, _AiConversationsPanelComponent_instances, handleNewChatClick_fn)}>
101
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="forge-icon">
102
+ <path
103
+ d="M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m0 14H5.2L4 17.2V4h16zm-4-7v2h-3v3h-2v-3H8V9h3V6h2v3z" />
104
+ </svg>
105
+ <span>New chat</span>
106
+ </button>
107
+ </li>
108
+ <li class="forge-list-item new-chat-item" role="listitem">
109
+ <button @click=${__privateMethod(this, _AiConversationsPanelComponent_instances, handleSearchChatsClick_fn)}>
110
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="forge-icon">
111
+ <path
112
+ d="M9 6v2H2V6zm0 5v2H2v-2zm9 5v2H2v-2zm1.31-4.5c.44-.68.69-1.5.69-2.39 0-2.5-2-4.5-4.5-4.5s-4.5 2-4.5 4.5 2 4.5 4.5 4.5c.87 0 1.69-.25 2.38-.68L21 16l1.39-1.39zm-3.81.11c-1.38 0-2.5-1.11-2.5-2.5s1.12-2.5 2.5-2.5a2.5 2.5 0 0 1 0 5" />
113
+ </svg>
114
+ <span>Search chats</span>
115
+ </button>
116
+ </li>
117
+ </ul>
118
+ `);
119
+ }
120
+ connectedCallback() {
121
+ super.connectedCallback();
122
+ this.updateComplete.then(() => {
123
+ if (this._viewState === "main" && this.recentThreads.length) {
124
+ this._searchInputMain?.focus();
125
+ } else if (this._viewState === "search") {
126
+ this._searchInputSearch?.focus();
127
+ }
128
+ });
129
+ }
130
+ disconnectedCallback() {
131
+ super.disconnectedCallback();
132
+ clearTimeout(__privateGet(this, _searchDebounceTimeout));
133
+ }
134
+ firstUpdated() {
135
+ __privateMethod(this, _AiConversationsPanelComponent_instances, attachScrollController_fn).call(this);
136
+ }
137
+ updated(changedProperties) {
138
+ if (changedProperties.has("_viewState") || changedProperties.has("recentThreads") || changedProperties.has("totalChats")) {
139
+ if (changedProperties.has("recentThreads") || changedProperties.has("totalChats")) {
140
+ __privateGet(this, _recentChatsScrollController).reset();
141
+ __privateGet(this, _searchChatsScrollController).reset();
142
+ }
143
+ __privateMethod(this, _AiConversationsPanelComponent_instances, attachScrollController_fn).call(this);
144
+ }
145
+ }
146
+ resetToMainView() {
147
+ __privateMethod(this, _AiConversationsPanelComponent_instances, transitionToMain_fn).call(this);
148
+ this._editingThreadId = null;
149
+ }
150
+ render() {
151
+ const isMainView = this._viewState === "main";
152
+ const isSearchView = this._viewState === "search";
153
+ return html`
154
+ <aside class="conversations-panel" role="complementary" aria-label="Conversation history">
155
+ ${when(isMainView, () => __privateGet(this, _header))} ${when(isSearchView, () => __privateGet(this, _AiConversationsPanelComponent_instances, headerSearch_get))}
156
+ ${when(isMainView, () => __privateGet(this, _chatActionsList))} ${when(isMainView, () => __privateGet(this, _chatsLabel))}
157
+ ${when(isSearchView, () => __privateGet(this, _AiConversationsPanelComponent_instances, searchFieldSearch_get))} ${__privateGet(this, _AiConversationsPanelComponent_instances, threadListContainer_get)}
158
+ </aside>
159
+ ${__privateGet(this, _deleteThreadController).template}
160
+ `;
161
+ }
162
+ };
163
+ _searchDebounceTimeout = /* @__PURE__ */ new WeakMap();
164
+ _deleteThreadController = /* @__PURE__ */ new WeakMap();
165
+ _recentChatsScrollController = /* @__PURE__ */ new WeakMap();
166
+ _searchChatsScrollController = /* @__PURE__ */ new WeakMap();
167
+ _AiConversationsPanelComponent_instances = /* @__PURE__ */ new WeakSet();
168
+ shouldEnableRecentPagination_get = function() {
169
+ if (this.totalChats <= 0) {
170
+ return false;
171
+ }
172
+ const displayedCount = this.recentThreads.filter((t) => !this._hiddenThreadIds.has(t.id)).length;
173
+ return displayedCount < this.totalChats;
174
+ };
175
+ shouldEnableSearchPagination_get = function() {
176
+ if (this.totalChats <= 0) {
177
+ return false;
178
+ }
179
+ const displayedCount = this._searchResults.filter((t) => !this._hiddenThreadIds.has(t.id)).length;
180
+ return displayedCount < this.totalChats;
181
+ };
182
+ attachScrollController_fn = function() {
183
+ if (!this._threadListContainer) {
184
+ return;
185
+ }
186
+ __privateGet(this, _recentChatsScrollController).detach();
187
+ __privateGet(this, _searchChatsScrollController).detach();
188
+ if (this._viewState === "main" && __privateGet(this, _AiConversationsPanelComponent_instances, shouldEnableRecentPagination_get)) {
189
+ __privateGet(this, _recentChatsScrollController).attach(this._threadListContainer);
190
+ } else if (this._viewState === "search" && __privateGet(this, _AiConversationsPanelComponent_instances, shouldEnableSearchPagination_get)) {
191
+ __privateGet(this, _searchChatsScrollController).attach(this._threadListContainer);
192
+ }
193
+ };
194
+ displayedThreads_get = function() {
195
+ const threads = this._viewState === "search" ? this._searchResults : this.recentThreads;
196
+ return threads.filter((thread) => !this._hiddenThreadIds.has(thread.id));
197
+ };
198
+ handleSearch_fn = function(searchQuery) {
199
+ this._searchQuery = searchQuery;
200
+ __privateGet(this, _searchChatsScrollController).reset();
201
+ const setResults = (results) => {
202
+ this._searchResults = results;
203
+ this._isSearching = false;
204
+ };
205
+ const event = new CustomEvent("forge-ai-conversations-panel-search", {
206
+ detail: { query: searchQuery, setResults },
207
+ bubbles: true,
208
+ composed: true,
209
+ cancelable: true
210
+ });
211
+ if (!this.dispatchEvent(event)) {
212
+ this._isSearching = true;
213
+ } else {
214
+ this._isSearching = false;
215
+ this._searchResults = this.recentThreads.filter(
216
+ (thread) => thread.title.toLowerCase().includes(searchQuery.toLowerCase())
217
+ );
218
+ }
219
+ };
220
+ handleSearchInput_fn = function(event) {
221
+ const searchQuery = event.target.value;
222
+ clearTimeout(__privateGet(this, _searchDebounceTimeout));
223
+ if (!searchQuery.trim()) {
224
+ this._searchQuery = "";
225
+ this._searchResults = this.recentThreads;
226
+ this._isSearching = false;
227
+ return;
228
+ }
229
+ __privateSet(this, _searchDebounceTimeout, window.setTimeout(() => {
230
+ __privateMethod(this, _AiConversationsPanelComponent_instances, handleSearch_fn).call(this, searchQuery);
231
+ }, 300));
232
+ };
233
+ handleRecentChatsLoadMore_fn = function() {
234
+ const appendResults = (results) => {
235
+ if (results.length === 0) {
236
+ __privateGet(this, _recentChatsScrollController).setHasMore(false);
237
+ } else {
238
+ this.recentThreads = [...this.recentThreads, ...results];
239
+ }
240
+ __privateGet(this, _recentChatsScrollController).setLoadingState(false);
241
+ };
242
+ const event = new CustomEvent(
243
+ "forge-ai-conversations-panel-load-more",
244
+ {
245
+ detail: { query: "", appendResults },
246
+ bubbles: true,
247
+ composed: true
248
+ }
249
+ );
250
+ this.dispatchEvent(event);
251
+ };
252
+ handleSearchChatsLoadMore_fn = function() {
253
+ const appendResults = (results) => {
254
+ if (results.length === 0) {
255
+ __privateGet(this, _searchChatsScrollController).setHasMore(false);
256
+ } else {
257
+ this._searchResults = [...this._searchResults, ...results];
258
+ }
259
+ __privateGet(this, _searchChatsScrollController).setLoadingState(false);
260
+ };
261
+ const event = new CustomEvent(
262
+ "forge-ai-conversations-panel-load-more",
263
+ {
264
+ detail: { query: this._searchQuery, appendResults },
265
+ bubbles: true,
266
+ composed: true
267
+ }
268
+ );
269
+ this.dispatchEvent(event);
270
+ };
271
+ transitionToSearch_fn = function() {
272
+ if (this._viewState === "search") {
273
+ return;
274
+ }
275
+ this._viewState = "search";
276
+ this._searchQuery = "";
277
+ this._searchResults = this.recentThreads;
278
+ this._isSearching = false;
279
+ this._editingThreadId = null;
280
+ __privateGet(this, _recentChatsScrollController).reset();
281
+ __privateGet(this, _searchChatsScrollController).reset();
282
+ this.updateComplete.then(() => this._searchInputSearch?.focus());
283
+ };
284
+ transitionToMain_fn = function() {
285
+ if (this._viewState === "main") {
286
+ return;
287
+ }
288
+ this._viewState = "main";
289
+ this._searchQuery = "";
290
+ this._searchResults = [];
291
+ this._isSearching = false;
292
+ this._editingThreadId = null;
293
+ __privateGet(this, _recentChatsScrollController).reset();
294
+ __privateGet(this, _searchChatsScrollController).reset();
295
+ clearTimeout(__privateGet(this, _searchDebounceTimeout));
296
+ };
297
+ handleBackClick_fn = function() {
298
+ __privateMethod(this, _AiConversationsPanelComponent_instances, transitionToMain_fn).call(this);
299
+ };
300
+ handleThreadSelect_fn = function(thread) {
301
+ const event = new CustomEvent("forge-ai-conversations-panel-select", {
302
+ detail: { id: thread.id, title: thread.title },
303
+ bubbles: true,
304
+ composed: true
305
+ });
306
+ this.dispatchEvent(event);
307
+ };
308
+ handleNewChatClick_fn = function() {
309
+ const event = new CustomEvent("forge-ai-conversations-panel-new-chat", {
310
+ bubbles: true,
311
+ composed: true,
312
+ cancelable: true
313
+ });
314
+ this.dispatchEvent(event);
315
+ };
316
+ handleSearchChatsClick_fn = function() {
317
+ __privateMethod(this, _AiConversationsPanelComponent_instances, transitionToSearch_fn).call(this);
318
+ };
319
+ handleCloseClick_fn = function() {
320
+ const event = new CustomEvent("forge-ai-conversations-panel-close", {
321
+ bubbles: true,
322
+ composed: true
323
+ });
324
+ this.dispatchEvent(event);
325
+ };
326
+ handleMenuRename_fn = function(e) {
327
+ this._editingThreadId = e.detail.id;
328
+ this._openMenuThreadId = null;
329
+ };
330
+ handleMenuOpen_fn = function(e) {
331
+ this._openMenuThreadId = e.detail.id;
332
+ };
333
+ handleMenuClose_fn = function() {
334
+ this._openMenuThreadId = null;
335
+ };
336
+ handleMenuDeleteClick_fn = function(e) {
337
+ const { id } = e.detail;
338
+ const thread = __privateGet(this, _AiConversationsPanelComponent_instances, displayedThreads_get).find((t) => t.id === id);
339
+ if (!thread) {
340
+ return;
341
+ }
342
+ __privateGet(this, _deleteThreadController).show(thread);
343
+ };
344
+ handleEditSave_fn = function(e) {
345
+ const { id, oldTitle, newTitle } = e.detail;
346
+ const thread = __privateGet(this, _AiConversationsPanelComponent_instances, displayedThreads_get).find((t) => t.id === id);
347
+ if (!thread) {
348
+ return;
349
+ }
350
+ const onSuccess = () => {
351
+ thread.title = newTitle;
352
+ this.requestUpdate();
353
+ };
354
+ const onError = (error) => {
355
+ thread.title = oldTitle;
356
+ this.requestUpdate();
357
+ if (error) {
358
+ console.error("Rename failed:", error);
359
+ }
360
+ };
361
+ const event = new CustomEvent("forge-ai-conversations-panel-rename", {
362
+ detail: { id, oldTitle, newTitle, onSuccess, onError },
363
+ bubbles: true,
364
+ composed: true,
365
+ cancelable: true
366
+ });
367
+ const dispatched = this.dispatchEvent(event);
368
+ if (dispatched) {
369
+ thread.title = newTitle;
370
+ this.requestUpdate();
371
+ }
372
+ this._editingThreadId = null;
373
+ };
374
+ handleEditCancel_fn = function() {
375
+ this._editingThreadId = null;
376
+ };
377
+ _header = /* @__PURE__ */ new WeakMap();
378
+ headerSearch_get = function() {
379
+ return html`
380
+ <div class="header header--search">
381
+ <button
382
+ class="back-button forge-icon-button forge-icon-button--medium"
383
+ @click=${__privateMethod(this, _AiConversationsPanelComponent_instances, handleBackClick_fn)}
384
+ aria-label="Back to recent chats">
385
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
386
+ <path fill="none" d="M0 0h24v24H0z" />
387
+ <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z" />
388
+ </svg>
389
+ </button>
390
+ <forge-ai-icon></forge-ai-icon>
391
+ <div class="search-header-end">
392
+ <button
393
+ class="close-button forge-icon-button forge-icon-button--medium"
394
+ @click=${__privateMethod(this, _AiConversationsPanelComponent_instances, handleCloseClick_fn)}
395
+ aria-label="Close conversations panel">
396
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
397
+ <path fill="none" d="M0 0h24v24H0z" />
398
+ <path
399
+ d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" />
400
+ </svg>
401
+ </button>
402
+ </div>
403
+ </div>
404
+ `;
405
+ };
406
+ _chatsLabel = /* @__PURE__ */ new WeakMap();
407
+ searchFieldSearch_get = function() {
408
+ return html`
409
+ <div class="forge-field forge-field--small search-field">
410
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="forge-icon">
411
+ <path fill="none" d="M0 0h24v24H0z" />
412
+ <path
413
+ d="M15.5 14h-.79l-.28-.27A6.47 6.47 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14" />
414
+ </svg>
415
+ <input
416
+ type="text"
417
+ id="search-input-search"
418
+ autocomplete="off"
419
+ placeholder="Search chats..."
420
+ .value=${this._searchQuery}
421
+ @input=${__privateMethod(this, _AiConversationsPanelComponent_instances, handleSearchInput_fn)} />
422
+ ${when(
423
+ this._isSearching,
424
+ () => html`<forge-ai-spinner size="small" class="search-spinner"></forge-ai-spinner>`
425
+ )}
426
+ </div>
427
+ `;
428
+ };
429
+ emptyState_get = function() {
430
+ const message = this._viewState === "search" && this._searchQuery.trim() ? "No conversations found" : "No conversations yet";
431
+ return html`
432
+ <div class="empty-state">
433
+ <p>${message}</p>
434
+ </div>
435
+ `;
436
+ };
437
+ loadingMoreIndicator_get = function() {
438
+ const controller = this._viewState === "search" ? __privateGet(this, _searchChatsScrollController) : __privateGet(this, _recentChatsScrollController);
439
+ if (!controller.isLoadingMore) {
440
+ return nothing;
441
+ }
442
+ return html`
443
+ <div class="loading-more-indicator">
444
+ <forge-ai-spinner size="small"></forge-ai-spinner>
445
+ </div>
446
+ `;
447
+ };
448
+ threadList_get = function() {
449
+ const threads = __privateGet(this, _AiConversationsPanelComponent_instances, displayedThreads_get);
450
+ if (threads.length === 0) {
451
+ return __privateGet(this, _AiConversationsPanelComponent_instances, emptyState_get);
452
+ }
453
+ return html`
454
+ <ul class="forge-list forge-list--dense forge-list--navlist" role="list">
455
+ ${threads.map((thread) => {
456
+ const isSelected = this.selectedThreadId === thread.id;
457
+ const isEditing = this._editingThreadId === thread.id;
458
+ const hasOpenMenu = this._openMenuThreadId === thread.id;
459
+ return html`
460
+ <li
461
+ class="forge-list-item ${isSelected ? "forge-list-item--selected" : ""} ${hasOpenMenu ? "forge-list-item--menu-open" : ""}"
462
+ role="listitem">
463
+ ${when(
464
+ isEditing,
465
+ () => html`
466
+ <forge-ai-edit-thread
467
+ .thread=${thread}
468
+ .value=${thread.title}
469
+ @forge-ai-edit-thread-save=${__privateMethod(this, _AiConversationsPanelComponent_instances, handleEditSave_fn)}
470
+ @forge-ai-edit-thread-cancel=${__privateMethod(this, _AiConversationsPanelComponent_instances, handleEditCancel_fn)}>
471
+ </forge-ai-edit-thread>
472
+ `,
473
+ () => html`
474
+ <button @click=${() => __privateMethod(this, _AiConversationsPanelComponent_instances, handleThreadSelect_fn).call(this, thread)} aria-selected=${isSelected}>
475
+ <span>${thread.title}</span>
476
+ </button>
477
+ ${when(
478
+ this.showConversationRename || this.showConversationDelete,
479
+ () => html`
480
+ <div class="conversation-item-actions">
481
+ <forge-ai-thread-actions-menu
482
+ .thread=${thread}
483
+ ?show-rename=${this.showConversationRename}
484
+ ?show-delete=${this.showConversationDelete}
485
+ @forge-ai-thread-actions-menu-rename=${__privateMethod(this, _AiConversationsPanelComponent_instances, handleMenuRename_fn)}
486
+ @forge-ai-thread-actions-menu-delete-click=${__privateMethod(this, _AiConversationsPanelComponent_instances, handleMenuDeleteClick_fn)}
487
+ @forge-ai-thread-actions-menu-open=${__privateMethod(this, _AiConversationsPanelComponent_instances, handleMenuOpen_fn)}
488
+ @forge-ai-thread-actions-menu-close=${__privateMethod(this, _AiConversationsPanelComponent_instances, handleMenuClose_fn)}>
489
+ </forge-ai-thread-actions-menu>
490
+ </div>
491
+ `
492
+ )}
493
+ `
494
+ )}
495
+ </li>
496
+ `;
497
+ })}
498
+ </ul>
499
+ ${__privateGet(this, _AiConversationsPanelComponent_instances, loadingMoreIndicator_get)}
500
+ `;
501
+ };
502
+ threadListContainer_get = function() {
503
+ return html` <div class="thread-list-container">${__privateGet(this, _AiConversationsPanelComponent_instances, threadList_get)}</div> `;
504
+ };
505
+ _chatActionsList = /* @__PURE__ */ new WeakMap();
506
+ AiConversationsPanelComponent.styles = unsafeCSS(styles);
507
+ __decorateClass([
508
+ property({ type: Array })
509
+ ], AiConversationsPanelComponent.prototype, "recentThreads", 2);
510
+ __decorateClass([
511
+ property({ type: Number, attribute: "total-chats" })
512
+ ], AiConversationsPanelComponent.prototype, "totalChats", 2);
513
+ __decorateClass([
514
+ property({ type: String, attribute: "selected-thread-id" })
515
+ ], AiConversationsPanelComponent.prototype, "selectedThreadId", 2);
516
+ __decorateClass([
517
+ property({ type: Boolean, attribute: "show-conversation-rename" })
518
+ ], AiConversationsPanelComponent.prototype, "showConversationRename", 2);
519
+ __decorateClass([
520
+ property({ type: Boolean, attribute: "show-conversation-delete" })
521
+ ], AiConversationsPanelComponent.prototype, "showConversationDelete", 2);
522
+ __decorateClass([
523
+ state()
524
+ ], AiConversationsPanelComponent.prototype, "_viewState", 2);
525
+ __decorateClass([
526
+ state()
527
+ ], AiConversationsPanelComponent.prototype, "_isSearching", 2);
528
+ __decorateClass([
529
+ state()
530
+ ], AiConversationsPanelComponent.prototype, "_searchResults", 2);
531
+ __decorateClass([
532
+ state()
533
+ ], AiConversationsPanelComponent.prototype, "_searchQuery", 2);
534
+ __decorateClass([
535
+ state()
536
+ ], AiConversationsPanelComponent.prototype, "_editingThreadId", 2);
537
+ __decorateClass([
538
+ state()
539
+ ], AiConversationsPanelComponent.prototype, "_hiddenThreadIds", 2);
540
+ __decorateClass([
541
+ state()
542
+ ], AiConversationsPanelComponent.prototype, "_openMenuThreadId", 2);
543
+ __decorateClass([
544
+ query("#search-input-main")
545
+ ], AiConversationsPanelComponent.prototype, "_searchInputMain", 2);
546
+ __decorateClass([
547
+ query("#search-input-search")
548
+ ], AiConversationsPanelComponent.prototype, "_searchInputSearch", 2);
549
+ __decorateClass([
550
+ query(".thread-list-container")
551
+ ], AiConversationsPanelComponent.prototype, "_threadListContainer", 2);
552
+ AiConversationsPanelComponent = __decorateClass([
553
+ customElement(AiConversationsPanelComponentTagName)
554
+ ], AiConversationsPanelComponent);
555
+ export {
556
+ AiConversationsPanelComponent,
557
+ AiConversationsPanelComponentTagName
558
+ };