@salla.sa/ui-ai-kit-core 2.2.1 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ai-chat-header.cjs.entry.js +19 -2
- package/dist/cjs/ai-conversation-list.cjs.entry.js +10 -4
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/ui-ai-kit.cjs.js +1 -1
- package/dist/collection/components/ai-chat-header/ai-chat-header.js +133 -2
- package/dist/collection/components/ai-conversation-list/ai-conversation-list.css +20 -0
- package/dist/collection/components/ai-conversation-list/ai-conversation-list.js +29 -3
- package/dist/components/ai-chat-header.js +1 -1
- package/dist/components/ai-conversation-list.js +1 -1
- package/dist/components/p-CFSr3KcL.js +1 -0
- package/dist/esm/ai-chat-header.entry.js +19 -2
- package/dist/esm/ai-conversation-list.entry.js +10 -4
- package/dist/esm/loader.js +1 -1
- package/dist/esm/ui-ai-kit.js +1 -1
- package/dist/types/components/ai-chat-header/ai-chat-header.d.ts +13 -0
- package/dist/types/components/ai-conversation-list/ai-conversation-list.d.ts +2 -0
- package/dist/types/components.d.ts +71 -0
- package/dist/ui-ai-kit/p-17e5d542.entry.js +1 -0
- package/dist/ui-ai-kit/p-278895fd.entry.js +1 -0
- package/dist/ui-ai-kit/ui-ai-kit.esm.js +1 -1
- package/package.json +1 -1
- package/dist/components/p-CJzVwMlS.js +0 -1
- package/dist/ui-ai-kit/p-8ac8febb.entry.js +0 -1
- package/dist/ui-ai-kit/p-953d4348.entry.js +0 -1
|
@@ -18,6 +18,7 @@ const AiChatHeader = class {
|
|
|
18
18
|
this.openExternal = index.createEvent(this, "openExternal");
|
|
19
19
|
this.conversationSelect = index.createEvent(this, "conversationSelect");
|
|
20
20
|
this.conversationDelete = index.createEvent(this, "conversationDelete");
|
|
21
|
+
this.conversationRetry = index.createEvent(this, "conversationRetry");
|
|
21
22
|
}
|
|
22
23
|
get el() { return index.getElement(this); }
|
|
23
24
|
/** Layout variant */
|
|
@@ -44,6 +45,16 @@ const AiChatHeader = class {
|
|
|
44
45
|
conversationActiveId = '';
|
|
45
46
|
/** Conversation list: show skeleton loading state */
|
|
46
47
|
conversationLoading = false;
|
|
48
|
+
/** Conversation list: show error state */
|
|
49
|
+
conversationError = false;
|
|
50
|
+
/** Conversation list: error message text */
|
|
51
|
+
conversationErrorText = 'تعذّر تحميل المحادثات';
|
|
52
|
+
/** Conversation list: retry button label */
|
|
53
|
+
conversationRetryLabel = 'إعادة المحاولة';
|
|
54
|
+
/** Conversation list: empty state label */
|
|
55
|
+
conversationEmptyText = 'لا توجد محادثات';
|
|
56
|
+
/** Conversation list: ID of the conversation currently being deleted — shows a spinner on that item */
|
|
57
|
+
conversationDeletingId = '';
|
|
47
58
|
/** Show a shimmer skeleton in place of the conversation title (e.g. while loading conversation) */
|
|
48
59
|
titleLoading = false;
|
|
49
60
|
avatarError = false;
|
|
@@ -77,6 +88,8 @@ const AiChatHeader = class {
|
|
|
77
88
|
conversationSelect;
|
|
78
89
|
/** Fired when a conversation delete button is clicked */
|
|
79
90
|
conversationDelete;
|
|
91
|
+
/** Fired when the retry button is clicked in the conversation list error state */
|
|
92
|
+
conversationRetry;
|
|
80
93
|
handleDocumentClick(event) {
|
|
81
94
|
if (this.dropdownOpen && !this.el.contains(event.target)) {
|
|
82
95
|
this.dropdownOpen = false;
|
|
@@ -150,10 +163,14 @@ const AiChatHeader = class {
|
|
|
150
163
|
e.stopPropagation();
|
|
151
164
|
this.conversationDelete.emit(e.detail);
|
|
152
165
|
};
|
|
166
|
+
handleConversationRetry = (e) => {
|
|
167
|
+
e.stopPropagation();
|
|
168
|
+
this.conversationRetry.emit();
|
|
169
|
+
};
|
|
153
170
|
renderConversationDropdown() {
|
|
154
171
|
if (!this.dropdownOpen || this.mode !== 'agent')
|
|
155
172
|
return null;
|
|
156
|
-
return (index.h("div", { class: "conversation-dropdown" }, index.h("ai-conversation-list", { items: this.conversationItems, activeId: this.conversationActiveId, loading: this.conversationLoading, onConversationSelect: this.handleConversationSelect, onConversationDelete: this.handleConversationDelete })));
|
|
173
|
+
return (index.h("div", { class: "conversation-dropdown" }, index.h("ai-conversation-list", { items: this.conversationItems, activeId: this.conversationActiveId, loading: this.conversationLoading, error: this.conversationError, errorText: this.conversationErrorText, retryLabel: this.conversationRetryLabel, emptyText: this.conversationEmptyText, deletingId: this.conversationDeletingId, onConversationSelect: this.handleConversationSelect, onConversationDelete: this.handleConversationDelete, onRetryClick: this.handleConversationRetry })));
|
|
157
174
|
}
|
|
158
175
|
renderAgentMode() {
|
|
159
176
|
return [
|
|
@@ -182,7 +199,7 @@ const AiChatHeader = class {
|
|
|
182
199
|
];
|
|
183
200
|
}
|
|
184
201
|
render() {
|
|
185
|
-
return (index.h(index.Host, { key: '
|
|
202
|
+
return (index.h(index.Host, { key: '874ee1e0eb62a59a4c9713111856594ef03dd435' }, index.h("div", { key: 'd8887800ad270c7878f41bdc930b2ca6b1280935', class: "header-wrapper" }, index.h("div", { key: 'a4fc7e86851cc1cdce6c686880b9f4ee33342fb7', class: "header-container" }, this.mode === 'agent' ? this.renderAgentMode() : this.mode === 'human' ? this.renderHumanMode() : this.renderBrowserMode()), this.renderConversationDropdown())));
|
|
186
203
|
}
|
|
187
204
|
};
|
|
188
205
|
AiChatHeader.style = aiChatHeaderCss();
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var index = require('./index-Cc05u4ND.js');
|
|
4
4
|
var iconRegistry = require('./icon-registry-D-m8GW4D.js');
|
|
5
5
|
|
|
6
|
-
const aiConversationListCss = () => `:host{display:flex;flex-direction:column;height:100%;min-height:0;overflow:hidden}.conversation-list{display:flex;flex-direction:column;gap:8px;flex:1;min-height:0;background:var(--ai-bg-surface)}.list-scroll{flex:1;min-height:0;overflow-y:auto;padding:0 8px 12px;scrollbar-width:thin;scrollbar-color:var(--ai-scrollbar-thumb) transparent}.list-scroll::-webkit-scrollbar{width:3px}.list-scroll::-webkit-scrollbar-track{background:transparent}.list-scroll::-webkit-scrollbar-thumb{background:var(--ai-scrollbar-thumb);border-radius:99px}.list-scroll::-webkit-scrollbar-thumb:hover{background:var(--ai-scrollbar-thumb-hover)}.conv-item{display:flex;align-items:flex-start;gap:6px;margin-top:6px;padding:10px 10px 10px 6px;border-radius:10px;cursor:pointer;transition:background 0.15s;position:relative}.conv-item:hover{background:var(--ai-bg-card)}.conv-item--active{background:var(--ai-bg-card);box-shadow:var(--ai-shadow-sm)}.conv-item__body{flex:1;min-width:0}.conv-item__title{margin:0 0 3px;font-size:13px;font-weight:600;color:var(--ai-text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.conv-item__preview{margin:0 0 5px;font-size:12px;color:var(--ai-text-muted);line-height:1.45;display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.conv-item__meta{display:flex;align-items:center;gap:8px}.conv-item__time{font-size:11px;color:var(--ai-text-muted);flex-shrink:0}.rating-dots{display:flex;align-items:center;gap:3px}.rating-dot{width:6px;height:6px;border-radius:50%;background:var(--ai-border-default);transition:background 0.15s}.rating-dot--filled{background:var(--ai-accent-warning, #ffaf44)}.delete-btn{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;background:transparent;border:none;border-radius:6px;cursor:pointer;color:var(--ai-text-muted);opacity:0;transition:opacity 0.15s, background 0.15s, color 0.15s;margin-block-start:2px}.conv-item:hover .delete-btn,.conv-item--active .delete-btn{opacity:1}.delete-btn:hover{background:var(--ai-status-danger-bg, rgba(239, 68, 68, 0.1));color:var(--ai-status-danger, #ef4444)}.delete-btn .icon-wrap{display:inline-flex;align-items:center;line-height:0}.empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:40px 16px;text-align:center}.empty-state__icon{display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:10px;background:var(--ai-bg-card);color:var(--ai-text-muted);line-height:0}.empty-state__icon .icon-wrap{display:inline-flex;align-items:center;line-height:0}.empty-state__text{margin:0;font-size:13px;color:var(--ai-text-muted);line-height:1.4}.error-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:40px 16px;text-align:center}.error-state__icon{display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:10px;background:var(--ai-status-danger-bg, rgba(239, 68, 68, 0.1));color:var(--ai-status-danger, #ef4444);line-height:0}.error-state__icon .icon-wrap{display:inline-flex;align-items:center;line-height:0}.error-state__text{margin:0;font-size:13px;color:var(--ai-text-muted);line-height:1.4}.error-state__retry{display:inline-flex;align-items:center;gap:4px;margin-top:4px;padding:6px 14px;font-size:12px;font-weight:600;color:var(--ai-text-primary);background:var(--ai-bg-card);border:1px solid var(--ai-border-default);border-radius:8px;cursor:pointer;transition:background 0.15s, box-shadow 0.15s}.error-state__retry:hover{box-shadow:var(--ai-shadow-sm)}.error-state__retry .icon-wrap{display:inline-flex;align-items:center;line-height:0}.skeleton-list{display:flex;flex-direction:column;gap:4px}.skeleton-item{padding:10px;border-radius:10px;display:flex;flex-direction:column;gap:6px}.skeleton-line{border-radius:6px;background:var(--ai-shimmer-gradient, linear-gradient(90deg, rgba(0, 0, 0, 0.06) 25%, rgba(0, 0, 0, 0.1) 50%, rgba(0, 0, 0, 0.06) 75%));background-size:200% 100%;animation:shimmer 2s linear infinite;height:12px}.skeleton-line--title{width:65%;height:13px}.skeleton-line--preview{width:100%}.skeleton-line--meta{width:35%;height:10px}@keyframes shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}`;
|
|
6
|
+
const aiConversationListCss = () => `:host{display:flex;flex-direction:column;height:100%;min-height:0;overflow:hidden}.conversation-list{display:flex;flex-direction:column;gap:8px;flex:1;min-height:0;background:var(--ai-bg-surface)}.list-scroll{flex:1;min-height:0;overflow-y:auto;padding:0 8px 12px;scrollbar-width:thin;scrollbar-color:var(--ai-scrollbar-thumb) transparent}.list-scroll::-webkit-scrollbar{width:3px}.list-scroll::-webkit-scrollbar-track{background:transparent}.list-scroll::-webkit-scrollbar-thumb{background:var(--ai-scrollbar-thumb);border-radius:99px}.list-scroll::-webkit-scrollbar-thumb:hover{background:var(--ai-scrollbar-thumb-hover)}.conv-item{display:flex;align-items:flex-start;gap:6px;margin-top:6px;padding:10px 10px 10px 6px;border-radius:10px;cursor:pointer;transition:background 0.15s;position:relative}.conv-item:hover{background:var(--ai-bg-card)}.conv-item--active{background:var(--ai-bg-card);box-shadow:var(--ai-shadow-sm)}.conv-item__body{flex:1;min-width:0}.conv-item__title{margin:0 0 3px;font-size:13px;font-weight:600;color:var(--ai-text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.conv-item__preview{margin:0 0 5px;font-size:12px;color:var(--ai-text-muted);line-height:1.45;display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.conv-item__meta{display:flex;align-items:center;gap:8px}.conv-item__time{font-size:11px;color:var(--ai-text-muted);flex-shrink:0}.rating-dots{display:flex;align-items:center;gap:3px}.rating-dot{width:6px;height:6px;border-radius:50%;background:var(--ai-border-default);transition:background 0.15s}.rating-dot--filled{background:var(--ai-accent-warning, #ffaf44)}.delete-btn{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;background:transparent;border:none;border-radius:6px;cursor:pointer;color:var(--ai-text-muted);opacity:0;transition:opacity 0.15s, background 0.15s, color 0.15s;margin-block-start:2px}.conv-item:hover .delete-btn,.conv-item--active .delete-btn{opacity:1}.delete-btn:hover{background:var(--ai-status-danger-bg, rgba(239, 68, 68, 0.1));color:var(--ai-status-danger, #ef4444)}.delete-btn .icon-wrap{display:inline-flex;align-items:center;line-height:0}.delete-btn--deleting{opacity:1;cursor:default;pointer-events:none}.delete-spinner{display:block;width:12px;height:12px;border:2px solid var(--ai-border-default);border-top-color:var(--ai-text-muted);border-radius:50%;animation:delete-spin 0.7s linear infinite}@keyframes delete-spin{to{transform:rotate(360deg)}}.empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:40px 16px;text-align:center}.empty-state__icon{display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:10px;background:var(--ai-bg-card);color:var(--ai-text-muted);line-height:0}.empty-state__icon .icon-wrap{display:inline-flex;align-items:center;line-height:0}.empty-state__text{margin:0;font-size:13px;color:var(--ai-text-muted);line-height:1.4}.error-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:40px 16px;text-align:center}.error-state__icon{display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:10px;background:var(--ai-status-danger-bg, rgba(239, 68, 68, 0.1));color:var(--ai-status-danger, #ef4444);line-height:0}.error-state__icon .icon-wrap{display:inline-flex;align-items:center;line-height:0}.error-state__text{margin:0;font-size:13px;color:var(--ai-text-muted);line-height:1.4}.error-state__retry{display:inline-flex;align-items:center;gap:4px;margin-top:4px;padding:6px 14px;font-size:12px;font-weight:600;color:var(--ai-text-primary);background:var(--ai-bg-card);border:1px solid var(--ai-border-default);border-radius:8px;cursor:pointer;transition:background 0.15s, box-shadow 0.15s}.error-state__retry:hover{box-shadow:var(--ai-shadow-sm)}.error-state__retry .icon-wrap{display:inline-flex;align-items:center;line-height:0}.skeleton-list{display:flex;flex-direction:column;gap:4px}.skeleton-item{padding:10px;border-radius:10px;display:flex;flex-direction:column;gap:6px}.skeleton-line{border-radius:6px;background:var(--ai-shimmer-gradient, linear-gradient(90deg, rgba(0, 0, 0, 0.06) 25%, rgba(0, 0, 0, 0.1) 50%, rgba(0, 0, 0, 0.06) 75%));background-size:200% 100%;animation:shimmer 2s linear infinite;height:12px}.skeleton-line--title{width:65%;height:13px}.skeleton-line--preview{width:100%}.skeleton-line--meta{width:35%;height:10px}@keyframes shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}`;
|
|
7
7
|
|
|
8
8
|
const AiConversationList = class {
|
|
9
9
|
constructor(hostRef) {
|
|
@@ -26,6 +26,8 @@ const AiConversationList = class {
|
|
|
26
26
|
errorText = 'تعذّر تحميل المحادثات';
|
|
27
27
|
/** Retry button label for error state */
|
|
28
28
|
retryLabel = 'إعادة المحاولة';
|
|
29
|
+
/** ID of the conversation currently being deleted — shows a spinner on that item */
|
|
30
|
+
deletingId = '';
|
|
29
31
|
conversationSelect;
|
|
30
32
|
conversationDelete;
|
|
31
33
|
retryClick;
|
|
@@ -76,7 +78,7 @@ const AiConversationList = class {
|
|
|
76
78
|
}
|
|
77
79
|
render() {
|
|
78
80
|
const showEmpty = !this.loading && !this.error && this.items.length === 0;
|
|
79
|
-
return (index.h(index.Host, { key: '
|
|
81
|
+
return (index.h(index.Host, { key: '8cf17cedd5c41f0d6ffd2d06e557dc370041d1aa' }, index.h("div", { key: '50f5eeb57228f55d72acf517ed5eeb5d79e13a4b', class: "conversation-list" }, index.h("div", { key: '763f7cb557fb9abea75e08379d0ea9090b00ac1e', class: "list-scroll", role: "list" }, this.loading
|
|
80
82
|
? this.renderSkeleton()
|
|
81
83
|
: this.error
|
|
82
84
|
? this.renderError()
|
|
@@ -84,10 +86,14 @@ const AiConversationList = class {
|
|
|
84
86
|
? this.renderEmpty()
|
|
85
87
|
: this.items.map(item => {
|
|
86
88
|
const isActive = item.id === this.activeId;
|
|
87
|
-
return (index.h("div", { key: item.id, class: { 'conv-item': true, 'conv-item--active': isActive }, role: "listitem", "aria-current": isActive ? 'true' : undefined, onClick: () => this.conversationSelect.emit(item.id) }, index.h("div", { class: "conv-item__body" }, index.h("p", { class: "conv-item__title" }, item.title), index.h("p", { class: "conv-item__preview" }, item.preview), index.h("div", { class: "conv-item__meta" }, index.h("span", { class: "conv-item__time" }, this.formatRelativeTime(item.timestamp)), item.rating != null && this.renderRatingDots(item.rating))), index.h("button", { class:
|
|
89
|
+
return (index.h("div", { key: item.id, class: { 'conv-item': true, 'conv-item--active': isActive }, role: "listitem", "aria-current": isActive ? 'true' : undefined, onClick: () => this.conversationSelect.emit(item.id) }, index.h("div", { class: "conv-item__body" }, index.h("p", { class: "conv-item__title" }, item.title), index.h("p", { class: "conv-item__preview" }, item.preview), index.h("div", { class: "conv-item__meta" }, index.h("span", { class: "conv-item__time" }, this.formatRelativeTime(item.timestamp)), item.rating != null && this.renderRatingDots(item.rating))), index.h("button", { class: { 'delete-btn': true, 'delete-btn--deleting': this.deletingId === item.id }, "aria-label": "\u062D\u0630\u0641 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629", disabled: this.deletingId === item.id, onClick: e => {
|
|
88
90
|
e.stopPropagation();
|
|
91
|
+
if (this.deletingId === item.id)
|
|
92
|
+
return;
|
|
89
93
|
this.conversationDelete.emit(item.id);
|
|
90
|
-
} }, this.
|
|
94
|
+
} }, this.deletingId === item.id
|
|
95
|
+
? index.h("span", { class: "delete-spinner", "aria-label": "\u062C\u0627\u0631\u064A \u0627\u0644\u062D\u0630\u0641" })
|
|
96
|
+
: this.renderIcon('cancel', 14, 14))));
|
|
91
97
|
})))));
|
|
92
98
|
}
|
|
93
99
|
};
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -5,7 +5,7 @@ var index = require('./index-Cc05u4ND.js');
|
|
|
5
5
|
const defineCustomElements = async (win, options) => {
|
|
6
6
|
if (typeof window === 'undefined') return undefined;
|
|
7
7
|
await index.globalScripts();
|
|
8
|
-
return index.bootstrapLazy([["ai-message-input.cjs",[[513,"ai-message-input",{"placeholder":[1],"disabled":[4],"showVoiceButton":[4,"show-voice-button"],"maxLength":[2,"max-length"],"isRecording":[4,"is-recording"],"inputValue":[32],"showVoiceRecorder":[32],"isMultiline":[32],"setInputValue":[64]},null,{"isRecording":[{"onIsRecordingChange":0}]}]]],["ai-rating.cjs",[[513,"ai-rating",{"question":[1],"subtitle":[1],"successMessage":[1,"success-message"],"value":[1026],"disabled":[4],"hovered":[32],"submitted":[32]}]]],["ai-chat-header.cjs",[[513,"ai-chat-header",{"mode":[1],"conversation":[1],"agentName":[1,"agent-name"],"agentStatus":[1,"agent-status"],"agentAvatar":[1,"agent-avatar"],"showBack":[4,"show-back"],"statusIndicator":[1,"status-indicator"],"pageTitle":[1,"page-title"],"pageUrl":[1,"page-url"],"conversationItems":[16],"conversationActiveId":[1,"conversation-active-id"],"conversationLoading":[4,"conversation-loading"],"titleLoading":[4,"title-loading"],"avatarError":[32],"dropdownOpen":[32],"isFloating":[32]},[[4,"click","handleDocumentClick"]]]]],["ai-agent-error.cjs",[[513,"ai-agent-error",{"headline":[1],"message":[1],"errorCode":[1,"error-code"],"retryable":[4],"retryLabel":[1,"retry-label"],"dismissible":[4]}]]],["ai-chat-container.cjs",[[769,"ai-chat-container",{"isOpen":[4,"is-open"],"position":[1537],"width":[1],"autoScroll":[4,"auto-scroll"],"showWatermark":[4,"show-watermark"],"floatHeight":[1,"float-height"],"theme":[1],"loading":[4],"error":[4],"errorText":[1,"error-text"],"retryLabel":[1,"retry-label"],"direction":[513],"isMobile":[32],"floatLeft":[32],"floatTop":[32],"scrollToBottom":[64],"cyclePosition":[64]},[[0,"headerPositionClick","handleHeaderPositionClick"]],{"isOpen":[{"isOpenChanged":0}],"position":[{"positionChanged":0}]}]]],["ai-chat-message.cjs",[[769,"ai-chat-message",{"role":[1],"content":[1],"format":[1],"agentName":[1,"agent-name"],"timestamp":[1],"showActions":[4,"show-actions"],"enableRegenerate":[4,"enable-regenerate"],"feedbackValue":[1025,"feedback-value"],"copySuccess":[32]}]]],["ai-conversation-summary.cjs",[[769,"ai-conversation-summary",{"conversation":[1],"summary":[1],"messageCount":[2,"message-count"],"language":[1]}]]],["ai-in-chat-browser.cjs",[[513,"ai-in-chat-browser",{"url":[1],"pageTitle":[1,"page-title"],"isLoading":[32],"hasError":[32]},null,{"url":[{"onUrlChange":0}]}]]],["ai-link.cjs",[[769,"ai-link",{"label":[1],"href":[1],"target":[1],"rel":[1]}]]],["ai-loading.cjs",[[513,"ai-loading",{"mode":[1],"statusText":[1,"status-text"],"thinkingSubtext":[1,"thinking-subtext"],"steps":[16],"headerTitle":[1,"header-title"],"currentAgent":[1,"current-agent"],"showAgentBadges":[4,"show-agent-badges"],"expanded":[1028],"collapsible":[4],"_expanded":[32]}]]],["ai-route-decision.cjs",[[513,"ai-route-decision",{"selectedAgent":[1,"selected-agent"],"agentIcon":[1,"agent-icon"],"reason":[1],"confidence":[2],"detectedLanguage":[1,"detected-language"],"expanded":[1028],"_expanded":[32]}]]],["ai-suggestion.cjs",[[769,"ai-suggestion",{"label":[1],"disabled":[4]}]]],["ai-voice-input.cjs",[[513,"ai-voice-input",{"disabled":[4],"showWaveform":[4,"show-waveform"],"autoStart":[4,"auto-start"],"errorText":[1,"error-text"],"waveformColor":[1,"waveform-color"],"state":[32],"error":[32],"recordingDuration":[32],"submitPulse":[32]}]]],["ai-card.cjs",[[769,"ai-card",{"noPadding":[4,"no-padding"],"noShadow":[4,"no-shadow"]}]]],["ai-conversation-list.cjs",[[513,"ai-conversation-list",{"items":[16],"activeId":[1,"active-id"],"loading":[4],"emptyText":[1,"empty-text"],"error":[4],"errorText":[1,"error-text"],"retryLabel":[1,"retry-label"]}]]],["ai-icon.cjs",[[513,"ai-icon",{"name":[1],"size":[2]}]]]], options);
|
|
8
|
+
return index.bootstrapLazy([["ai-message-input.cjs",[[513,"ai-message-input",{"placeholder":[1],"disabled":[4],"showVoiceButton":[4,"show-voice-button"],"maxLength":[2,"max-length"],"isRecording":[4,"is-recording"],"inputValue":[32],"showVoiceRecorder":[32],"isMultiline":[32],"setInputValue":[64]},null,{"isRecording":[{"onIsRecordingChange":0}]}]]],["ai-rating.cjs",[[513,"ai-rating",{"question":[1],"subtitle":[1],"successMessage":[1,"success-message"],"value":[1026],"disabled":[4],"hovered":[32],"submitted":[32]}]]],["ai-chat-header.cjs",[[513,"ai-chat-header",{"mode":[1],"conversation":[1],"agentName":[1,"agent-name"],"agentStatus":[1,"agent-status"],"agentAvatar":[1,"agent-avatar"],"showBack":[4,"show-back"],"statusIndicator":[1,"status-indicator"],"pageTitle":[1,"page-title"],"pageUrl":[1,"page-url"],"conversationItems":[16],"conversationActiveId":[1,"conversation-active-id"],"conversationLoading":[4,"conversation-loading"],"conversationError":[4,"conversation-error"],"conversationErrorText":[1,"conversation-error-text"],"conversationRetryLabel":[1,"conversation-retry-label"],"conversationEmptyText":[1,"conversation-empty-text"],"conversationDeletingId":[1,"conversation-deleting-id"],"titleLoading":[4,"title-loading"],"avatarError":[32],"dropdownOpen":[32],"isFloating":[32]},[[4,"click","handleDocumentClick"]]]]],["ai-agent-error.cjs",[[513,"ai-agent-error",{"headline":[1],"message":[1],"errorCode":[1,"error-code"],"retryable":[4],"retryLabel":[1,"retry-label"],"dismissible":[4]}]]],["ai-chat-container.cjs",[[769,"ai-chat-container",{"isOpen":[4,"is-open"],"position":[1537],"width":[1],"autoScroll":[4,"auto-scroll"],"showWatermark":[4,"show-watermark"],"floatHeight":[1,"float-height"],"theme":[1],"loading":[4],"error":[4],"errorText":[1,"error-text"],"retryLabel":[1,"retry-label"],"direction":[513],"isMobile":[32],"floatLeft":[32],"floatTop":[32],"scrollToBottom":[64],"cyclePosition":[64]},[[0,"headerPositionClick","handleHeaderPositionClick"]],{"isOpen":[{"isOpenChanged":0}],"position":[{"positionChanged":0}]}]]],["ai-chat-message.cjs",[[769,"ai-chat-message",{"role":[1],"content":[1],"format":[1],"agentName":[1,"agent-name"],"timestamp":[1],"showActions":[4,"show-actions"],"enableRegenerate":[4,"enable-regenerate"],"feedbackValue":[1025,"feedback-value"],"copySuccess":[32]}]]],["ai-conversation-summary.cjs",[[769,"ai-conversation-summary",{"conversation":[1],"summary":[1],"messageCount":[2,"message-count"],"language":[1]}]]],["ai-in-chat-browser.cjs",[[513,"ai-in-chat-browser",{"url":[1],"pageTitle":[1,"page-title"],"isLoading":[32],"hasError":[32]},null,{"url":[{"onUrlChange":0}]}]]],["ai-link.cjs",[[769,"ai-link",{"label":[1],"href":[1],"target":[1],"rel":[1]}]]],["ai-loading.cjs",[[513,"ai-loading",{"mode":[1],"statusText":[1,"status-text"],"thinkingSubtext":[1,"thinking-subtext"],"steps":[16],"headerTitle":[1,"header-title"],"currentAgent":[1,"current-agent"],"showAgentBadges":[4,"show-agent-badges"],"expanded":[1028],"collapsible":[4],"_expanded":[32]}]]],["ai-route-decision.cjs",[[513,"ai-route-decision",{"selectedAgent":[1,"selected-agent"],"agentIcon":[1,"agent-icon"],"reason":[1],"confidence":[2],"detectedLanguage":[1,"detected-language"],"expanded":[1028],"_expanded":[32]}]]],["ai-suggestion.cjs",[[769,"ai-suggestion",{"label":[1],"disabled":[4]}]]],["ai-voice-input.cjs",[[513,"ai-voice-input",{"disabled":[4],"showWaveform":[4,"show-waveform"],"autoStart":[4,"auto-start"],"errorText":[1,"error-text"],"waveformColor":[1,"waveform-color"],"state":[32],"error":[32],"recordingDuration":[32],"submitPulse":[32]}]]],["ai-card.cjs",[[769,"ai-card",{"noPadding":[4,"no-padding"],"noShadow":[4,"no-shadow"]}]]],["ai-conversation-list.cjs",[[513,"ai-conversation-list",{"items":[16],"activeId":[1,"active-id"],"loading":[4],"emptyText":[1,"empty-text"],"error":[4],"errorText":[1,"error-text"],"retryLabel":[1,"retry-label"],"deletingId":[1,"deleting-id"]}]]],["ai-icon.cjs",[[513,"ai-icon",{"name":[1],"size":[2]}]]]], options);
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
exports.setNonce = index.setNonce;
|
|
@@ -18,7 +18,7 @@ var patchBrowser = () => {
|
|
|
18
18
|
|
|
19
19
|
patchBrowser().then(async (options) => {
|
|
20
20
|
await index.globalScripts();
|
|
21
|
-
return index.bootstrapLazy([["ai-message-input.cjs",[[513,"ai-message-input",{"placeholder":[1],"disabled":[4],"showVoiceButton":[4,"show-voice-button"],"maxLength":[2,"max-length"],"isRecording":[4,"is-recording"],"inputValue":[32],"showVoiceRecorder":[32],"isMultiline":[32],"setInputValue":[64]},null,{"isRecording":[{"onIsRecordingChange":0}]}]]],["ai-rating.cjs",[[513,"ai-rating",{"question":[1],"subtitle":[1],"successMessage":[1,"success-message"],"value":[1026],"disabled":[4],"hovered":[32],"submitted":[32]}]]],["ai-chat-header.cjs",[[513,"ai-chat-header",{"mode":[1],"conversation":[1],"agentName":[1,"agent-name"],"agentStatus":[1,"agent-status"],"agentAvatar":[1,"agent-avatar"],"showBack":[4,"show-back"],"statusIndicator":[1,"status-indicator"],"pageTitle":[1,"page-title"],"pageUrl":[1,"page-url"],"conversationItems":[16],"conversationActiveId":[1,"conversation-active-id"],"conversationLoading":[4,"conversation-loading"],"titleLoading":[4,"title-loading"],"avatarError":[32],"dropdownOpen":[32],"isFloating":[32]},[[4,"click","handleDocumentClick"]]]]],["ai-agent-error.cjs",[[513,"ai-agent-error",{"headline":[1],"message":[1],"errorCode":[1,"error-code"],"retryable":[4],"retryLabel":[1,"retry-label"],"dismissible":[4]}]]],["ai-chat-container.cjs",[[769,"ai-chat-container",{"isOpen":[4,"is-open"],"position":[1537],"width":[1],"autoScroll":[4,"auto-scroll"],"showWatermark":[4,"show-watermark"],"floatHeight":[1,"float-height"],"theme":[1],"loading":[4],"error":[4],"errorText":[1,"error-text"],"retryLabel":[1,"retry-label"],"direction":[513],"isMobile":[32],"floatLeft":[32],"floatTop":[32],"scrollToBottom":[64],"cyclePosition":[64]},[[0,"headerPositionClick","handleHeaderPositionClick"]],{"isOpen":[{"isOpenChanged":0}],"position":[{"positionChanged":0}]}]]],["ai-chat-message.cjs",[[769,"ai-chat-message",{"role":[1],"content":[1],"format":[1],"agentName":[1,"agent-name"],"timestamp":[1],"showActions":[4,"show-actions"],"enableRegenerate":[4,"enable-regenerate"],"feedbackValue":[1025,"feedback-value"],"copySuccess":[32]}]]],["ai-conversation-summary.cjs",[[769,"ai-conversation-summary",{"conversation":[1],"summary":[1],"messageCount":[2,"message-count"],"language":[1]}]]],["ai-in-chat-browser.cjs",[[513,"ai-in-chat-browser",{"url":[1],"pageTitle":[1,"page-title"],"isLoading":[32],"hasError":[32]},null,{"url":[{"onUrlChange":0}]}]]],["ai-link.cjs",[[769,"ai-link",{"label":[1],"href":[1],"target":[1],"rel":[1]}]]],["ai-loading.cjs",[[513,"ai-loading",{"mode":[1],"statusText":[1,"status-text"],"thinkingSubtext":[1,"thinking-subtext"],"steps":[16],"headerTitle":[1,"header-title"],"currentAgent":[1,"current-agent"],"showAgentBadges":[4,"show-agent-badges"],"expanded":[1028],"collapsible":[4],"_expanded":[32]}]]],["ai-route-decision.cjs",[[513,"ai-route-decision",{"selectedAgent":[1,"selected-agent"],"agentIcon":[1,"agent-icon"],"reason":[1],"confidence":[2],"detectedLanguage":[1,"detected-language"],"expanded":[1028],"_expanded":[32]}]]],["ai-suggestion.cjs",[[769,"ai-suggestion",{"label":[1],"disabled":[4]}]]],["ai-voice-input.cjs",[[513,"ai-voice-input",{"disabled":[4],"showWaveform":[4,"show-waveform"],"autoStart":[4,"auto-start"],"errorText":[1,"error-text"],"waveformColor":[1,"waveform-color"],"state":[32],"error":[32],"recordingDuration":[32],"submitPulse":[32]}]]],["ai-card.cjs",[[769,"ai-card",{"noPadding":[4,"no-padding"],"noShadow":[4,"no-shadow"]}]]],["ai-conversation-list.cjs",[[513,"ai-conversation-list",{"items":[16],"activeId":[1,"active-id"],"loading":[4],"emptyText":[1,"empty-text"],"error":[4],"errorText":[1,"error-text"],"retryLabel":[1,"retry-label"]}]]],["ai-icon.cjs",[[513,"ai-icon",{"name":[1],"size":[2]}]]]], options);
|
|
21
|
+
return index.bootstrapLazy([["ai-message-input.cjs",[[513,"ai-message-input",{"placeholder":[1],"disabled":[4],"showVoiceButton":[4,"show-voice-button"],"maxLength":[2,"max-length"],"isRecording":[4,"is-recording"],"inputValue":[32],"showVoiceRecorder":[32],"isMultiline":[32],"setInputValue":[64]},null,{"isRecording":[{"onIsRecordingChange":0}]}]]],["ai-rating.cjs",[[513,"ai-rating",{"question":[1],"subtitle":[1],"successMessage":[1,"success-message"],"value":[1026],"disabled":[4],"hovered":[32],"submitted":[32]}]]],["ai-chat-header.cjs",[[513,"ai-chat-header",{"mode":[1],"conversation":[1],"agentName":[1,"agent-name"],"agentStatus":[1,"agent-status"],"agentAvatar":[1,"agent-avatar"],"showBack":[4,"show-back"],"statusIndicator":[1,"status-indicator"],"pageTitle":[1,"page-title"],"pageUrl":[1,"page-url"],"conversationItems":[16],"conversationActiveId":[1,"conversation-active-id"],"conversationLoading":[4,"conversation-loading"],"conversationError":[4,"conversation-error"],"conversationErrorText":[1,"conversation-error-text"],"conversationRetryLabel":[1,"conversation-retry-label"],"conversationEmptyText":[1,"conversation-empty-text"],"conversationDeletingId":[1,"conversation-deleting-id"],"titleLoading":[4,"title-loading"],"avatarError":[32],"dropdownOpen":[32],"isFloating":[32]},[[4,"click","handleDocumentClick"]]]]],["ai-agent-error.cjs",[[513,"ai-agent-error",{"headline":[1],"message":[1],"errorCode":[1,"error-code"],"retryable":[4],"retryLabel":[1,"retry-label"],"dismissible":[4]}]]],["ai-chat-container.cjs",[[769,"ai-chat-container",{"isOpen":[4,"is-open"],"position":[1537],"width":[1],"autoScroll":[4,"auto-scroll"],"showWatermark":[4,"show-watermark"],"floatHeight":[1,"float-height"],"theme":[1],"loading":[4],"error":[4],"errorText":[1,"error-text"],"retryLabel":[1,"retry-label"],"direction":[513],"isMobile":[32],"floatLeft":[32],"floatTop":[32],"scrollToBottom":[64],"cyclePosition":[64]},[[0,"headerPositionClick","handleHeaderPositionClick"]],{"isOpen":[{"isOpenChanged":0}],"position":[{"positionChanged":0}]}]]],["ai-chat-message.cjs",[[769,"ai-chat-message",{"role":[1],"content":[1],"format":[1],"agentName":[1,"agent-name"],"timestamp":[1],"showActions":[4,"show-actions"],"enableRegenerate":[4,"enable-regenerate"],"feedbackValue":[1025,"feedback-value"],"copySuccess":[32]}]]],["ai-conversation-summary.cjs",[[769,"ai-conversation-summary",{"conversation":[1],"summary":[1],"messageCount":[2,"message-count"],"language":[1]}]]],["ai-in-chat-browser.cjs",[[513,"ai-in-chat-browser",{"url":[1],"pageTitle":[1,"page-title"],"isLoading":[32],"hasError":[32]},null,{"url":[{"onUrlChange":0}]}]]],["ai-link.cjs",[[769,"ai-link",{"label":[1],"href":[1],"target":[1],"rel":[1]}]]],["ai-loading.cjs",[[513,"ai-loading",{"mode":[1],"statusText":[1,"status-text"],"thinkingSubtext":[1,"thinking-subtext"],"steps":[16],"headerTitle":[1,"header-title"],"currentAgent":[1,"current-agent"],"showAgentBadges":[4,"show-agent-badges"],"expanded":[1028],"collapsible":[4],"_expanded":[32]}]]],["ai-route-decision.cjs",[[513,"ai-route-decision",{"selectedAgent":[1,"selected-agent"],"agentIcon":[1,"agent-icon"],"reason":[1],"confidence":[2],"detectedLanguage":[1,"detected-language"],"expanded":[1028],"_expanded":[32]}]]],["ai-suggestion.cjs",[[769,"ai-suggestion",{"label":[1],"disabled":[4]}]]],["ai-voice-input.cjs",[[513,"ai-voice-input",{"disabled":[4],"showWaveform":[4,"show-waveform"],"autoStart":[4,"auto-start"],"errorText":[1,"error-text"],"waveformColor":[1,"waveform-color"],"state":[32],"error":[32],"recordingDuration":[32],"submitPulse":[32]}]]],["ai-card.cjs",[[769,"ai-card",{"noPadding":[4,"no-padding"],"noShadow":[4,"no-shadow"]}]]],["ai-conversation-list.cjs",[[513,"ai-conversation-list",{"items":[16],"activeId":[1,"active-id"],"loading":[4],"emptyText":[1,"empty-text"],"error":[4],"errorText":[1,"error-text"],"retryLabel":[1,"retry-label"],"deletingId":[1,"deleting-id"]}]]],["ai-icon.cjs",[[513,"ai-icon",{"name":[1],"size":[2]}]]]], options);
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
exports.setNonce = index.setNonce;
|
|
@@ -26,6 +26,16 @@ export class AiChatHeader {
|
|
|
26
26
|
conversationActiveId = '';
|
|
27
27
|
/** Conversation list: show skeleton loading state */
|
|
28
28
|
conversationLoading = false;
|
|
29
|
+
/** Conversation list: show error state */
|
|
30
|
+
conversationError = false;
|
|
31
|
+
/** Conversation list: error message text */
|
|
32
|
+
conversationErrorText = 'تعذّر تحميل المحادثات';
|
|
33
|
+
/** Conversation list: retry button label */
|
|
34
|
+
conversationRetryLabel = 'إعادة المحاولة';
|
|
35
|
+
/** Conversation list: empty state label */
|
|
36
|
+
conversationEmptyText = 'لا توجد محادثات';
|
|
37
|
+
/** Conversation list: ID of the conversation currently being deleted — shows a spinner on that item */
|
|
38
|
+
conversationDeletingId = '';
|
|
29
39
|
/** Show a shimmer skeleton in place of the conversation title (e.g. while loading conversation) */
|
|
30
40
|
titleLoading = false;
|
|
31
41
|
avatarError = false;
|
|
@@ -59,6 +69,8 @@ export class AiChatHeader {
|
|
|
59
69
|
conversationSelect;
|
|
60
70
|
/** Fired when a conversation delete button is clicked */
|
|
61
71
|
conversationDelete;
|
|
72
|
+
/** Fired when the retry button is clicked in the conversation list error state */
|
|
73
|
+
conversationRetry;
|
|
62
74
|
handleDocumentClick(event) {
|
|
63
75
|
if (this.dropdownOpen && !this.el.contains(event.target)) {
|
|
64
76
|
this.dropdownOpen = false;
|
|
@@ -132,10 +144,14 @@ export class AiChatHeader {
|
|
|
132
144
|
e.stopPropagation();
|
|
133
145
|
this.conversationDelete.emit(e.detail);
|
|
134
146
|
};
|
|
147
|
+
handleConversationRetry = (e) => {
|
|
148
|
+
e.stopPropagation();
|
|
149
|
+
this.conversationRetry.emit();
|
|
150
|
+
};
|
|
135
151
|
renderConversationDropdown() {
|
|
136
152
|
if (!this.dropdownOpen || this.mode !== 'agent')
|
|
137
153
|
return null;
|
|
138
|
-
return (h("div", { class: "conversation-dropdown" }, h("ai-conversation-list", { items: this.conversationItems, activeId: this.conversationActiveId, loading: this.conversationLoading, onConversationSelect: this.handleConversationSelect, onConversationDelete: this.handleConversationDelete })));
|
|
154
|
+
return (h("div", { class: "conversation-dropdown" }, h("ai-conversation-list", { items: this.conversationItems, activeId: this.conversationActiveId, loading: this.conversationLoading, error: this.conversationError, errorText: this.conversationErrorText, retryLabel: this.conversationRetryLabel, emptyText: this.conversationEmptyText, deletingId: this.conversationDeletingId, onConversationSelect: this.handleConversationSelect, onConversationDelete: this.handleConversationDelete, onRetryClick: this.handleConversationRetry })));
|
|
139
155
|
}
|
|
140
156
|
renderAgentMode() {
|
|
141
157
|
return [
|
|
@@ -164,7 +180,7 @@ export class AiChatHeader {
|
|
|
164
180
|
];
|
|
165
181
|
}
|
|
166
182
|
render() {
|
|
167
|
-
return (h(Host, { key: '
|
|
183
|
+
return (h(Host, { key: '874ee1e0eb62a59a4c9713111856594ef03dd435' }, h("div", { key: 'd8887800ad270c7878f41bdc930b2ca6b1280935', class: "header-wrapper" }, h("div", { key: 'a4fc7e86851cc1cdce6c686880b9f4ee33342fb7', class: "header-container" }, this.mode === 'agent' ? this.renderAgentMode() : this.mode === 'human' ? this.renderHumanMode() : this.renderBrowserMode()), this.renderConversationDropdown())));
|
|
168
184
|
}
|
|
169
185
|
static get is() { return "ai-chat-header"; }
|
|
170
186
|
static get encapsulation() { return "shadow"; }
|
|
@@ -425,6 +441,106 @@ export class AiChatHeader {
|
|
|
425
441
|
"attribute": "conversation-loading",
|
|
426
442
|
"defaultValue": "false"
|
|
427
443
|
},
|
|
444
|
+
"conversationError": {
|
|
445
|
+
"type": "boolean",
|
|
446
|
+
"mutable": false,
|
|
447
|
+
"complexType": {
|
|
448
|
+
"original": "boolean",
|
|
449
|
+
"resolved": "boolean",
|
|
450
|
+
"references": {}
|
|
451
|
+
},
|
|
452
|
+
"required": false,
|
|
453
|
+
"optional": false,
|
|
454
|
+
"docs": {
|
|
455
|
+
"tags": [],
|
|
456
|
+
"text": "Conversation list: show error state"
|
|
457
|
+
},
|
|
458
|
+
"getter": false,
|
|
459
|
+
"setter": false,
|
|
460
|
+
"reflect": false,
|
|
461
|
+
"attribute": "conversation-error",
|
|
462
|
+
"defaultValue": "false"
|
|
463
|
+
},
|
|
464
|
+
"conversationErrorText": {
|
|
465
|
+
"type": "string",
|
|
466
|
+
"mutable": false,
|
|
467
|
+
"complexType": {
|
|
468
|
+
"original": "string",
|
|
469
|
+
"resolved": "string",
|
|
470
|
+
"references": {}
|
|
471
|
+
},
|
|
472
|
+
"required": false,
|
|
473
|
+
"optional": false,
|
|
474
|
+
"docs": {
|
|
475
|
+
"tags": [],
|
|
476
|
+
"text": "Conversation list: error message text"
|
|
477
|
+
},
|
|
478
|
+
"getter": false,
|
|
479
|
+
"setter": false,
|
|
480
|
+
"reflect": false,
|
|
481
|
+
"attribute": "conversation-error-text",
|
|
482
|
+
"defaultValue": "'\u062A\u0639\u0630\u0651\u0631 \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0627\u062A'"
|
|
483
|
+
},
|
|
484
|
+
"conversationRetryLabel": {
|
|
485
|
+
"type": "string",
|
|
486
|
+
"mutable": false,
|
|
487
|
+
"complexType": {
|
|
488
|
+
"original": "string",
|
|
489
|
+
"resolved": "string",
|
|
490
|
+
"references": {}
|
|
491
|
+
},
|
|
492
|
+
"required": false,
|
|
493
|
+
"optional": false,
|
|
494
|
+
"docs": {
|
|
495
|
+
"tags": [],
|
|
496
|
+
"text": "Conversation list: retry button label"
|
|
497
|
+
},
|
|
498
|
+
"getter": false,
|
|
499
|
+
"setter": false,
|
|
500
|
+
"reflect": false,
|
|
501
|
+
"attribute": "conversation-retry-label",
|
|
502
|
+
"defaultValue": "'\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629'"
|
|
503
|
+
},
|
|
504
|
+
"conversationEmptyText": {
|
|
505
|
+
"type": "string",
|
|
506
|
+
"mutable": false,
|
|
507
|
+
"complexType": {
|
|
508
|
+
"original": "string",
|
|
509
|
+
"resolved": "string",
|
|
510
|
+
"references": {}
|
|
511
|
+
},
|
|
512
|
+
"required": false,
|
|
513
|
+
"optional": false,
|
|
514
|
+
"docs": {
|
|
515
|
+
"tags": [],
|
|
516
|
+
"text": "Conversation list: empty state label"
|
|
517
|
+
},
|
|
518
|
+
"getter": false,
|
|
519
|
+
"setter": false,
|
|
520
|
+
"reflect": false,
|
|
521
|
+
"attribute": "conversation-empty-text",
|
|
522
|
+
"defaultValue": "'\u0644\u0627 \u062A\u0648\u062C\u062F \u0645\u062D\u0627\u062F\u062B\u0627\u062A'"
|
|
523
|
+
},
|
|
524
|
+
"conversationDeletingId": {
|
|
525
|
+
"type": "string",
|
|
526
|
+
"mutable": false,
|
|
527
|
+
"complexType": {
|
|
528
|
+
"original": "string",
|
|
529
|
+
"resolved": "string",
|
|
530
|
+
"references": {}
|
|
531
|
+
},
|
|
532
|
+
"required": false,
|
|
533
|
+
"optional": false,
|
|
534
|
+
"docs": {
|
|
535
|
+
"tags": [],
|
|
536
|
+
"text": "Conversation list: ID of the conversation currently being deleted \u2014 shows a spinner on that item"
|
|
537
|
+
},
|
|
538
|
+
"getter": false,
|
|
539
|
+
"setter": false,
|
|
540
|
+
"reflect": false,
|
|
541
|
+
"attribute": "conversation-deleting-id",
|
|
542
|
+
"defaultValue": "''"
|
|
543
|
+
},
|
|
428
544
|
"titleLoading": {
|
|
429
545
|
"type": "boolean",
|
|
430
546
|
"mutable": false,
|
|
@@ -605,6 +721,21 @@ export class AiChatHeader {
|
|
|
605
721
|
"resolved": "string",
|
|
606
722
|
"references": {}
|
|
607
723
|
}
|
|
724
|
+
}, {
|
|
725
|
+
"method": "conversationRetry",
|
|
726
|
+
"name": "conversationRetry",
|
|
727
|
+
"bubbles": true,
|
|
728
|
+
"cancelable": true,
|
|
729
|
+
"composed": true,
|
|
730
|
+
"docs": {
|
|
731
|
+
"tags": [],
|
|
732
|
+
"text": "Fired when the retry button is clicked in the conversation list error state"
|
|
733
|
+
},
|
|
734
|
+
"complexType": {
|
|
735
|
+
"original": "void",
|
|
736
|
+
"resolved": "void",
|
|
737
|
+
"references": {}
|
|
738
|
+
}
|
|
608
739
|
}];
|
|
609
740
|
}
|
|
610
741
|
static get elementRef() { return "el"; }
|
|
@@ -161,6 +161,26 @@
|
|
|
161
161
|
line-height: 0;
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
+
.delete-btn--deleting {
|
|
165
|
+
opacity: 1;
|
|
166
|
+
cursor: default;
|
|
167
|
+
pointer-events: none;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.delete-spinner {
|
|
171
|
+
display: block;
|
|
172
|
+
width: 12px;
|
|
173
|
+
height: 12px;
|
|
174
|
+
border: 2px solid var(--ai-border-default);
|
|
175
|
+
border-top-color: var(--ai-text-muted);
|
|
176
|
+
border-radius: 50%;
|
|
177
|
+
animation: delete-spin 0.7s linear infinite;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
@keyframes delete-spin {
|
|
181
|
+
to { transform: rotate(360deg); }
|
|
182
|
+
}
|
|
183
|
+
|
|
164
184
|
/* ── Empty state ───────────────────────────────────────── */
|
|
165
185
|
|
|
166
186
|
.empty-state {
|
|
@@ -15,6 +15,8 @@ export class AiConversationList {
|
|
|
15
15
|
errorText = 'تعذّر تحميل المحادثات';
|
|
16
16
|
/** Retry button label for error state */
|
|
17
17
|
retryLabel = 'إعادة المحاولة';
|
|
18
|
+
/** ID of the conversation currently being deleted — shows a spinner on that item */
|
|
19
|
+
deletingId = '';
|
|
18
20
|
conversationSelect;
|
|
19
21
|
conversationDelete;
|
|
20
22
|
retryClick;
|
|
@@ -65,7 +67,7 @@ export class AiConversationList {
|
|
|
65
67
|
}
|
|
66
68
|
render() {
|
|
67
69
|
const showEmpty = !this.loading && !this.error && this.items.length === 0;
|
|
68
|
-
return (h(Host, { key: '
|
|
70
|
+
return (h(Host, { key: '8cf17cedd5c41f0d6ffd2d06e557dc370041d1aa' }, h("div", { key: '50f5eeb57228f55d72acf517ed5eeb5d79e13a4b', class: "conversation-list" }, h("div", { key: '763f7cb557fb9abea75e08379d0ea9090b00ac1e', class: "list-scroll", role: "list" }, this.loading
|
|
69
71
|
? this.renderSkeleton()
|
|
70
72
|
: this.error
|
|
71
73
|
? this.renderError()
|
|
@@ -73,10 +75,14 @@ export class AiConversationList {
|
|
|
73
75
|
? this.renderEmpty()
|
|
74
76
|
: this.items.map(item => {
|
|
75
77
|
const isActive = item.id === this.activeId;
|
|
76
|
-
return (h("div", { key: item.id, class: { 'conv-item': true, 'conv-item--active': isActive }, role: "listitem", "aria-current": isActive ? 'true' : undefined, onClick: () => this.conversationSelect.emit(item.id) }, h("div", { class: "conv-item__body" }, h("p", { class: "conv-item__title" }, item.title), h("p", { class: "conv-item__preview" }, item.preview), h("div", { class: "conv-item__meta" }, h("span", { class: "conv-item__time" }, this.formatRelativeTime(item.timestamp)), item.rating != null && this.renderRatingDots(item.rating))), h("button", { class:
|
|
78
|
+
return (h("div", { key: item.id, class: { 'conv-item': true, 'conv-item--active': isActive }, role: "listitem", "aria-current": isActive ? 'true' : undefined, onClick: () => this.conversationSelect.emit(item.id) }, h("div", { class: "conv-item__body" }, h("p", { class: "conv-item__title" }, item.title), h("p", { class: "conv-item__preview" }, item.preview), h("div", { class: "conv-item__meta" }, h("span", { class: "conv-item__time" }, this.formatRelativeTime(item.timestamp)), item.rating != null && this.renderRatingDots(item.rating))), h("button", { class: { 'delete-btn': true, 'delete-btn--deleting': this.deletingId === item.id }, "aria-label": "\u062D\u0630\u0641 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629", disabled: this.deletingId === item.id, onClick: e => {
|
|
77
79
|
e.stopPropagation();
|
|
80
|
+
if (this.deletingId === item.id)
|
|
81
|
+
return;
|
|
78
82
|
this.conversationDelete.emit(item.id);
|
|
79
|
-
} }, this.
|
|
83
|
+
} }, this.deletingId === item.id
|
|
84
|
+
? h("span", { class: "delete-spinner", "aria-label": "\u062C\u0627\u0631\u064A \u0627\u0644\u062D\u0630\u0641" })
|
|
85
|
+
: this.renderIcon('cancel', 14, 14))));
|
|
80
86
|
})))));
|
|
81
87
|
}
|
|
82
88
|
static get is() { return "ai-conversation-list"; }
|
|
@@ -236,6 +242,26 @@ export class AiConversationList {
|
|
|
236
242
|
"reflect": false,
|
|
237
243
|
"attribute": "retry-label",
|
|
238
244
|
"defaultValue": "'\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629'"
|
|
245
|
+
},
|
|
246
|
+
"deletingId": {
|
|
247
|
+
"type": "string",
|
|
248
|
+
"mutable": false,
|
|
249
|
+
"complexType": {
|
|
250
|
+
"original": "string",
|
|
251
|
+
"resolved": "string",
|
|
252
|
+
"references": {}
|
|
253
|
+
},
|
|
254
|
+
"required": false,
|
|
255
|
+
"optional": false,
|
|
256
|
+
"docs": {
|
|
257
|
+
"tags": [],
|
|
258
|
+
"text": "ID of the conversation currently being deleted \u2014 shows a spinner on that item"
|
|
259
|
+
},
|
|
260
|
+
"getter": false,
|
|
261
|
+
"setter": false,
|
|
262
|
+
"reflect": false,
|
|
263
|
+
"attribute": "deleting-id",
|
|
264
|
+
"defaultValue": "''"
|
|
239
265
|
}
|
|
240
266
|
};
|
|
241
267
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,H as i,c as e,h as a,d as n,t as o}from"./p-BPkf7wZg.js";import{i as s}from"./p-DlD8m3rf.js";import{d as r}from"./p-CJzVwMlS.js";const l=t(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.closeClick=e(this,"closeClick"),this.newChatClick=e(this,"newChatClick"),this.dropdownClick=e(this,"dropdownClick"),this.positionClick=e(this,"positionClick"),this.headerPositionClick=e(this,"headerPositionClick"),this.backClick=e(this,"backClick"),this.headerDragStart=e(this,"headerDragStart"),this.openExternal=e(this,"openExternal"),this.conversationSelect=e(this,"conversationSelect"),this.conversationDelete=e(this,"conversationDelete")}get el(){return this}mode="agent";conversation="محادثة جديدة";agentName="";agentStatus="";agentAvatar="";showBack=!0;statusIndicator="online";pageTitle="";pageUrl="";conversationItems=[];conversationActiveId="";conversationLoading=!1;titleLoading=!1;avatarError=!1;dropdownOpen=!1;isFloating=!1;parentPositionObserver=null;closeClick;newChatClick;dropdownClick;positionClick;headerPositionClick;backClick;headerDragStart;openExternal;conversationSelect;conversationDelete;handleDocumentClick(t){this.dropdownOpen&&!this.el.contains(t.target)&&(this.dropdownOpen=!1)}connectedCallback(){}componentDidLoad(){requestAnimationFrame((()=>{this.syncFloatingState(),this.observeParentPosition()}))}disconnectedCallback(){this.parentPositionObserver?.disconnect(),this.parentPositionObserver=null}observeParentPosition(){if(this.parentPositionObserver)return;const t=this.el.closest("ai-chat-container");t&&(this.parentPositionObserver=new MutationObserver((()=>this.syncFloatingState())),this.parentPositionObserver.observe(t,{attributes:!0,attributeFilter:["position"]}))}syncFloatingState(){const t=this.el.closest("ai-chat-container");if(t){const i="float"===t.getAttribute("position");this.isFloating!==i&&(this.isFloating=i)}else!1!==this.isFloating&&(this.isFloating=!1)}renderIcon(t,i,e){const n=s[t];return n?a("span",{class:"icon-wrap",innerHTML:`<svg width="${i}" height="${e}" viewBox="${n.viewBox}" fill="none" xmlns="http://www.w3.org/2000/svg">${n.content}</svg>`}):null}renderAvatar(){const t=this.agentName?this.agentName.charAt(0):"?";return!this.agentAvatar||this.avatarError?a("div",{class:"avatar-fallback"},t):a("img",{class:"avatar",src:this.agentAvatar,alt:this.agentName,onError:()=>{this.avatarError=!0}})}renderDragBtn(){return this.isFloating&&a("button",{class:"action-btn drag-btn","aria-label":"سحب / Drag",onPointerDown:t=>{t.preventDefault(),this.headerDragStart.emit({clientX:t.clientX,clientY:t.clientY})}},this.renderIcon("drag",11,15))}handleConversationSelect=t=>{t.stopPropagation(),this.conversationSelect.emit(t.detail),this.dropdownOpen=!1};handleConversationDelete=t=>{t.stopPropagation(),this.conversationDelete.emit(t.detail)};renderConversationDropdown(){return this.dropdownOpen&&"agent"===this.mode?a("div",{class:"conversation-dropdown"},a("ai-conversation-list",{items:this.conversationItems,activeId:this.conversationActiveId,loading:this.conversationLoading,onConversationSelect:this.handleConversationSelect,onConversationDelete:this.handleConversationDelete})):null}renderAgentMode(){return[this.renderDragBtn(),a("div",{class:"content agent dropdown-trigger",role:"button",onClick:()=>{this.titleLoading||(this.dropdownOpen=!this.dropdownOpen,this.dropdownClick.emit())},"aria-haspopup":"listbox","aria-expanded":this.dropdownOpen,"aria-label":this.conversation+", افتح قائمة المحادثات"},this.titleLoading?a("span",{class:"title-skeleton","aria-busy":"true","aria-label":"جاري التحميل"}):a("span",{class:"title"},this.conversation),!this.titleLoading&&a("span",{class:"dropdown-chevron"+(this.dropdownOpen?" open":"")},this.renderIcon("chevron-down",24,24))),a("div",{class:"actions"},a("button",{class:"action-btn","aria-label":"محادثة جديدة / New Chat",onClick:()=>this.newChatClick.emit()},this.renderIcon("pencil-edit",22,22)),a("button",{class:"action-btn","aria-label":"العرض / Position",onClick:()=>{this.positionClick.emit(),this.headerPositionClick.emit()}},this.renderIcon("hand",22,22)),a("button",{class:"action-btn","aria-label":"إغلاق / Close",onClick:()=>this.closeClick.emit()},this.renderIcon("cancel",22,22)))]}renderHumanMode(){return[this.renderDragBtn(),a("div",{class:"content human"},this.showBack&&a("button",{class:"back-btn","aria-label":"رجوع / Back",onClick:()=>this.backClick.emit()},this.renderIcon("arrow-right",24,24)),a("div",{class:"avatar-wrapper"},this.renderAvatar(),a("span",{class:"online-dot status-"+this.statusIndicator},this.renderIcon("online-dot",10,10))),a("div",{class:"text-block"},a("span",{class:"agent-name"},this.agentName),this.agentStatus&&a("span",{class:"agent-status"},this.agentStatus))),a("div",{class:"actions"},a("button",{class:"action-btn","aria-label":"العرض / Position",onClick:()=>{this.positionClick.emit(),this.headerPositionClick.emit()}},this.renderIcon("hand",22,22)),a("button",{class:"action-btn","aria-label":"إغلاق / Close",onClick:()=>this.closeClick.emit()},this.renderIcon("cancel",22,22)))]}renderBrowserMode(){return[this.renderDragBtn(),a("div",{class:"content browser"},a("button",{class:"back-btn","aria-label":"رجوع / Back",onClick:()=>this.backClick.emit()},this.renderIcon("arrow-right",24,24)),a("span",{class:"browser-title"},this.pageTitle),a("button",{class:"browser-link-btn","aria-label":"فتح في نافذة جديدة / Open externally",onClick:()=>this.openExternal.emit(this.pageUrl)},this.renderIcon("link",14,14))),a("div",{class:"actions"},a("button",{class:"action-btn","aria-label":"العرض / Position",onClick:()=>{this.positionClick.emit(),this.headerPositionClick.emit()}},this.renderIcon("hand",22,22)),a("button",{class:"action-btn","aria-label":"إغلاق / Close",onClick:()=>this.closeClick.emit()},this.renderIcon("cancel",22,22)))]}render(){return a(n,{key:"b11b4d03d7f1980ec91b0fdba7db314971b7e7d3"},a("div",{key:"47f40b54a6861b69adee00bea45ab8a6691c13f2",class:"header-wrapper"},a("div",{key:"dcc18d4cb88457c2eb959bfccb2c8d72655d610a",class:"header-container"},"agent"===this.mode?this.renderAgentMode():"human"===this.mode?this.renderHumanMode():this.renderBrowserMode()),this.renderConversationDropdown()))}static get style(){return":host{display:block;position:relative;z-index:10}.header-wrapper{position:relative;display:flex;flex-direction:column}.header-container{display:flex;align-items:center;gap:8px;padding:16px;background:var(--ai-bg-card);border-bottom:1px solid var(--ai-border-light);width:100%;box-sizing:border-box}.drag-btn{cursor:grab;color:var(--ai-text-muted)}.drag-btn:active{cursor:grabbing}.action-btn,.back-btn{width:40px;height:40px;padding:4px;display:flex;align-items:center;justify-content:center;background:var(--ai-bg-card);border:none;border-radius:8px;cursor:pointer;flex-shrink:0;color:var(--ai-text-primary);transition:background 0.15s ease}.action-btn:hover,.back-btn:hover{background:var(--ai-bg-surface)}.action-btn:focus-visible,.back-btn:focus-visible{outline:2px solid var(--ai-focus-ring);outline-offset:2px}.action-btn:active,.back-btn:active{background:var(--ai-bg-surface)}.actions{display:flex;align-items:center;gap:8px;flex-shrink:0}.content{flex:1 0 0;display:flex;align-items:center;justify-content:flex-start;min-width:0}.content.agent{gap:4px;height:40px}.content.human{gap:8px}.content.browser{gap:8px}.dropdown-trigger{display:flex;align-items:center;gap:4px;background:none;border:none;cursor:pointer;padding:0;flex-shrink:0;color:var(--ai-text-primary)}.dropdown-chevron{display:inline-flex;transition:transform 0.2s ease}.dropdown-chevron.open{transform:rotate(180deg)}.dropdown-trigger:focus-visible{outline:2px solid var(--ai-focus-ring);outline-offset:2px}.title{font-size:16px;font-weight:700;color:var(--ai-text-primary);white-space:nowrap;line-height:normal;min-width:0;overflow:hidden;text-overflow:ellipsis}@keyframes title-shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}.title-skeleton{display:inline-block;width:120px;height:16px;border-radius:8px;background:var(--ai-shimmer-gradient, linear-gradient(90deg, rgba(0,0,0,0.06) 25%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.06) 75%));background-size:200% 100%;animation:title-shimmer 1.6s ease-in-out infinite}.browser-title{font-size:14px;font-weight:600;color:var(--ai-text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;line-height:20px}.browser-link-btn{width:28px;height:28px;padding:0;display:inline-flex;align-items:center;justify-content:center;background:none;border:none;border-radius:8px;cursor:pointer;flex-shrink:0;color:var(--ai-text-secondary)}.browser-link-btn:focus-visible{outline:2px solid var(--ai-focus-ring);outline-offset:2px}.avatar-wrapper{position:relative;width:40px;height:40px;flex-shrink:0}.avatar{width:40px;height:40px;border-radius:9999px;border:1px solid var(--ai-border-default);object-fit:cover;display:block}.avatar-fallback{width:40px;height:40px;border-radius:9999px;border:1px solid var(--ai-border-default);background:var(--ai-bg-surface);color:var(--ai-text-primary);font-size:16px;font-weight:600;display:flex;align-items:center;justify-content:center;flex-shrink:0}.online-dot{position:absolute;bottom:0;inset-inline-end:0;width:10px;height:10px;display:inline-flex;align-items:center;justify-content:center;color:var(--ai-bg-card);}.online-dot.status-online{color:#22c55e;}.online-dot.status-offline{color:#9ca3af;}.online-dot.status-busy{color:#ef4444;}.online-dot.status-away{color:#f59e0b;}.text-block{display:flex;flex-direction:column;align-items:flex-start;gap:0;flex-shrink:0}.agent-name{font-size:14px;font-weight:500;color:var(--ai-text-primary);line-height:20px;white-space:nowrap}.agent-status{font-size:14px;font-weight:400;color:var(--ai-text-secondary);line-height:20px;white-space:nowrap}.icon-wrap{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}.icon-wrap svg{display:block}:host-context([dir='ltr']) .back-btn .icon-wrap,:host([dir='ltr']) .back-btn .icon-wrap{transform:scaleX(-1)}.conversation-dropdown{position:absolute;top:100%;left:0;right:0;z-index:20;height:360px;display:flex;flex-direction:column;background:var(--ai-bg-surface);border-bottom:1px solid var(--ai-border-light);box-shadow:var(--ai-shadow-md, 0 4px 12px rgba(0, 0, 0, 0.08));animation:slideDown 0.2s ease;overflow:hidden}.conversation-dropdown ai-conversation-list{display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden}@keyframes slideDown{from{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}"}},[513,"ai-chat-header",{mode:[1],conversation:[1],agentName:[1,"agent-name"],agentStatus:[1,"agent-status"],agentAvatar:[1,"agent-avatar"],showBack:[4,"show-back"],statusIndicator:[1,"status-indicator"],pageTitle:[1,"page-title"],pageUrl:[1,"page-url"],conversationItems:[16],conversationActiveId:[1,"conversation-active-id"],conversationLoading:[4,"conversation-loading"],titleLoading:[4,"title-loading"],avatarError:[32],dropdownOpen:[32],isFloating:[32]},[[4,"click","handleDocumentClick"]]]),c=l,d=function(){"undefined"!=typeof customElements&&["ai-chat-header","ai-conversation-list"].forEach((t=>{switch(t){case"ai-chat-header":customElements.get(o(t))||customElements.define(o(t),l);break;case"ai-conversation-list":customElements.get(o(t))||r()}}))};export{c as AiChatHeader,d as defineCustomElement}
|
|
1
|
+
import{p as t,H as i,c as e,h as n,d as a,t as o}from"./p-BPkf7wZg.js";import{i as s}from"./p-DlD8m3rf.js";import{d as r}from"./p-CFSr3KcL.js";const l=t(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.closeClick=e(this,"closeClick"),this.newChatClick=e(this,"newChatClick"),this.dropdownClick=e(this,"dropdownClick"),this.positionClick=e(this,"positionClick"),this.headerPositionClick=e(this,"headerPositionClick"),this.backClick=e(this,"backClick"),this.headerDragStart=e(this,"headerDragStart"),this.openExternal=e(this,"openExternal"),this.conversationSelect=e(this,"conversationSelect"),this.conversationDelete=e(this,"conversationDelete"),this.conversationRetry=e(this,"conversationRetry")}get el(){return this}mode="agent";conversation="محادثة جديدة";agentName="";agentStatus="";agentAvatar="";showBack=!0;statusIndicator="online";pageTitle="";pageUrl="";conversationItems=[];conversationActiveId="";conversationLoading=!1;conversationError=!1;conversationErrorText="تعذّر تحميل المحادثات";conversationRetryLabel="إعادة المحاولة";conversationEmptyText="لا توجد محادثات";conversationDeletingId="";titleLoading=!1;avatarError=!1;dropdownOpen=!1;isFloating=!1;parentPositionObserver=null;closeClick;newChatClick;dropdownClick;positionClick;headerPositionClick;backClick;headerDragStart;openExternal;conversationSelect;conversationDelete;conversationRetry;handleDocumentClick(t){this.dropdownOpen&&!this.el.contains(t.target)&&(this.dropdownOpen=!1)}connectedCallback(){}componentDidLoad(){requestAnimationFrame((()=>{this.syncFloatingState(),this.observeParentPosition()}))}disconnectedCallback(){this.parentPositionObserver?.disconnect(),this.parentPositionObserver=null}observeParentPosition(){if(this.parentPositionObserver)return;const t=this.el.closest("ai-chat-container");t&&(this.parentPositionObserver=new MutationObserver((()=>this.syncFloatingState())),this.parentPositionObserver.observe(t,{attributes:!0,attributeFilter:["position"]}))}syncFloatingState(){const t=this.el.closest("ai-chat-container");if(t){const i="float"===t.getAttribute("position");this.isFloating!==i&&(this.isFloating=i)}else!1!==this.isFloating&&(this.isFloating=!1)}renderIcon(t,i,e){const a=s[t];return a?n("span",{class:"icon-wrap",innerHTML:`<svg width="${i}" height="${e}" viewBox="${a.viewBox}" fill="none" xmlns="http://www.w3.org/2000/svg">${a.content}</svg>`}):null}renderAvatar(){const t=this.agentName?this.agentName.charAt(0):"?";return!this.agentAvatar||this.avatarError?n("div",{class:"avatar-fallback"},t):n("img",{class:"avatar",src:this.agentAvatar,alt:this.agentName,onError:()=>{this.avatarError=!0}})}renderDragBtn(){return this.isFloating&&n("button",{class:"action-btn drag-btn","aria-label":"سحب / Drag",onPointerDown:t=>{t.preventDefault(),this.headerDragStart.emit({clientX:t.clientX,clientY:t.clientY})}},this.renderIcon("drag",11,15))}handleConversationSelect=t=>{t.stopPropagation(),this.conversationSelect.emit(t.detail),this.dropdownOpen=!1};handleConversationDelete=t=>{t.stopPropagation(),this.conversationDelete.emit(t.detail)};handleConversationRetry=t=>{t.stopPropagation(),this.conversationRetry.emit()};renderConversationDropdown(){return this.dropdownOpen&&"agent"===this.mode?n("div",{class:"conversation-dropdown"},n("ai-conversation-list",{items:this.conversationItems,activeId:this.conversationActiveId,loading:this.conversationLoading,error:this.conversationError,errorText:this.conversationErrorText,retryLabel:this.conversationRetryLabel,emptyText:this.conversationEmptyText,deletingId:this.conversationDeletingId,onConversationSelect:this.handleConversationSelect,onConversationDelete:this.handleConversationDelete,onRetryClick:this.handleConversationRetry})):null}renderAgentMode(){return[this.renderDragBtn(),n("div",{class:"content agent dropdown-trigger",role:"button",onClick:()=>{this.titleLoading||(this.dropdownOpen=!this.dropdownOpen,this.dropdownClick.emit())},"aria-haspopup":"listbox","aria-expanded":this.dropdownOpen,"aria-label":this.conversation+", افتح قائمة المحادثات"},this.titleLoading?n("span",{class:"title-skeleton","aria-busy":"true","aria-label":"جاري التحميل"}):n("span",{class:"title"},this.conversation),!this.titleLoading&&n("span",{class:"dropdown-chevron"+(this.dropdownOpen?" open":"")},this.renderIcon("chevron-down",24,24))),n("div",{class:"actions"},n("button",{class:"action-btn","aria-label":"محادثة جديدة / New Chat",onClick:()=>this.newChatClick.emit()},this.renderIcon("pencil-edit",22,22)),n("button",{class:"action-btn","aria-label":"العرض / Position",onClick:()=>{this.positionClick.emit(),this.headerPositionClick.emit()}},this.renderIcon("hand",22,22)),n("button",{class:"action-btn","aria-label":"إغلاق / Close",onClick:()=>this.closeClick.emit()},this.renderIcon("cancel",22,22)))]}renderHumanMode(){return[this.renderDragBtn(),n("div",{class:"content human"},this.showBack&&n("button",{class:"back-btn","aria-label":"رجوع / Back",onClick:()=>this.backClick.emit()},this.renderIcon("arrow-right",24,24)),n("div",{class:"avatar-wrapper"},this.renderAvatar(),n("span",{class:"online-dot status-"+this.statusIndicator},this.renderIcon("online-dot",10,10))),n("div",{class:"text-block"},n("span",{class:"agent-name"},this.agentName),this.agentStatus&&n("span",{class:"agent-status"},this.agentStatus))),n("div",{class:"actions"},n("button",{class:"action-btn","aria-label":"العرض / Position",onClick:()=>{this.positionClick.emit(),this.headerPositionClick.emit()}},this.renderIcon("hand",22,22)),n("button",{class:"action-btn","aria-label":"إغلاق / Close",onClick:()=>this.closeClick.emit()},this.renderIcon("cancel",22,22)))]}renderBrowserMode(){return[this.renderDragBtn(),n("div",{class:"content browser"},n("button",{class:"back-btn","aria-label":"رجوع / Back",onClick:()=>this.backClick.emit()},this.renderIcon("arrow-right",24,24)),n("span",{class:"browser-title"},this.pageTitle),n("button",{class:"browser-link-btn","aria-label":"فتح في نافذة جديدة / Open externally",onClick:()=>this.openExternal.emit(this.pageUrl)},this.renderIcon("link",14,14))),n("div",{class:"actions"},n("button",{class:"action-btn","aria-label":"العرض / Position",onClick:()=>{this.positionClick.emit(),this.headerPositionClick.emit()}},this.renderIcon("hand",22,22)),n("button",{class:"action-btn","aria-label":"إغلاق / Close",onClick:()=>this.closeClick.emit()},this.renderIcon("cancel",22,22)))]}render(){return n(a,{key:"874ee1e0eb62a59a4c9713111856594ef03dd435"},n("div",{key:"d8887800ad270c7878f41bdc930b2ca6b1280935",class:"header-wrapper"},n("div",{key:"a4fc7e86851cc1cdce6c686880b9f4ee33342fb7",class:"header-container"},"agent"===this.mode?this.renderAgentMode():"human"===this.mode?this.renderHumanMode():this.renderBrowserMode()),this.renderConversationDropdown()))}static get style(){return":host{display:block;position:relative;z-index:10}.header-wrapper{position:relative;display:flex;flex-direction:column}.header-container{display:flex;align-items:center;gap:8px;padding:16px;background:var(--ai-bg-card);border-bottom:1px solid var(--ai-border-light);width:100%;box-sizing:border-box}.drag-btn{cursor:grab;color:var(--ai-text-muted)}.drag-btn:active{cursor:grabbing}.action-btn,.back-btn{width:40px;height:40px;padding:4px;display:flex;align-items:center;justify-content:center;background:var(--ai-bg-card);border:none;border-radius:8px;cursor:pointer;flex-shrink:0;color:var(--ai-text-primary);transition:background 0.15s ease}.action-btn:hover,.back-btn:hover{background:var(--ai-bg-surface)}.action-btn:focus-visible,.back-btn:focus-visible{outline:2px solid var(--ai-focus-ring);outline-offset:2px}.action-btn:active,.back-btn:active{background:var(--ai-bg-surface)}.actions{display:flex;align-items:center;gap:8px;flex-shrink:0}.content{flex:1 0 0;display:flex;align-items:center;justify-content:flex-start;min-width:0}.content.agent{gap:4px;height:40px}.content.human{gap:8px}.content.browser{gap:8px}.dropdown-trigger{display:flex;align-items:center;gap:4px;background:none;border:none;cursor:pointer;padding:0;flex-shrink:0;color:var(--ai-text-primary)}.dropdown-chevron{display:inline-flex;transition:transform 0.2s ease}.dropdown-chevron.open{transform:rotate(180deg)}.dropdown-trigger:focus-visible{outline:2px solid var(--ai-focus-ring);outline-offset:2px}.title{font-size:16px;font-weight:700;color:var(--ai-text-primary);white-space:nowrap;line-height:normal;min-width:0;overflow:hidden;text-overflow:ellipsis}@keyframes title-shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}.title-skeleton{display:inline-block;width:120px;height:16px;border-radius:8px;background:var(--ai-shimmer-gradient, linear-gradient(90deg, rgba(0,0,0,0.06) 25%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.06) 75%));background-size:200% 100%;animation:title-shimmer 1.6s ease-in-out infinite}.browser-title{font-size:14px;font-weight:600;color:var(--ai-text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;line-height:20px}.browser-link-btn{width:28px;height:28px;padding:0;display:inline-flex;align-items:center;justify-content:center;background:none;border:none;border-radius:8px;cursor:pointer;flex-shrink:0;color:var(--ai-text-secondary)}.browser-link-btn:focus-visible{outline:2px solid var(--ai-focus-ring);outline-offset:2px}.avatar-wrapper{position:relative;width:40px;height:40px;flex-shrink:0}.avatar{width:40px;height:40px;border-radius:9999px;border:1px solid var(--ai-border-default);object-fit:cover;display:block}.avatar-fallback{width:40px;height:40px;border-radius:9999px;border:1px solid var(--ai-border-default);background:var(--ai-bg-surface);color:var(--ai-text-primary);font-size:16px;font-weight:600;display:flex;align-items:center;justify-content:center;flex-shrink:0}.online-dot{position:absolute;bottom:0;inset-inline-end:0;width:10px;height:10px;display:inline-flex;align-items:center;justify-content:center;color:var(--ai-bg-card);}.online-dot.status-online{color:#22c55e;}.online-dot.status-offline{color:#9ca3af;}.online-dot.status-busy{color:#ef4444;}.online-dot.status-away{color:#f59e0b;}.text-block{display:flex;flex-direction:column;align-items:flex-start;gap:0;flex-shrink:0}.agent-name{font-size:14px;font-weight:500;color:var(--ai-text-primary);line-height:20px;white-space:nowrap}.agent-status{font-size:14px;font-weight:400;color:var(--ai-text-secondary);line-height:20px;white-space:nowrap}.icon-wrap{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}.icon-wrap svg{display:block}:host-context([dir='ltr']) .back-btn .icon-wrap,:host([dir='ltr']) .back-btn .icon-wrap{transform:scaleX(-1)}.conversation-dropdown{position:absolute;top:100%;left:0;right:0;z-index:20;height:360px;display:flex;flex-direction:column;background:var(--ai-bg-surface);border-bottom:1px solid var(--ai-border-light);box-shadow:var(--ai-shadow-md, 0 4px 12px rgba(0, 0, 0, 0.08));animation:slideDown 0.2s ease;overflow:hidden}.conversation-dropdown ai-conversation-list{display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden}@keyframes slideDown{from{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}"}},[513,"ai-chat-header",{mode:[1],conversation:[1],agentName:[1,"agent-name"],agentStatus:[1,"agent-status"],agentAvatar:[1,"agent-avatar"],showBack:[4,"show-back"],statusIndicator:[1,"status-indicator"],pageTitle:[1,"page-title"],pageUrl:[1,"page-url"],conversationItems:[16],conversationActiveId:[1,"conversation-active-id"],conversationLoading:[4,"conversation-loading"],conversationError:[4,"conversation-error"],conversationErrorText:[1,"conversation-error-text"],conversationRetryLabel:[1,"conversation-retry-label"],conversationEmptyText:[1,"conversation-empty-text"],conversationDeletingId:[1,"conversation-deleting-id"],titleLoading:[4,"title-loading"],avatarError:[32],dropdownOpen:[32],isFloating:[32]},[[4,"click","handleDocumentClick"]]]),c=l,h=function(){"undefined"!=typeof customElements&&["ai-chat-header","ai-conversation-list"].forEach((t=>{switch(t){case"ai-chat-header":customElements.get(o(t))||customElements.define(o(t),l);break;case"ai-conversation-list":customElements.get(o(t))||r()}}))};export{c as AiChatHeader,h as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as o,d as
|
|
1
|
+
import{A as o,d as r}from"./p-CFSr3KcL.js";const s=o,p=r;export{s as AiConversationList,p as defineCustomElement}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as e,H as t,c as i,h as r,d as a,t as n}from"./p-BPkf7wZg.js";import{i as s}from"./p-DlD8m3rf.js";const o=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.conversationSelect=i(this,"conversationSelect"),this.conversationDelete=i(this,"conversationDelete"),this.retryClick=i(this,"retryClick")}items=[];activeId="";loading=!1;emptyText="لا توجد محادثات";error=!1;errorText="تعذّر تحميل المحادثات";retryLabel="إعادة المحاولة";deletingId="";conversationSelect;conversationDelete;retryClick;renderIcon(e,t,i){const a=s[e];return a?r("span",{class:"icon-wrap",innerHTML:`<svg width="${t}" height="${i}" viewBox="${a.viewBox}" fill="none" xmlns="http://www.w3.org/2000/svg">${a.content}</svg>`}):null}formatRelativeTime(e){if(!e)return"";try{const t=new Date(e);if(isNaN(t.getTime()))return e;const i=Date.now()-t.getTime(),r=Math.floor(i/6e4),a=Math.floor(r/60),n=Math.floor(a/24),s="undefined"!=typeof document&&document.documentElement.lang||"ar",o=new Intl.RelativeTimeFormat(s,{numeric:"auto"});return r<1?o.format(0,"second"):r<60?o.format(-r,"minute"):a<24?o.format(-a,"hour"):o.format(-n,"day")}catch{return e}}renderRatingDots(e){return r("div",{class:"rating-dots","aria-label":e?`تقييم ${e} من 5`:void 0},Array.from({length:5},((t,i)=>r("span",{class:"rating-dot "+(i<(e??0)?"rating-dot--filled":"")}))))}renderSkeleton(){return r("div",{class:"skeleton-list"},[1,2,3,4].map((e=>r("div",{key:e,class:"skeleton-item"},r("div",{class:"skeleton-line skeleton-line--title"}),r("div",{class:"skeleton-line skeleton-line--preview"}),r("div",{class:"skeleton-line skeleton-line--meta"})))))}renderEmpty(){return r("div",{class:"empty-state"},r("div",{class:"empty-state__icon"},this.renderIcon("list",24,24)),r("p",{class:"empty-state__text"},this.emptyText))}renderError(){return r("div",{class:"error-state"},r("div",{class:"error-state__icon"},this.renderIcon("wifi-off",24,24)),r("p",{class:"error-state__text"},this.errorText),r("button",{class:"error-state__retry",onClick:()=>this.retryClick.emit()},this.renderIcon("reload",14,14),r("span",null,this.retryLabel)))}render(){const e=!this.loading&&!this.error&&0===this.items.length;return r(a,{key:"8cf17cedd5c41f0d6ffd2d06e557dc370041d1aa"},r("div",{key:"50f5eeb57228f55d72acf517ed5eeb5d79e13a4b",class:"conversation-list"},r("div",{key:"763f7cb557fb9abea75e08379d0ea9090b00ac1e",class:"list-scroll",role:"list"},this.loading?this.renderSkeleton():this.error?this.renderError():e?this.renderEmpty():this.items.map((e=>{const t=e.id===this.activeId;return r("div",{key:e.id,class:{"conv-item":!0,"conv-item--active":t},role:"listitem","aria-current":t?"true":void 0,onClick:()=>this.conversationSelect.emit(e.id)},r("div",{class:"conv-item__body"},r("p",{class:"conv-item__title"},e.title),r("p",{class:"conv-item__preview"},e.preview),r("div",{class:"conv-item__meta"},r("span",{class:"conv-item__time"},this.formatRelativeTime(e.timestamp)),null!=e.rating&&this.renderRatingDots(e.rating))),r("button",{class:{"delete-btn":!0,"delete-btn--deleting":this.deletingId===e.id},"aria-label":"حذف المحادثة",disabled:this.deletingId===e.id,onClick:t=>{t.stopPropagation(),this.deletingId!==e.id&&this.conversationDelete.emit(e.id)}},this.deletingId===e.id?r("span",{class:"delete-spinner","aria-label":"جاري الحذف"}):this.renderIcon("cancel",14,14)))})))))}static get style(){return":host{display:flex;flex-direction:column;height:100%;min-height:0;overflow:hidden}.conversation-list{display:flex;flex-direction:column;gap:8px;flex:1;min-height:0;background:var(--ai-bg-surface)}.list-scroll{flex:1;min-height:0;overflow-y:auto;padding:0 8px 12px;scrollbar-width:thin;scrollbar-color:var(--ai-scrollbar-thumb) transparent}.list-scroll::-webkit-scrollbar{width:3px}.list-scroll::-webkit-scrollbar-track{background:transparent}.list-scroll::-webkit-scrollbar-thumb{background:var(--ai-scrollbar-thumb);border-radius:99px}.list-scroll::-webkit-scrollbar-thumb:hover{background:var(--ai-scrollbar-thumb-hover)}.conv-item{display:flex;align-items:flex-start;gap:6px;margin-top:6px;padding:10px 10px 10px 6px;border-radius:10px;cursor:pointer;transition:background 0.15s;position:relative}.conv-item:hover{background:var(--ai-bg-card)}.conv-item--active{background:var(--ai-bg-card);box-shadow:var(--ai-shadow-sm)}.conv-item__body{flex:1;min-width:0}.conv-item__title{margin:0 0 3px;font-size:13px;font-weight:600;color:var(--ai-text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.conv-item__preview{margin:0 0 5px;font-size:12px;color:var(--ai-text-muted);line-height:1.45;display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.conv-item__meta{display:flex;align-items:center;gap:8px}.conv-item__time{font-size:11px;color:var(--ai-text-muted);flex-shrink:0}.rating-dots{display:flex;align-items:center;gap:3px}.rating-dot{width:6px;height:6px;border-radius:50%;background:var(--ai-border-default);transition:background 0.15s}.rating-dot--filled{background:var(--ai-accent-warning, #ffaf44)}.delete-btn{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;background:transparent;border:none;border-radius:6px;cursor:pointer;color:var(--ai-text-muted);opacity:0;transition:opacity 0.15s, background 0.15s, color 0.15s;margin-block-start:2px}.conv-item:hover .delete-btn,.conv-item--active .delete-btn{opacity:1}.delete-btn:hover{background:var(--ai-status-danger-bg, rgba(239, 68, 68, 0.1));color:var(--ai-status-danger, #ef4444)}.delete-btn .icon-wrap{display:inline-flex;align-items:center;line-height:0}.delete-btn--deleting{opacity:1;cursor:default;pointer-events:none}.delete-spinner{display:block;width:12px;height:12px;border:2px solid var(--ai-border-default);border-top-color:var(--ai-text-muted);border-radius:50%;animation:delete-spin 0.7s linear infinite}@keyframes delete-spin{to{transform:rotate(360deg)}}.empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:40px 16px;text-align:center}.empty-state__icon{display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:10px;background:var(--ai-bg-card);color:var(--ai-text-muted);line-height:0}.empty-state__icon .icon-wrap{display:inline-flex;align-items:center;line-height:0}.empty-state__text{margin:0;font-size:13px;color:var(--ai-text-muted);line-height:1.4}.error-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:40px 16px;text-align:center}.error-state__icon{display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:10px;background:var(--ai-status-danger-bg, rgba(239, 68, 68, 0.1));color:var(--ai-status-danger, #ef4444);line-height:0}.error-state__icon .icon-wrap{display:inline-flex;align-items:center;line-height:0}.error-state__text{margin:0;font-size:13px;color:var(--ai-text-muted);line-height:1.4}.error-state__retry{display:inline-flex;align-items:center;gap:4px;margin-top:4px;padding:6px 14px;font-size:12px;font-weight:600;color:var(--ai-text-primary);background:var(--ai-bg-card);border:1px solid var(--ai-border-default);border-radius:8px;cursor:pointer;transition:background 0.15s, box-shadow 0.15s}.error-state__retry:hover{box-shadow:var(--ai-shadow-sm)}.error-state__retry .icon-wrap{display:inline-flex;align-items:center;line-height:0}.skeleton-list{display:flex;flex-direction:column;gap:4px}.skeleton-item{padding:10px;border-radius:10px;display:flex;flex-direction:column;gap:6px}.skeleton-line{border-radius:6px;background:var(--ai-shimmer-gradient, linear-gradient(90deg, rgba(0, 0, 0, 0.06) 25%, rgba(0, 0, 0, 0.1) 50%, rgba(0, 0, 0, 0.06) 75%));background-size:200% 100%;animation:shimmer 2s linear infinite;height:12px}.skeleton-line--title{width:65%;height:13px}.skeleton-line--preview{width:100%}.skeleton-line--meta{width:35%;height:10px}@keyframes shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}"}},[513,"ai-conversation-list",{items:[16],activeId:[1,"active-id"],loading:[4],emptyText:[1,"empty-text"],error:[4],errorText:[1,"error-text"],retryLabel:[1,"retry-label"],deletingId:[1,"deleting-id"]}]);function l(){"undefined"!=typeof customElements&&["ai-conversation-list"].forEach((e=>{"ai-conversation-list"===e&&(customElements.get(n(e))||customElements.define(n(e),o))}))}export{o as A,l as d}
|
|
@@ -16,6 +16,7 @@ const AiChatHeader = class {
|
|
|
16
16
|
this.openExternal = createEvent(this, "openExternal");
|
|
17
17
|
this.conversationSelect = createEvent(this, "conversationSelect");
|
|
18
18
|
this.conversationDelete = createEvent(this, "conversationDelete");
|
|
19
|
+
this.conversationRetry = createEvent(this, "conversationRetry");
|
|
19
20
|
}
|
|
20
21
|
get el() { return getElement(this); }
|
|
21
22
|
/** Layout variant */
|
|
@@ -42,6 +43,16 @@ const AiChatHeader = class {
|
|
|
42
43
|
conversationActiveId = '';
|
|
43
44
|
/** Conversation list: show skeleton loading state */
|
|
44
45
|
conversationLoading = false;
|
|
46
|
+
/** Conversation list: show error state */
|
|
47
|
+
conversationError = false;
|
|
48
|
+
/** Conversation list: error message text */
|
|
49
|
+
conversationErrorText = 'تعذّر تحميل المحادثات';
|
|
50
|
+
/** Conversation list: retry button label */
|
|
51
|
+
conversationRetryLabel = 'إعادة المحاولة';
|
|
52
|
+
/** Conversation list: empty state label */
|
|
53
|
+
conversationEmptyText = 'لا توجد محادثات';
|
|
54
|
+
/** Conversation list: ID of the conversation currently being deleted — shows a spinner on that item */
|
|
55
|
+
conversationDeletingId = '';
|
|
45
56
|
/** Show a shimmer skeleton in place of the conversation title (e.g. while loading conversation) */
|
|
46
57
|
titleLoading = false;
|
|
47
58
|
avatarError = false;
|
|
@@ -75,6 +86,8 @@ const AiChatHeader = class {
|
|
|
75
86
|
conversationSelect;
|
|
76
87
|
/** Fired when a conversation delete button is clicked */
|
|
77
88
|
conversationDelete;
|
|
89
|
+
/** Fired when the retry button is clicked in the conversation list error state */
|
|
90
|
+
conversationRetry;
|
|
78
91
|
handleDocumentClick(event) {
|
|
79
92
|
if (this.dropdownOpen && !this.el.contains(event.target)) {
|
|
80
93
|
this.dropdownOpen = false;
|
|
@@ -148,10 +161,14 @@ const AiChatHeader = class {
|
|
|
148
161
|
e.stopPropagation();
|
|
149
162
|
this.conversationDelete.emit(e.detail);
|
|
150
163
|
};
|
|
164
|
+
handleConversationRetry = (e) => {
|
|
165
|
+
e.stopPropagation();
|
|
166
|
+
this.conversationRetry.emit();
|
|
167
|
+
};
|
|
151
168
|
renderConversationDropdown() {
|
|
152
169
|
if (!this.dropdownOpen || this.mode !== 'agent')
|
|
153
170
|
return null;
|
|
154
|
-
return (h("div", { class: "conversation-dropdown" }, h("ai-conversation-list", { items: this.conversationItems, activeId: this.conversationActiveId, loading: this.conversationLoading, onConversationSelect: this.handleConversationSelect, onConversationDelete: this.handleConversationDelete })));
|
|
171
|
+
return (h("div", { class: "conversation-dropdown" }, h("ai-conversation-list", { items: this.conversationItems, activeId: this.conversationActiveId, loading: this.conversationLoading, error: this.conversationError, errorText: this.conversationErrorText, retryLabel: this.conversationRetryLabel, emptyText: this.conversationEmptyText, deletingId: this.conversationDeletingId, onConversationSelect: this.handleConversationSelect, onConversationDelete: this.handleConversationDelete, onRetryClick: this.handleConversationRetry })));
|
|
155
172
|
}
|
|
156
173
|
renderAgentMode() {
|
|
157
174
|
return [
|
|
@@ -180,7 +197,7 @@ const AiChatHeader = class {
|
|
|
180
197
|
];
|
|
181
198
|
}
|
|
182
199
|
render() {
|
|
183
|
-
return (h(Host, { key: '
|
|
200
|
+
return (h(Host, { key: '874ee1e0eb62a59a4c9713111856594ef03dd435' }, h("div", { key: 'd8887800ad270c7878f41bdc930b2ca6b1280935', class: "header-wrapper" }, h("div", { key: 'a4fc7e86851cc1cdce6c686880b9f4ee33342fb7', class: "header-container" }, this.mode === 'agent' ? this.renderAgentMode() : this.mode === 'human' ? this.renderHumanMode() : this.renderBrowserMode()), this.renderConversationDropdown())));
|
|
184
201
|
}
|
|
185
202
|
};
|
|
186
203
|
AiChatHeader.style = aiChatHeaderCss();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host } from './index-VMEwYfaX.js';
|
|
2
2
|
import { i as iconRegistry } from './icon-registry-DlD8m3rf.js';
|
|
3
3
|
|
|
4
|
-
const aiConversationListCss = () => `:host{display:flex;flex-direction:column;height:100%;min-height:0;overflow:hidden}.conversation-list{display:flex;flex-direction:column;gap:8px;flex:1;min-height:0;background:var(--ai-bg-surface)}.list-scroll{flex:1;min-height:0;overflow-y:auto;padding:0 8px 12px;scrollbar-width:thin;scrollbar-color:var(--ai-scrollbar-thumb) transparent}.list-scroll::-webkit-scrollbar{width:3px}.list-scroll::-webkit-scrollbar-track{background:transparent}.list-scroll::-webkit-scrollbar-thumb{background:var(--ai-scrollbar-thumb);border-radius:99px}.list-scroll::-webkit-scrollbar-thumb:hover{background:var(--ai-scrollbar-thumb-hover)}.conv-item{display:flex;align-items:flex-start;gap:6px;margin-top:6px;padding:10px 10px 10px 6px;border-radius:10px;cursor:pointer;transition:background 0.15s;position:relative}.conv-item:hover{background:var(--ai-bg-card)}.conv-item--active{background:var(--ai-bg-card);box-shadow:var(--ai-shadow-sm)}.conv-item__body{flex:1;min-width:0}.conv-item__title{margin:0 0 3px;font-size:13px;font-weight:600;color:var(--ai-text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.conv-item__preview{margin:0 0 5px;font-size:12px;color:var(--ai-text-muted);line-height:1.45;display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.conv-item__meta{display:flex;align-items:center;gap:8px}.conv-item__time{font-size:11px;color:var(--ai-text-muted);flex-shrink:0}.rating-dots{display:flex;align-items:center;gap:3px}.rating-dot{width:6px;height:6px;border-radius:50%;background:var(--ai-border-default);transition:background 0.15s}.rating-dot--filled{background:var(--ai-accent-warning, #ffaf44)}.delete-btn{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;background:transparent;border:none;border-radius:6px;cursor:pointer;color:var(--ai-text-muted);opacity:0;transition:opacity 0.15s, background 0.15s, color 0.15s;margin-block-start:2px}.conv-item:hover .delete-btn,.conv-item--active .delete-btn{opacity:1}.delete-btn:hover{background:var(--ai-status-danger-bg, rgba(239, 68, 68, 0.1));color:var(--ai-status-danger, #ef4444)}.delete-btn .icon-wrap{display:inline-flex;align-items:center;line-height:0}.empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:40px 16px;text-align:center}.empty-state__icon{display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:10px;background:var(--ai-bg-card);color:var(--ai-text-muted);line-height:0}.empty-state__icon .icon-wrap{display:inline-flex;align-items:center;line-height:0}.empty-state__text{margin:0;font-size:13px;color:var(--ai-text-muted);line-height:1.4}.error-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:40px 16px;text-align:center}.error-state__icon{display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:10px;background:var(--ai-status-danger-bg, rgba(239, 68, 68, 0.1));color:var(--ai-status-danger, #ef4444);line-height:0}.error-state__icon .icon-wrap{display:inline-flex;align-items:center;line-height:0}.error-state__text{margin:0;font-size:13px;color:var(--ai-text-muted);line-height:1.4}.error-state__retry{display:inline-flex;align-items:center;gap:4px;margin-top:4px;padding:6px 14px;font-size:12px;font-weight:600;color:var(--ai-text-primary);background:var(--ai-bg-card);border:1px solid var(--ai-border-default);border-radius:8px;cursor:pointer;transition:background 0.15s, box-shadow 0.15s}.error-state__retry:hover{box-shadow:var(--ai-shadow-sm)}.error-state__retry .icon-wrap{display:inline-flex;align-items:center;line-height:0}.skeleton-list{display:flex;flex-direction:column;gap:4px}.skeleton-item{padding:10px;border-radius:10px;display:flex;flex-direction:column;gap:6px}.skeleton-line{border-radius:6px;background:var(--ai-shimmer-gradient, linear-gradient(90deg, rgba(0, 0, 0, 0.06) 25%, rgba(0, 0, 0, 0.1) 50%, rgba(0, 0, 0, 0.06) 75%));background-size:200% 100%;animation:shimmer 2s linear infinite;height:12px}.skeleton-line--title{width:65%;height:13px}.skeleton-line--preview{width:100%}.skeleton-line--meta{width:35%;height:10px}@keyframes shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}`;
|
|
4
|
+
const aiConversationListCss = () => `:host{display:flex;flex-direction:column;height:100%;min-height:0;overflow:hidden}.conversation-list{display:flex;flex-direction:column;gap:8px;flex:1;min-height:0;background:var(--ai-bg-surface)}.list-scroll{flex:1;min-height:0;overflow-y:auto;padding:0 8px 12px;scrollbar-width:thin;scrollbar-color:var(--ai-scrollbar-thumb) transparent}.list-scroll::-webkit-scrollbar{width:3px}.list-scroll::-webkit-scrollbar-track{background:transparent}.list-scroll::-webkit-scrollbar-thumb{background:var(--ai-scrollbar-thumb);border-radius:99px}.list-scroll::-webkit-scrollbar-thumb:hover{background:var(--ai-scrollbar-thumb-hover)}.conv-item{display:flex;align-items:flex-start;gap:6px;margin-top:6px;padding:10px 10px 10px 6px;border-radius:10px;cursor:pointer;transition:background 0.15s;position:relative}.conv-item:hover{background:var(--ai-bg-card)}.conv-item--active{background:var(--ai-bg-card);box-shadow:var(--ai-shadow-sm)}.conv-item__body{flex:1;min-width:0}.conv-item__title{margin:0 0 3px;font-size:13px;font-weight:600;color:var(--ai-text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.conv-item__preview{margin:0 0 5px;font-size:12px;color:var(--ai-text-muted);line-height:1.45;display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.conv-item__meta{display:flex;align-items:center;gap:8px}.conv-item__time{font-size:11px;color:var(--ai-text-muted);flex-shrink:0}.rating-dots{display:flex;align-items:center;gap:3px}.rating-dot{width:6px;height:6px;border-radius:50%;background:var(--ai-border-default);transition:background 0.15s}.rating-dot--filled{background:var(--ai-accent-warning, #ffaf44)}.delete-btn{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;background:transparent;border:none;border-radius:6px;cursor:pointer;color:var(--ai-text-muted);opacity:0;transition:opacity 0.15s, background 0.15s, color 0.15s;margin-block-start:2px}.conv-item:hover .delete-btn,.conv-item--active .delete-btn{opacity:1}.delete-btn:hover{background:var(--ai-status-danger-bg, rgba(239, 68, 68, 0.1));color:var(--ai-status-danger, #ef4444)}.delete-btn .icon-wrap{display:inline-flex;align-items:center;line-height:0}.delete-btn--deleting{opacity:1;cursor:default;pointer-events:none}.delete-spinner{display:block;width:12px;height:12px;border:2px solid var(--ai-border-default);border-top-color:var(--ai-text-muted);border-radius:50%;animation:delete-spin 0.7s linear infinite}@keyframes delete-spin{to{transform:rotate(360deg)}}.empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:40px 16px;text-align:center}.empty-state__icon{display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:10px;background:var(--ai-bg-card);color:var(--ai-text-muted);line-height:0}.empty-state__icon .icon-wrap{display:inline-flex;align-items:center;line-height:0}.empty-state__text{margin:0;font-size:13px;color:var(--ai-text-muted);line-height:1.4}.error-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:40px 16px;text-align:center}.error-state__icon{display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:10px;background:var(--ai-status-danger-bg, rgba(239, 68, 68, 0.1));color:var(--ai-status-danger, #ef4444);line-height:0}.error-state__icon .icon-wrap{display:inline-flex;align-items:center;line-height:0}.error-state__text{margin:0;font-size:13px;color:var(--ai-text-muted);line-height:1.4}.error-state__retry{display:inline-flex;align-items:center;gap:4px;margin-top:4px;padding:6px 14px;font-size:12px;font-weight:600;color:var(--ai-text-primary);background:var(--ai-bg-card);border:1px solid var(--ai-border-default);border-radius:8px;cursor:pointer;transition:background 0.15s, box-shadow 0.15s}.error-state__retry:hover{box-shadow:var(--ai-shadow-sm)}.error-state__retry .icon-wrap{display:inline-flex;align-items:center;line-height:0}.skeleton-list{display:flex;flex-direction:column;gap:4px}.skeleton-item{padding:10px;border-radius:10px;display:flex;flex-direction:column;gap:6px}.skeleton-line{border-radius:6px;background:var(--ai-shimmer-gradient, linear-gradient(90deg, rgba(0, 0, 0, 0.06) 25%, rgba(0, 0, 0, 0.1) 50%, rgba(0, 0, 0, 0.06) 75%));background-size:200% 100%;animation:shimmer 2s linear infinite;height:12px}.skeleton-line--title{width:65%;height:13px}.skeleton-line--preview{width:100%}.skeleton-line--meta{width:35%;height:10px}@keyframes shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}`;
|
|
5
5
|
|
|
6
6
|
const AiConversationList = class {
|
|
7
7
|
constructor(hostRef) {
|
|
@@ -24,6 +24,8 @@ const AiConversationList = class {
|
|
|
24
24
|
errorText = 'تعذّر تحميل المحادثات';
|
|
25
25
|
/** Retry button label for error state */
|
|
26
26
|
retryLabel = 'إعادة المحاولة';
|
|
27
|
+
/** ID of the conversation currently being deleted — shows a spinner on that item */
|
|
28
|
+
deletingId = '';
|
|
27
29
|
conversationSelect;
|
|
28
30
|
conversationDelete;
|
|
29
31
|
retryClick;
|
|
@@ -74,7 +76,7 @@ const AiConversationList = class {
|
|
|
74
76
|
}
|
|
75
77
|
render() {
|
|
76
78
|
const showEmpty = !this.loading && !this.error && this.items.length === 0;
|
|
77
|
-
return (h(Host, { key: '
|
|
79
|
+
return (h(Host, { key: '8cf17cedd5c41f0d6ffd2d06e557dc370041d1aa' }, h("div", { key: '50f5eeb57228f55d72acf517ed5eeb5d79e13a4b', class: "conversation-list" }, h("div", { key: '763f7cb557fb9abea75e08379d0ea9090b00ac1e', class: "list-scroll", role: "list" }, this.loading
|
|
78
80
|
? this.renderSkeleton()
|
|
79
81
|
: this.error
|
|
80
82
|
? this.renderError()
|
|
@@ -82,10 +84,14 @@ const AiConversationList = class {
|
|
|
82
84
|
? this.renderEmpty()
|
|
83
85
|
: this.items.map(item => {
|
|
84
86
|
const isActive = item.id === this.activeId;
|
|
85
|
-
return (h("div", { key: item.id, class: { 'conv-item': true, 'conv-item--active': isActive }, role: "listitem", "aria-current": isActive ? 'true' : undefined, onClick: () => this.conversationSelect.emit(item.id) }, h("div", { class: "conv-item__body" }, h("p", { class: "conv-item__title" }, item.title), h("p", { class: "conv-item__preview" }, item.preview), h("div", { class: "conv-item__meta" }, h("span", { class: "conv-item__time" }, this.formatRelativeTime(item.timestamp)), item.rating != null && this.renderRatingDots(item.rating))), h("button", { class:
|
|
87
|
+
return (h("div", { key: item.id, class: { 'conv-item': true, 'conv-item--active': isActive }, role: "listitem", "aria-current": isActive ? 'true' : undefined, onClick: () => this.conversationSelect.emit(item.id) }, h("div", { class: "conv-item__body" }, h("p", { class: "conv-item__title" }, item.title), h("p", { class: "conv-item__preview" }, item.preview), h("div", { class: "conv-item__meta" }, h("span", { class: "conv-item__time" }, this.formatRelativeTime(item.timestamp)), item.rating != null && this.renderRatingDots(item.rating))), h("button", { class: { 'delete-btn': true, 'delete-btn--deleting': this.deletingId === item.id }, "aria-label": "\u062D\u0630\u0641 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629", disabled: this.deletingId === item.id, onClick: e => {
|
|
86
88
|
e.stopPropagation();
|
|
89
|
+
if (this.deletingId === item.id)
|
|
90
|
+
return;
|
|
87
91
|
this.conversationDelete.emit(item.id);
|
|
88
|
-
} }, this.
|
|
92
|
+
} }, this.deletingId === item.id
|
|
93
|
+
? h("span", { class: "delete-spinner", "aria-label": "\u062C\u0627\u0631\u064A \u0627\u0644\u062D\u0630\u0641" })
|
|
94
|
+
: this.renderIcon('cancel', 14, 14))));
|
|
89
95
|
})))));
|
|
90
96
|
}
|
|
91
97
|
};
|
package/dist/esm/loader.js
CHANGED
|
@@ -4,7 +4,7 @@ export { s as setNonce } from './index-VMEwYfaX.js';
|
|
|
4
4
|
const defineCustomElements = async (win, options) => {
|
|
5
5
|
if (typeof window === 'undefined') return undefined;
|
|
6
6
|
await globalScripts();
|
|
7
|
-
return bootstrapLazy([["ai-message-input",[[513,"ai-message-input",{"placeholder":[1],"disabled":[4],"showVoiceButton":[4,"show-voice-button"],"maxLength":[2,"max-length"],"isRecording":[4,"is-recording"],"inputValue":[32],"showVoiceRecorder":[32],"isMultiline":[32],"setInputValue":[64]},null,{"isRecording":[{"onIsRecordingChange":0}]}]]],["ai-rating",[[513,"ai-rating",{"question":[1],"subtitle":[1],"successMessage":[1,"success-message"],"value":[1026],"disabled":[4],"hovered":[32],"submitted":[32]}]]],["ai-chat-header",[[513,"ai-chat-header",{"mode":[1],"conversation":[1],"agentName":[1,"agent-name"],"agentStatus":[1,"agent-status"],"agentAvatar":[1,"agent-avatar"],"showBack":[4,"show-back"],"statusIndicator":[1,"status-indicator"],"pageTitle":[1,"page-title"],"pageUrl":[1,"page-url"],"conversationItems":[16],"conversationActiveId":[1,"conversation-active-id"],"conversationLoading":[4,"conversation-loading"],"titleLoading":[4,"title-loading"],"avatarError":[32],"dropdownOpen":[32],"isFloating":[32]},[[4,"click","handleDocumentClick"]]]]],["ai-agent-error",[[513,"ai-agent-error",{"headline":[1],"message":[1],"errorCode":[1,"error-code"],"retryable":[4],"retryLabel":[1,"retry-label"],"dismissible":[4]}]]],["ai-chat-container",[[769,"ai-chat-container",{"isOpen":[4,"is-open"],"position":[1537],"width":[1],"autoScroll":[4,"auto-scroll"],"showWatermark":[4,"show-watermark"],"floatHeight":[1,"float-height"],"theme":[1],"loading":[4],"error":[4],"errorText":[1,"error-text"],"retryLabel":[1,"retry-label"],"direction":[513],"isMobile":[32],"floatLeft":[32],"floatTop":[32],"scrollToBottom":[64],"cyclePosition":[64]},[[0,"headerPositionClick","handleHeaderPositionClick"]],{"isOpen":[{"isOpenChanged":0}],"position":[{"positionChanged":0}]}]]],["ai-chat-message",[[769,"ai-chat-message",{"role":[1],"content":[1],"format":[1],"agentName":[1,"agent-name"],"timestamp":[1],"showActions":[4,"show-actions"],"enableRegenerate":[4,"enable-regenerate"],"feedbackValue":[1025,"feedback-value"],"copySuccess":[32]}]]],["ai-conversation-summary",[[769,"ai-conversation-summary",{"conversation":[1],"summary":[1],"messageCount":[2,"message-count"],"language":[1]}]]],["ai-in-chat-browser",[[513,"ai-in-chat-browser",{"url":[1],"pageTitle":[1,"page-title"],"isLoading":[32],"hasError":[32]},null,{"url":[{"onUrlChange":0}]}]]],["ai-link",[[769,"ai-link",{"label":[1],"href":[1],"target":[1],"rel":[1]}]]],["ai-loading",[[513,"ai-loading",{"mode":[1],"statusText":[1,"status-text"],"thinkingSubtext":[1,"thinking-subtext"],"steps":[16],"headerTitle":[1,"header-title"],"currentAgent":[1,"current-agent"],"showAgentBadges":[4,"show-agent-badges"],"expanded":[1028],"collapsible":[4],"_expanded":[32]}]]],["ai-route-decision",[[513,"ai-route-decision",{"selectedAgent":[1,"selected-agent"],"agentIcon":[1,"agent-icon"],"reason":[1],"confidence":[2],"detectedLanguage":[1,"detected-language"],"expanded":[1028],"_expanded":[32]}]]],["ai-suggestion",[[769,"ai-suggestion",{"label":[1],"disabled":[4]}]]],["ai-voice-input",[[513,"ai-voice-input",{"disabled":[4],"showWaveform":[4,"show-waveform"],"autoStart":[4,"auto-start"],"errorText":[1,"error-text"],"waveformColor":[1,"waveform-color"],"state":[32],"error":[32],"recordingDuration":[32],"submitPulse":[32]}]]],["ai-card",[[769,"ai-card",{"noPadding":[4,"no-padding"],"noShadow":[4,"no-shadow"]}]]],["ai-conversation-list",[[513,"ai-conversation-list",{"items":[16],"activeId":[1,"active-id"],"loading":[4],"emptyText":[1,"empty-text"],"error":[4],"errorText":[1,"error-text"],"retryLabel":[1,"retry-label"]}]]],["ai-icon",[[513,"ai-icon",{"name":[1],"size":[2]}]]]], options);
|
|
7
|
+
return bootstrapLazy([["ai-message-input",[[513,"ai-message-input",{"placeholder":[1],"disabled":[4],"showVoiceButton":[4,"show-voice-button"],"maxLength":[2,"max-length"],"isRecording":[4,"is-recording"],"inputValue":[32],"showVoiceRecorder":[32],"isMultiline":[32],"setInputValue":[64]},null,{"isRecording":[{"onIsRecordingChange":0}]}]]],["ai-rating",[[513,"ai-rating",{"question":[1],"subtitle":[1],"successMessage":[1,"success-message"],"value":[1026],"disabled":[4],"hovered":[32],"submitted":[32]}]]],["ai-chat-header",[[513,"ai-chat-header",{"mode":[1],"conversation":[1],"agentName":[1,"agent-name"],"agentStatus":[1,"agent-status"],"agentAvatar":[1,"agent-avatar"],"showBack":[4,"show-back"],"statusIndicator":[1,"status-indicator"],"pageTitle":[1,"page-title"],"pageUrl":[1,"page-url"],"conversationItems":[16],"conversationActiveId":[1,"conversation-active-id"],"conversationLoading":[4,"conversation-loading"],"conversationError":[4,"conversation-error"],"conversationErrorText":[1,"conversation-error-text"],"conversationRetryLabel":[1,"conversation-retry-label"],"conversationEmptyText":[1,"conversation-empty-text"],"conversationDeletingId":[1,"conversation-deleting-id"],"titleLoading":[4,"title-loading"],"avatarError":[32],"dropdownOpen":[32],"isFloating":[32]},[[4,"click","handleDocumentClick"]]]]],["ai-agent-error",[[513,"ai-agent-error",{"headline":[1],"message":[1],"errorCode":[1,"error-code"],"retryable":[4],"retryLabel":[1,"retry-label"],"dismissible":[4]}]]],["ai-chat-container",[[769,"ai-chat-container",{"isOpen":[4,"is-open"],"position":[1537],"width":[1],"autoScroll":[4,"auto-scroll"],"showWatermark":[4,"show-watermark"],"floatHeight":[1,"float-height"],"theme":[1],"loading":[4],"error":[4],"errorText":[1,"error-text"],"retryLabel":[1,"retry-label"],"direction":[513],"isMobile":[32],"floatLeft":[32],"floatTop":[32],"scrollToBottom":[64],"cyclePosition":[64]},[[0,"headerPositionClick","handleHeaderPositionClick"]],{"isOpen":[{"isOpenChanged":0}],"position":[{"positionChanged":0}]}]]],["ai-chat-message",[[769,"ai-chat-message",{"role":[1],"content":[1],"format":[1],"agentName":[1,"agent-name"],"timestamp":[1],"showActions":[4,"show-actions"],"enableRegenerate":[4,"enable-regenerate"],"feedbackValue":[1025,"feedback-value"],"copySuccess":[32]}]]],["ai-conversation-summary",[[769,"ai-conversation-summary",{"conversation":[1],"summary":[1],"messageCount":[2,"message-count"],"language":[1]}]]],["ai-in-chat-browser",[[513,"ai-in-chat-browser",{"url":[1],"pageTitle":[1,"page-title"],"isLoading":[32],"hasError":[32]},null,{"url":[{"onUrlChange":0}]}]]],["ai-link",[[769,"ai-link",{"label":[1],"href":[1],"target":[1],"rel":[1]}]]],["ai-loading",[[513,"ai-loading",{"mode":[1],"statusText":[1,"status-text"],"thinkingSubtext":[1,"thinking-subtext"],"steps":[16],"headerTitle":[1,"header-title"],"currentAgent":[1,"current-agent"],"showAgentBadges":[4,"show-agent-badges"],"expanded":[1028],"collapsible":[4],"_expanded":[32]}]]],["ai-route-decision",[[513,"ai-route-decision",{"selectedAgent":[1,"selected-agent"],"agentIcon":[1,"agent-icon"],"reason":[1],"confidence":[2],"detectedLanguage":[1,"detected-language"],"expanded":[1028],"_expanded":[32]}]]],["ai-suggestion",[[769,"ai-suggestion",{"label":[1],"disabled":[4]}]]],["ai-voice-input",[[513,"ai-voice-input",{"disabled":[4],"showWaveform":[4,"show-waveform"],"autoStart":[4,"auto-start"],"errorText":[1,"error-text"],"waveformColor":[1,"waveform-color"],"state":[32],"error":[32],"recordingDuration":[32],"submitPulse":[32]}]]],["ai-card",[[769,"ai-card",{"noPadding":[4,"no-padding"],"noShadow":[4,"no-shadow"]}]]],["ai-conversation-list",[[513,"ai-conversation-list",{"items":[16],"activeId":[1,"active-id"],"loading":[4],"emptyText":[1,"empty-text"],"error":[4],"errorText":[1,"error-text"],"retryLabel":[1,"retry-label"],"deletingId":[1,"deleting-id"]}]]],["ai-icon",[[513,"ai-icon",{"name":[1],"size":[2]}]]]], options);
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export { defineCustomElements };
|
package/dist/esm/ui-ai-kit.js
CHANGED
|
@@ -16,5 +16,5 @@ var patchBrowser = () => {
|
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(async (options) => {
|
|
18
18
|
await globalScripts();
|
|
19
|
-
return bootstrapLazy([["ai-message-input",[[513,"ai-message-input",{"placeholder":[1],"disabled":[4],"showVoiceButton":[4,"show-voice-button"],"maxLength":[2,"max-length"],"isRecording":[4,"is-recording"],"inputValue":[32],"showVoiceRecorder":[32],"isMultiline":[32],"setInputValue":[64]},null,{"isRecording":[{"onIsRecordingChange":0}]}]]],["ai-rating",[[513,"ai-rating",{"question":[1],"subtitle":[1],"successMessage":[1,"success-message"],"value":[1026],"disabled":[4],"hovered":[32],"submitted":[32]}]]],["ai-chat-header",[[513,"ai-chat-header",{"mode":[1],"conversation":[1],"agentName":[1,"agent-name"],"agentStatus":[1,"agent-status"],"agentAvatar":[1,"agent-avatar"],"showBack":[4,"show-back"],"statusIndicator":[1,"status-indicator"],"pageTitle":[1,"page-title"],"pageUrl":[1,"page-url"],"conversationItems":[16],"conversationActiveId":[1,"conversation-active-id"],"conversationLoading":[4,"conversation-loading"],"titleLoading":[4,"title-loading"],"avatarError":[32],"dropdownOpen":[32],"isFloating":[32]},[[4,"click","handleDocumentClick"]]]]],["ai-agent-error",[[513,"ai-agent-error",{"headline":[1],"message":[1],"errorCode":[1,"error-code"],"retryable":[4],"retryLabel":[1,"retry-label"],"dismissible":[4]}]]],["ai-chat-container",[[769,"ai-chat-container",{"isOpen":[4,"is-open"],"position":[1537],"width":[1],"autoScroll":[4,"auto-scroll"],"showWatermark":[4,"show-watermark"],"floatHeight":[1,"float-height"],"theme":[1],"loading":[4],"error":[4],"errorText":[1,"error-text"],"retryLabel":[1,"retry-label"],"direction":[513],"isMobile":[32],"floatLeft":[32],"floatTop":[32],"scrollToBottom":[64],"cyclePosition":[64]},[[0,"headerPositionClick","handleHeaderPositionClick"]],{"isOpen":[{"isOpenChanged":0}],"position":[{"positionChanged":0}]}]]],["ai-chat-message",[[769,"ai-chat-message",{"role":[1],"content":[1],"format":[1],"agentName":[1,"agent-name"],"timestamp":[1],"showActions":[4,"show-actions"],"enableRegenerate":[4,"enable-regenerate"],"feedbackValue":[1025,"feedback-value"],"copySuccess":[32]}]]],["ai-conversation-summary",[[769,"ai-conversation-summary",{"conversation":[1],"summary":[1],"messageCount":[2,"message-count"],"language":[1]}]]],["ai-in-chat-browser",[[513,"ai-in-chat-browser",{"url":[1],"pageTitle":[1,"page-title"],"isLoading":[32],"hasError":[32]},null,{"url":[{"onUrlChange":0}]}]]],["ai-link",[[769,"ai-link",{"label":[1],"href":[1],"target":[1],"rel":[1]}]]],["ai-loading",[[513,"ai-loading",{"mode":[1],"statusText":[1,"status-text"],"thinkingSubtext":[1,"thinking-subtext"],"steps":[16],"headerTitle":[1,"header-title"],"currentAgent":[1,"current-agent"],"showAgentBadges":[4,"show-agent-badges"],"expanded":[1028],"collapsible":[4],"_expanded":[32]}]]],["ai-route-decision",[[513,"ai-route-decision",{"selectedAgent":[1,"selected-agent"],"agentIcon":[1,"agent-icon"],"reason":[1],"confidence":[2],"detectedLanguage":[1,"detected-language"],"expanded":[1028],"_expanded":[32]}]]],["ai-suggestion",[[769,"ai-suggestion",{"label":[1],"disabled":[4]}]]],["ai-voice-input",[[513,"ai-voice-input",{"disabled":[4],"showWaveform":[4,"show-waveform"],"autoStart":[4,"auto-start"],"errorText":[1,"error-text"],"waveformColor":[1,"waveform-color"],"state":[32],"error":[32],"recordingDuration":[32],"submitPulse":[32]}]]],["ai-card",[[769,"ai-card",{"noPadding":[4,"no-padding"],"noShadow":[4,"no-shadow"]}]]],["ai-conversation-list",[[513,"ai-conversation-list",{"items":[16],"activeId":[1,"active-id"],"loading":[4],"emptyText":[1,"empty-text"],"error":[4],"errorText":[1,"error-text"],"retryLabel":[1,"retry-label"]}]]],["ai-icon",[[513,"ai-icon",{"name":[1],"size":[2]}]]]], options);
|
|
19
|
+
return bootstrapLazy([["ai-message-input",[[513,"ai-message-input",{"placeholder":[1],"disabled":[4],"showVoiceButton":[4,"show-voice-button"],"maxLength":[2,"max-length"],"isRecording":[4,"is-recording"],"inputValue":[32],"showVoiceRecorder":[32],"isMultiline":[32],"setInputValue":[64]},null,{"isRecording":[{"onIsRecordingChange":0}]}]]],["ai-rating",[[513,"ai-rating",{"question":[1],"subtitle":[1],"successMessage":[1,"success-message"],"value":[1026],"disabled":[4],"hovered":[32],"submitted":[32]}]]],["ai-chat-header",[[513,"ai-chat-header",{"mode":[1],"conversation":[1],"agentName":[1,"agent-name"],"agentStatus":[1,"agent-status"],"agentAvatar":[1,"agent-avatar"],"showBack":[4,"show-back"],"statusIndicator":[1,"status-indicator"],"pageTitle":[1,"page-title"],"pageUrl":[1,"page-url"],"conversationItems":[16],"conversationActiveId":[1,"conversation-active-id"],"conversationLoading":[4,"conversation-loading"],"conversationError":[4,"conversation-error"],"conversationErrorText":[1,"conversation-error-text"],"conversationRetryLabel":[1,"conversation-retry-label"],"conversationEmptyText":[1,"conversation-empty-text"],"conversationDeletingId":[1,"conversation-deleting-id"],"titleLoading":[4,"title-loading"],"avatarError":[32],"dropdownOpen":[32],"isFloating":[32]},[[4,"click","handleDocumentClick"]]]]],["ai-agent-error",[[513,"ai-agent-error",{"headline":[1],"message":[1],"errorCode":[1,"error-code"],"retryable":[4],"retryLabel":[1,"retry-label"],"dismissible":[4]}]]],["ai-chat-container",[[769,"ai-chat-container",{"isOpen":[4,"is-open"],"position":[1537],"width":[1],"autoScroll":[4,"auto-scroll"],"showWatermark":[4,"show-watermark"],"floatHeight":[1,"float-height"],"theme":[1],"loading":[4],"error":[4],"errorText":[1,"error-text"],"retryLabel":[1,"retry-label"],"direction":[513],"isMobile":[32],"floatLeft":[32],"floatTop":[32],"scrollToBottom":[64],"cyclePosition":[64]},[[0,"headerPositionClick","handleHeaderPositionClick"]],{"isOpen":[{"isOpenChanged":0}],"position":[{"positionChanged":0}]}]]],["ai-chat-message",[[769,"ai-chat-message",{"role":[1],"content":[1],"format":[1],"agentName":[1,"agent-name"],"timestamp":[1],"showActions":[4,"show-actions"],"enableRegenerate":[4,"enable-regenerate"],"feedbackValue":[1025,"feedback-value"],"copySuccess":[32]}]]],["ai-conversation-summary",[[769,"ai-conversation-summary",{"conversation":[1],"summary":[1],"messageCount":[2,"message-count"],"language":[1]}]]],["ai-in-chat-browser",[[513,"ai-in-chat-browser",{"url":[1],"pageTitle":[1,"page-title"],"isLoading":[32],"hasError":[32]},null,{"url":[{"onUrlChange":0}]}]]],["ai-link",[[769,"ai-link",{"label":[1],"href":[1],"target":[1],"rel":[1]}]]],["ai-loading",[[513,"ai-loading",{"mode":[1],"statusText":[1,"status-text"],"thinkingSubtext":[1,"thinking-subtext"],"steps":[16],"headerTitle":[1,"header-title"],"currentAgent":[1,"current-agent"],"showAgentBadges":[4,"show-agent-badges"],"expanded":[1028],"collapsible":[4],"_expanded":[32]}]]],["ai-route-decision",[[513,"ai-route-decision",{"selectedAgent":[1,"selected-agent"],"agentIcon":[1,"agent-icon"],"reason":[1],"confidence":[2],"detectedLanguage":[1,"detected-language"],"expanded":[1028],"_expanded":[32]}]]],["ai-suggestion",[[769,"ai-suggestion",{"label":[1],"disabled":[4]}]]],["ai-voice-input",[[513,"ai-voice-input",{"disabled":[4],"showWaveform":[4,"show-waveform"],"autoStart":[4,"auto-start"],"errorText":[1,"error-text"],"waveformColor":[1,"waveform-color"],"state":[32],"error":[32],"recordingDuration":[32],"submitPulse":[32]}]]],["ai-card",[[769,"ai-card",{"noPadding":[4,"no-padding"],"noShadow":[4,"no-shadow"]}]]],["ai-conversation-list",[[513,"ai-conversation-list",{"items":[16],"activeId":[1,"active-id"],"loading":[4],"emptyText":[1,"empty-text"],"error":[4],"errorText":[1,"error-text"],"retryLabel":[1,"retry-label"],"deletingId":[1,"deleting-id"]}]]],["ai-icon",[[513,"ai-icon",{"name":[1],"size":[2]}]]]], options);
|
|
20
20
|
});
|
|
@@ -26,6 +26,16 @@ export declare class AiChatHeader {
|
|
|
26
26
|
conversationActiveId: string;
|
|
27
27
|
/** Conversation list: show skeleton loading state */
|
|
28
28
|
conversationLoading: boolean;
|
|
29
|
+
/** Conversation list: show error state */
|
|
30
|
+
conversationError: boolean;
|
|
31
|
+
/** Conversation list: error message text */
|
|
32
|
+
conversationErrorText: string;
|
|
33
|
+
/** Conversation list: retry button label */
|
|
34
|
+
conversationRetryLabel: string;
|
|
35
|
+
/** Conversation list: empty state label */
|
|
36
|
+
conversationEmptyText: string;
|
|
37
|
+
/** Conversation list: ID of the conversation currently being deleted — shows a spinner on that item */
|
|
38
|
+
conversationDeletingId: string;
|
|
29
39
|
/** Show a shimmer skeleton in place of the conversation title (e.g. while loading conversation) */
|
|
30
40
|
titleLoading: boolean;
|
|
31
41
|
private avatarError;
|
|
@@ -62,6 +72,8 @@ export declare class AiChatHeader {
|
|
|
62
72
|
conversationSelect: EventEmitter<string>;
|
|
63
73
|
/** Fired when a conversation delete button is clicked */
|
|
64
74
|
conversationDelete: EventEmitter<string>;
|
|
75
|
+
/** Fired when the retry button is clicked in the conversation list error state */
|
|
76
|
+
conversationRetry: EventEmitter<void>;
|
|
65
77
|
handleDocumentClick(event: Event): void;
|
|
66
78
|
connectedCallback(): void;
|
|
67
79
|
componentDidLoad(): void;
|
|
@@ -73,6 +85,7 @@ export declare class AiChatHeader {
|
|
|
73
85
|
private renderDragBtn;
|
|
74
86
|
private handleConversationSelect;
|
|
75
87
|
private handleConversationDelete;
|
|
88
|
+
private handleConversationRetry;
|
|
76
89
|
private renderConversationDropdown;
|
|
77
90
|
private renderAgentMode;
|
|
78
91
|
private renderHumanMode;
|
|
@@ -21,6 +21,8 @@ export declare class AiConversationList {
|
|
|
21
21
|
errorText: string;
|
|
22
22
|
/** Retry button label for error state */
|
|
23
23
|
retryLabel: string;
|
|
24
|
+
/** ID of the conversation currently being deleted — shows a spinner on that item */
|
|
25
|
+
deletingId: string;
|
|
24
26
|
conversationSelect: EventEmitter<string>;
|
|
25
27
|
conversationDelete: EventEmitter<string>;
|
|
26
28
|
retryClick: EventEmitter<void>;
|
|
@@ -158,6 +158,26 @@ export namespace Components {
|
|
|
158
158
|
* @default ''
|
|
159
159
|
*/
|
|
160
160
|
"conversationActiveId": string;
|
|
161
|
+
/**
|
|
162
|
+
* Conversation list: ID of the conversation currently being deleted — shows a spinner on that item
|
|
163
|
+
* @default ''
|
|
164
|
+
*/
|
|
165
|
+
"conversationDeletingId": string;
|
|
166
|
+
/**
|
|
167
|
+
* Conversation list: empty state label
|
|
168
|
+
* @default 'لا توجد محادثات'
|
|
169
|
+
*/
|
|
170
|
+
"conversationEmptyText": string;
|
|
171
|
+
/**
|
|
172
|
+
* Conversation list: show error state
|
|
173
|
+
* @default false
|
|
174
|
+
*/
|
|
175
|
+
"conversationError": boolean;
|
|
176
|
+
/**
|
|
177
|
+
* Conversation list: error message text
|
|
178
|
+
* @default 'تعذّر تحميل المحادثات'
|
|
179
|
+
*/
|
|
180
|
+
"conversationErrorText": string;
|
|
161
181
|
/**
|
|
162
182
|
* Conversation list: items to display in the dropdown panel
|
|
163
183
|
* @default []
|
|
@@ -168,6 +188,11 @@ export namespace Components {
|
|
|
168
188
|
* @default false
|
|
169
189
|
*/
|
|
170
190
|
"conversationLoading": boolean;
|
|
191
|
+
/**
|
|
192
|
+
* Conversation list: retry button label
|
|
193
|
+
* @default 'إعادة المحاولة'
|
|
194
|
+
*/
|
|
195
|
+
"conversationRetryLabel": string;
|
|
171
196
|
/**
|
|
172
197
|
* Layout variant
|
|
173
198
|
* @default 'agent'
|
|
@@ -239,6 +264,11 @@ export namespace Components {
|
|
|
239
264
|
* @default ''
|
|
240
265
|
*/
|
|
241
266
|
"activeId": string;
|
|
267
|
+
/**
|
|
268
|
+
* ID of the conversation currently being deleted — shows a spinner on that item
|
|
269
|
+
* @default ''
|
|
270
|
+
*/
|
|
271
|
+
"deletingId": string;
|
|
242
272
|
/**
|
|
243
273
|
* Text shown when the list is empty
|
|
244
274
|
* @default 'لا توجد محادثات'
|
|
@@ -612,6 +642,7 @@ declare global {
|
|
|
612
642
|
"openExternal": string;
|
|
613
643
|
"conversationSelect": string;
|
|
614
644
|
"conversationDelete": string;
|
|
645
|
+
"conversationRetry": void;
|
|
615
646
|
}
|
|
616
647
|
interface HTMLAiChatHeaderElement extends Components.AiChatHeader, HTMLStencilElement {
|
|
617
648
|
addEventListener<K extends keyof HTMLAiChatHeaderElementEventMap>(type: K, listener: (this: HTMLAiChatHeaderElement, ev: AiChatHeaderCustomEvent<HTMLAiChatHeaderElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
@@ -956,6 +987,26 @@ declare namespace LocalJSX {
|
|
|
956
987
|
* @default ''
|
|
957
988
|
*/
|
|
958
989
|
"conversationActiveId"?: string;
|
|
990
|
+
/**
|
|
991
|
+
* Conversation list: ID of the conversation currently being deleted — shows a spinner on that item
|
|
992
|
+
* @default ''
|
|
993
|
+
*/
|
|
994
|
+
"conversationDeletingId"?: string;
|
|
995
|
+
/**
|
|
996
|
+
* Conversation list: empty state label
|
|
997
|
+
* @default 'لا توجد محادثات'
|
|
998
|
+
*/
|
|
999
|
+
"conversationEmptyText"?: string;
|
|
1000
|
+
/**
|
|
1001
|
+
* Conversation list: show error state
|
|
1002
|
+
* @default false
|
|
1003
|
+
*/
|
|
1004
|
+
"conversationError"?: boolean;
|
|
1005
|
+
/**
|
|
1006
|
+
* Conversation list: error message text
|
|
1007
|
+
* @default 'تعذّر تحميل المحادثات'
|
|
1008
|
+
*/
|
|
1009
|
+
"conversationErrorText"?: string;
|
|
959
1010
|
/**
|
|
960
1011
|
* Conversation list: items to display in the dropdown panel
|
|
961
1012
|
* @default []
|
|
@@ -966,6 +1017,11 @@ declare namespace LocalJSX {
|
|
|
966
1017
|
* @default false
|
|
967
1018
|
*/
|
|
968
1019
|
"conversationLoading"?: boolean;
|
|
1020
|
+
/**
|
|
1021
|
+
* Conversation list: retry button label
|
|
1022
|
+
* @default 'إعادة المحاولة'
|
|
1023
|
+
*/
|
|
1024
|
+
"conversationRetryLabel"?: string;
|
|
969
1025
|
/**
|
|
970
1026
|
* Layout variant
|
|
971
1027
|
* @default 'agent'
|
|
@@ -983,6 +1039,10 @@ declare namespace LocalJSX {
|
|
|
983
1039
|
* Fired when a conversation delete button is clicked
|
|
984
1040
|
*/
|
|
985
1041
|
"onConversationDelete"?: (event: AiChatHeaderCustomEvent<string>) => void;
|
|
1042
|
+
/**
|
|
1043
|
+
* Fired when the retry button is clicked in the conversation list error state
|
|
1044
|
+
*/
|
|
1045
|
+
"onConversationRetry"?: (event: AiChatHeaderCustomEvent<void>) => void;
|
|
986
1046
|
/**
|
|
987
1047
|
* Fired when a conversation is selected from the dropdown list
|
|
988
1048
|
*/
|
|
@@ -1080,6 +1140,11 @@ declare namespace LocalJSX {
|
|
|
1080
1140
|
* @default ''
|
|
1081
1141
|
*/
|
|
1082
1142
|
"activeId"?: string;
|
|
1143
|
+
/**
|
|
1144
|
+
* ID of the conversation currently being deleted — shows a spinner on that item
|
|
1145
|
+
* @default ''
|
|
1146
|
+
*/
|
|
1147
|
+
"deletingId"?: string;
|
|
1083
1148
|
/**
|
|
1084
1149
|
* Text shown when the list is empty
|
|
1085
1150
|
* @default 'لا توجد محادثات'
|
|
@@ -1413,6 +1478,11 @@ declare namespace LocalJSX {
|
|
|
1413
1478
|
"pageUrl": string;
|
|
1414
1479
|
"conversationActiveId": string;
|
|
1415
1480
|
"conversationLoading": boolean;
|
|
1481
|
+
"conversationError": boolean;
|
|
1482
|
+
"conversationErrorText": string;
|
|
1483
|
+
"conversationRetryLabel": string;
|
|
1484
|
+
"conversationEmptyText": string;
|
|
1485
|
+
"conversationDeletingId": string;
|
|
1416
1486
|
"titleLoading": boolean;
|
|
1417
1487
|
}
|
|
1418
1488
|
interface AiChatMessageAttributes {
|
|
@@ -1432,6 +1502,7 @@ declare namespace LocalJSX {
|
|
|
1432
1502
|
"error": boolean;
|
|
1433
1503
|
"errorText": string;
|
|
1434
1504
|
"retryLabel": string;
|
|
1505
|
+
"deletingId": string;
|
|
1435
1506
|
}
|
|
1436
1507
|
interface AiConversationSummaryAttributes {
|
|
1437
1508
|
"conversation": string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,c as t,h as i,H as r}from"./p-VMEwYfaX.js";import{i as a}from"./p-DlD8m3rf.js";const n=class{constructor(i){e(this,i),this.conversationSelect=t(this,"conversationSelect"),this.conversationDelete=t(this,"conversationDelete"),this.retryClick=t(this,"retryClick")}items=[];activeId="";loading=!1;emptyText="لا توجد محادثات";error=!1;errorText="تعذّر تحميل المحادثات";retryLabel="إعادة المحاولة";deletingId="";conversationSelect;conversationDelete;retryClick;renderIcon(e,t,r){const n=a[e];return n?i("span",{class:"icon-wrap",innerHTML:`<svg width="${t}" height="${r}" viewBox="${n.viewBox}" fill="none" xmlns="http://www.w3.org/2000/svg">${n.content}</svg>`}):null}formatRelativeTime(e){if(!e)return"";try{const t=new Date(e);if(isNaN(t.getTime()))return e;const i=Date.now()-t.getTime(),r=Math.floor(i/6e4),a=Math.floor(r/60),n=Math.floor(a/24),s="undefined"!=typeof document&&document.documentElement.lang||"ar",o=new Intl.RelativeTimeFormat(s,{numeric:"auto"});return r<1?o.format(0,"second"):r<60?o.format(-r,"minute"):a<24?o.format(-a,"hour"):o.format(-n,"day")}catch{return e}}renderRatingDots(e){return i("div",{class:"rating-dots","aria-label":e?`تقييم ${e} من 5`:void 0},Array.from({length:5},((t,r)=>i("span",{class:"rating-dot "+(r<(e??0)?"rating-dot--filled":"")}))))}renderSkeleton(){return i("div",{class:"skeleton-list"},[1,2,3,4].map((e=>i("div",{key:e,class:"skeleton-item"},i("div",{class:"skeleton-line skeleton-line--title"}),i("div",{class:"skeleton-line skeleton-line--preview"}),i("div",{class:"skeleton-line skeleton-line--meta"})))))}renderEmpty(){return i("div",{class:"empty-state"},i("div",{class:"empty-state__icon"},this.renderIcon("list",24,24)),i("p",{class:"empty-state__text"},this.emptyText))}renderError(){return i("div",{class:"error-state"},i("div",{class:"error-state__icon"},this.renderIcon("wifi-off",24,24)),i("p",{class:"error-state__text"},this.errorText),i("button",{class:"error-state__retry",onClick:()=>this.retryClick.emit()},this.renderIcon("reload",14,14),i("span",null,this.retryLabel)))}render(){const e=!this.loading&&!this.error&&0===this.items.length;return i(r,{key:"8cf17cedd5c41f0d6ffd2d06e557dc370041d1aa"},i("div",{key:"50f5eeb57228f55d72acf517ed5eeb5d79e13a4b",class:"conversation-list"},i("div",{key:"763f7cb557fb9abea75e08379d0ea9090b00ac1e",class:"list-scroll",role:"list"},this.loading?this.renderSkeleton():this.error?this.renderError():e?this.renderEmpty():this.items.map((e=>{const t=e.id===this.activeId;return i("div",{key:e.id,class:{"conv-item":!0,"conv-item--active":t},role:"listitem","aria-current":t?"true":void 0,onClick:()=>this.conversationSelect.emit(e.id)},i("div",{class:"conv-item__body"},i("p",{class:"conv-item__title"},e.title),i("p",{class:"conv-item__preview"},e.preview),i("div",{class:"conv-item__meta"},i("span",{class:"conv-item__time"},this.formatRelativeTime(e.timestamp)),null!=e.rating&&this.renderRatingDots(e.rating))),i("button",{class:{"delete-btn":!0,"delete-btn--deleting":this.deletingId===e.id},"aria-label":"حذف المحادثة",disabled:this.deletingId===e.id,onClick:t=>{t.stopPropagation(),this.deletingId!==e.id&&this.conversationDelete.emit(e.id)}},this.deletingId===e.id?i("span",{class:"delete-spinner","aria-label":"جاري الحذف"}):this.renderIcon("cancel",14,14)))})))))}};n.style=":host{display:flex;flex-direction:column;height:100%;min-height:0;overflow:hidden}.conversation-list{display:flex;flex-direction:column;gap:8px;flex:1;min-height:0;background:var(--ai-bg-surface)}.list-scroll{flex:1;min-height:0;overflow-y:auto;padding:0 8px 12px;scrollbar-width:thin;scrollbar-color:var(--ai-scrollbar-thumb) transparent}.list-scroll::-webkit-scrollbar{width:3px}.list-scroll::-webkit-scrollbar-track{background:transparent}.list-scroll::-webkit-scrollbar-thumb{background:var(--ai-scrollbar-thumb);border-radius:99px}.list-scroll::-webkit-scrollbar-thumb:hover{background:var(--ai-scrollbar-thumb-hover)}.conv-item{display:flex;align-items:flex-start;gap:6px;margin-top:6px;padding:10px 10px 10px 6px;border-radius:10px;cursor:pointer;transition:background 0.15s;position:relative}.conv-item:hover{background:var(--ai-bg-card)}.conv-item--active{background:var(--ai-bg-card);box-shadow:var(--ai-shadow-sm)}.conv-item__body{flex:1;min-width:0}.conv-item__title{margin:0 0 3px;font-size:13px;font-weight:600;color:var(--ai-text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.conv-item__preview{margin:0 0 5px;font-size:12px;color:var(--ai-text-muted);line-height:1.45;display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.conv-item__meta{display:flex;align-items:center;gap:8px}.conv-item__time{font-size:11px;color:var(--ai-text-muted);flex-shrink:0}.rating-dots{display:flex;align-items:center;gap:3px}.rating-dot{width:6px;height:6px;border-radius:50%;background:var(--ai-border-default);transition:background 0.15s}.rating-dot--filled{background:var(--ai-accent-warning, #ffaf44)}.delete-btn{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;background:transparent;border:none;border-radius:6px;cursor:pointer;color:var(--ai-text-muted);opacity:0;transition:opacity 0.15s, background 0.15s, color 0.15s;margin-block-start:2px}.conv-item:hover .delete-btn,.conv-item--active .delete-btn{opacity:1}.delete-btn:hover{background:var(--ai-status-danger-bg, rgba(239, 68, 68, 0.1));color:var(--ai-status-danger, #ef4444)}.delete-btn .icon-wrap{display:inline-flex;align-items:center;line-height:0}.delete-btn--deleting{opacity:1;cursor:default;pointer-events:none}.delete-spinner{display:block;width:12px;height:12px;border:2px solid var(--ai-border-default);border-top-color:var(--ai-text-muted);border-radius:50%;animation:delete-spin 0.7s linear infinite}@keyframes delete-spin{to{transform:rotate(360deg)}}.empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:40px 16px;text-align:center}.empty-state__icon{display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:10px;background:var(--ai-bg-card);color:var(--ai-text-muted);line-height:0}.empty-state__icon .icon-wrap{display:inline-flex;align-items:center;line-height:0}.empty-state__text{margin:0;font-size:13px;color:var(--ai-text-muted);line-height:1.4}.error-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:40px 16px;text-align:center}.error-state__icon{display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:10px;background:var(--ai-status-danger-bg, rgba(239, 68, 68, 0.1));color:var(--ai-status-danger, #ef4444);line-height:0}.error-state__icon .icon-wrap{display:inline-flex;align-items:center;line-height:0}.error-state__text{margin:0;font-size:13px;color:var(--ai-text-muted);line-height:1.4}.error-state__retry{display:inline-flex;align-items:center;gap:4px;margin-top:4px;padding:6px 14px;font-size:12px;font-weight:600;color:var(--ai-text-primary);background:var(--ai-bg-card);border:1px solid var(--ai-border-default);border-radius:8px;cursor:pointer;transition:background 0.15s, box-shadow 0.15s}.error-state__retry:hover{box-shadow:var(--ai-shadow-sm)}.error-state__retry .icon-wrap{display:inline-flex;align-items:center;line-height:0}.skeleton-list{display:flex;flex-direction:column;gap:4px}.skeleton-item{padding:10px;border-radius:10px;display:flex;flex-direction:column;gap:6px}.skeleton-line{border-radius:6px;background:var(--ai-shimmer-gradient, linear-gradient(90deg, rgba(0, 0, 0, 0.06) 25%, rgba(0, 0, 0, 0.1) 50%, rgba(0, 0, 0, 0.06) 75%));background-size:200% 100%;animation:shimmer 2s linear infinite;height:12px}.skeleton-line--title{width:65%;height:13px}.skeleton-line--preview{width:100%}.skeleton-line--meta{width:35%;height:10px}@keyframes shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}";export{n as ai_conversation_list}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as i,a as e,h as n,H as a}from"./p-VMEwYfaX.js";import{i as o}from"./p-DlD8m3rf.js";const s=class{constructor(e){t(this,e),this.closeClick=i(this,"closeClick"),this.newChatClick=i(this,"newChatClick"),this.dropdownClick=i(this,"dropdownClick"),this.positionClick=i(this,"positionClick"),this.headerPositionClick=i(this,"headerPositionClick"),this.backClick=i(this,"backClick"),this.headerDragStart=i(this,"headerDragStart"),this.openExternal=i(this,"openExternal"),this.conversationSelect=i(this,"conversationSelect"),this.conversationDelete=i(this,"conversationDelete"),this.conversationRetry=i(this,"conversationRetry")}get el(){return e(this)}mode="agent";conversation="محادثة جديدة";agentName="";agentStatus="";agentAvatar="";showBack=!0;statusIndicator="online";pageTitle="";pageUrl="";conversationItems=[];conversationActiveId="";conversationLoading=!1;conversationError=!1;conversationErrorText="تعذّر تحميل المحادثات";conversationRetryLabel="إعادة المحاولة";conversationEmptyText="لا توجد محادثات";conversationDeletingId="";titleLoading=!1;avatarError=!1;dropdownOpen=!1;isFloating=!1;parentPositionObserver=null;closeClick;newChatClick;dropdownClick;positionClick;headerPositionClick;backClick;headerDragStart;openExternal;conversationSelect;conversationDelete;conversationRetry;handleDocumentClick(t){this.dropdownOpen&&!this.el.contains(t.target)&&(this.dropdownOpen=!1)}connectedCallback(){}componentDidLoad(){requestAnimationFrame((()=>{this.syncFloatingState(),this.observeParentPosition()}))}disconnectedCallback(){this.parentPositionObserver?.disconnect(),this.parentPositionObserver=null}observeParentPosition(){if(this.parentPositionObserver)return;const t=this.el.closest("ai-chat-container");t&&(this.parentPositionObserver=new MutationObserver((()=>this.syncFloatingState())),this.parentPositionObserver.observe(t,{attributes:!0,attributeFilter:["position"]}))}syncFloatingState(){const t=this.el.closest("ai-chat-container");if(t){const i="float"===t.getAttribute("position");this.isFloating!==i&&(this.isFloating=i)}else!1!==this.isFloating&&(this.isFloating=!1)}renderIcon(t,i,e){const a=o[t];return a?n("span",{class:"icon-wrap",innerHTML:`<svg width="${i}" height="${e}" viewBox="${a.viewBox}" fill="none" xmlns="http://www.w3.org/2000/svg">${a.content}</svg>`}):null}renderAvatar(){const t=this.agentName?this.agentName.charAt(0):"?";return!this.agentAvatar||this.avatarError?n("div",{class:"avatar-fallback"},t):n("img",{class:"avatar",src:this.agentAvatar,alt:this.agentName,onError:()=>{this.avatarError=!0}})}renderDragBtn(){return this.isFloating&&n("button",{class:"action-btn drag-btn","aria-label":"سحب / Drag",onPointerDown:t=>{t.preventDefault(),this.headerDragStart.emit({clientX:t.clientX,clientY:t.clientY})}},this.renderIcon("drag",11,15))}handleConversationSelect=t=>{t.stopPropagation(),this.conversationSelect.emit(t.detail),this.dropdownOpen=!1};handleConversationDelete=t=>{t.stopPropagation(),this.conversationDelete.emit(t.detail)};handleConversationRetry=t=>{t.stopPropagation(),this.conversationRetry.emit()};renderConversationDropdown(){return this.dropdownOpen&&"agent"===this.mode?n("div",{class:"conversation-dropdown"},n("ai-conversation-list",{items:this.conversationItems,activeId:this.conversationActiveId,loading:this.conversationLoading,error:this.conversationError,errorText:this.conversationErrorText,retryLabel:this.conversationRetryLabel,emptyText:this.conversationEmptyText,deletingId:this.conversationDeletingId,onConversationSelect:this.handleConversationSelect,onConversationDelete:this.handleConversationDelete,onRetryClick:this.handleConversationRetry})):null}renderAgentMode(){return[this.renderDragBtn(),n("div",{class:"content agent dropdown-trigger",role:"button",onClick:()=>{this.titleLoading||(this.dropdownOpen=!this.dropdownOpen,this.dropdownClick.emit())},"aria-haspopup":"listbox","aria-expanded":this.dropdownOpen,"aria-label":`${this.conversation}, افتح قائمة المحادثات`},this.titleLoading?n("span",{class:"title-skeleton","aria-busy":"true","aria-label":"جاري التحميل"}):n("span",{class:"title"},this.conversation),!this.titleLoading&&n("span",{class:"dropdown-chevron"+(this.dropdownOpen?" open":"")},this.renderIcon("chevron-down",24,24))),n("div",{class:"actions"},n("button",{class:"action-btn","aria-label":"محادثة جديدة / New Chat",onClick:()=>this.newChatClick.emit()},this.renderIcon("pencil-edit",22,22)),n("button",{class:"action-btn","aria-label":"العرض / Position",onClick:()=>{this.positionClick.emit(),this.headerPositionClick.emit()}},this.renderIcon("hand",22,22)),n("button",{class:"action-btn","aria-label":"إغلاق / Close",onClick:()=>this.closeClick.emit()},this.renderIcon("cancel",22,22)))]}renderHumanMode(){return[this.renderDragBtn(),n("div",{class:"content human"},this.showBack&&n("button",{class:"back-btn","aria-label":"رجوع / Back",onClick:()=>this.backClick.emit()},this.renderIcon("arrow-right",24,24)),n("div",{class:"avatar-wrapper"},this.renderAvatar(),n("span",{class:`online-dot status-${this.statusIndicator}`},this.renderIcon("online-dot",10,10))),n("div",{class:"text-block"},n("span",{class:"agent-name"},this.agentName),this.agentStatus&&n("span",{class:"agent-status"},this.agentStatus))),n("div",{class:"actions"},n("button",{class:"action-btn","aria-label":"العرض / Position",onClick:()=>{this.positionClick.emit(),this.headerPositionClick.emit()}},this.renderIcon("hand",22,22)),n("button",{class:"action-btn","aria-label":"إغلاق / Close",onClick:()=>this.closeClick.emit()},this.renderIcon("cancel",22,22)))]}renderBrowserMode(){return[this.renderDragBtn(),n("div",{class:"content browser"},n("button",{class:"back-btn","aria-label":"رجوع / Back",onClick:()=>this.backClick.emit()},this.renderIcon("arrow-right",24,24)),n("span",{class:"browser-title"},this.pageTitle),n("button",{class:"browser-link-btn","aria-label":"فتح في نافذة جديدة / Open externally",onClick:()=>this.openExternal.emit(this.pageUrl)},this.renderIcon("link",14,14))),n("div",{class:"actions"},n("button",{class:"action-btn","aria-label":"العرض / Position",onClick:()=>{this.positionClick.emit(),this.headerPositionClick.emit()}},this.renderIcon("hand",22,22)),n("button",{class:"action-btn","aria-label":"إغلاق / Close",onClick:()=>this.closeClick.emit()},this.renderIcon("cancel",22,22)))]}render(){return n(a,{key:"874ee1e0eb62a59a4c9713111856594ef03dd435"},n("div",{key:"d8887800ad270c7878f41bdc930b2ca6b1280935",class:"header-wrapper"},n("div",{key:"a4fc7e86851cc1cdce6c686880b9f4ee33342fb7",class:"header-container"},"agent"===this.mode?this.renderAgentMode():"human"===this.mode?this.renderHumanMode():this.renderBrowserMode()),this.renderConversationDropdown()))}};s.style=":host{display:block;position:relative;z-index:10}.header-wrapper{position:relative;display:flex;flex-direction:column}.header-container{display:flex;align-items:center;gap:8px;padding:16px;background:var(--ai-bg-card);border-bottom:1px solid var(--ai-border-light);width:100%;box-sizing:border-box}.drag-btn{cursor:grab;color:var(--ai-text-muted)}.drag-btn:active{cursor:grabbing}.action-btn,.back-btn{width:40px;height:40px;padding:4px;display:flex;align-items:center;justify-content:center;background:var(--ai-bg-card);border:none;border-radius:8px;cursor:pointer;flex-shrink:0;color:var(--ai-text-primary);transition:background 0.15s ease}.action-btn:hover,.back-btn:hover{background:var(--ai-bg-surface)}.action-btn:focus-visible,.back-btn:focus-visible{outline:2px solid var(--ai-focus-ring);outline-offset:2px}.action-btn:active,.back-btn:active{background:var(--ai-bg-surface)}.actions{display:flex;align-items:center;gap:8px;flex-shrink:0}.content{flex:1 0 0;display:flex;align-items:center;justify-content:flex-start;min-width:0}.content.agent{gap:4px;height:40px}.content.human{gap:8px}.content.browser{gap:8px}.dropdown-trigger{display:flex;align-items:center;gap:4px;background:none;border:none;cursor:pointer;padding:0;flex-shrink:0;color:var(--ai-text-primary)}.dropdown-chevron{display:inline-flex;transition:transform 0.2s ease}.dropdown-chevron.open{transform:rotate(180deg)}.dropdown-trigger:focus-visible{outline:2px solid var(--ai-focus-ring);outline-offset:2px}.title{font-size:16px;font-weight:700;color:var(--ai-text-primary);white-space:nowrap;line-height:normal;min-width:0;overflow:hidden;text-overflow:ellipsis}@keyframes title-shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}.title-skeleton{display:inline-block;width:120px;height:16px;border-radius:8px;background:var(--ai-shimmer-gradient, linear-gradient(90deg, rgba(0,0,0,0.06) 25%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.06) 75%));background-size:200% 100%;animation:title-shimmer 1.6s ease-in-out infinite}.browser-title{font-size:14px;font-weight:600;color:var(--ai-text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;line-height:20px}.browser-link-btn{width:28px;height:28px;padding:0;display:inline-flex;align-items:center;justify-content:center;background:none;border:none;border-radius:8px;cursor:pointer;flex-shrink:0;color:var(--ai-text-secondary)}.browser-link-btn:focus-visible{outline:2px solid var(--ai-focus-ring);outline-offset:2px}.avatar-wrapper{position:relative;width:40px;height:40px;flex-shrink:0}.avatar{width:40px;height:40px;border-radius:9999px;border:1px solid var(--ai-border-default);object-fit:cover;display:block}.avatar-fallback{width:40px;height:40px;border-radius:9999px;border:1px solid var(--ai-border-default);background:var(--ai-bg-surface);color:var(--ai-text-primary);font-size:16px;font-weight:600;display:flex;align-items:center;justify-content:center;flex-shrink:0}.online-dot{position:absolute;bottom:0;inset-inline-end:0;width:10px;height:10px;display:inline-flex;align-items:center;justify-content:center;color:var(--ai-bg-card);}.online-dot.status-online{color:#22c55e;}.online-dot.status-offline{color:#9ca3af;}.online-dot.status-busy{color:#ef4444;}.online-dot.status-away{color:#f59e0b;}.text-block{display:flex;flex-direction:column;align-items:flex-start;gap:0;flex-shrink:0}.agent-name{font-size:14px;font-weight:500;color:var(--ai-text-primary);line-height:20px;white-space:nowrap}.agent-status{font-size:14px;font-weight:400;color:var(--ai-text-secondary);line-height:20px;white-space:nowrap}.icon-wrap{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}.icon-wrap svg{display:block}:host-context([dir='ltr']) .back-btn .icon-wrap,:host([dir='ltr']) .back-btn .icon-wrap{transform:scaleX(-1)}.conversation-dropdown{position:absolute;top:100%;left:0;right:0;z-index:20;height:360px;display:flex;flex-direction:column;background:var(--ai-bg-surface);border-bottom:1px solid var(--ai-border-light);box-shadow:var(--ai-shadow-md, 0 4px 12px rgba(0, 0, 0, 0.08));animation:slideDown 0.2s ease;overflow:hidden}.conversation-dropdown ai-conversation-list{display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden}@keyframes slideDown{from{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}";export{s as ai_chat_header}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,g as
|
|
1
|
+
import{p as e,g as t,b as a}from"./p-VMEwYfaX.js";export{s as setNonce}from"./p-VMEwYfaX.js";(()=>{const t=import.meta.url,a={};return""!==t&&(a.resourcesUrl=new URL(".",t).href),e(a)})().then((async e=>(await t(),a([["p-6a4b66ed",[[513,"ai-message-input",{placeholder:[1],disabled:[4],showVoiceButton:[4,"show-voice-button"],maxLength:[2,"max-length"],isRecording:[4,"is-recording"],inputValue:[32],showVoiceRecorder:[32],isMultiline:[32],setInputValue:[64]},null,{isRecording:[{onIsRecordingChange:0}]}]]],["p-338d55d3",[[513,"ai-rating",{question:[1],subtitle:[1],successMessage:[1,"success-message"],value:[1026],disabled:[4],hovered:[32],submitted:[32]}]]],["p-278895fd",[[513,"ai-chat-header",{mode:[1],conversation:[1],agentName:[1,"agent-name"],agentStatus:[1,"agent-status"],agentAvatar:[1,"agent-avatar"],showBack:[4,"show-back"],statusIndicator:[1,"status-indicator"],pageTitle:[1,"page-title"],pageUrl:[1,"page-url"],conversationItems:[16],conversationActiveId:[1,"conversation-active-id"],conversationLoading:[4,"conversation-loading"],conversationError:[4,"conversation-error"],conversationErrorText:[1,"conversation-error-text"],conversationRetryLabel:[1,"conversation-retry-label"],conversationEmptyText:[1,"conversation-empty-text"],conversationDeletingId:[1,"conversation-deleting-id"],titleLoading:[4,"title-loading"],avatarError:[32],dropdownOpen:[32],isFloating:[32]},[[4,"click","handleDocumentClick"]]]]],["p-4359a116",[[513,"ai-agent-error",{headline:[1],message:[1],errorCode:[1,"error-code"],retryable:[4],retryLabel:[1,"retry-label"],dismissible:[4]}]]],["p-1b247096",[[769,"ai-chat-container",{isOpen:[4,"is-open"],position:[1537],width:[1],autoScroll:[4,"auto-scroll"],showWatermark:[4,"show-watermark"],floatHeight:[1,"float-height"],theme:[1],loading:[4],error:[4],errorText:[1,"error-text"],retryLabel:[1,"retry-label"],direction:[513],isMobile:[32],floatLeft:[32],floatTop:[32],scrollToBottom:[64],cyclePosition:[64]},[[0,"headerPositionClick","handleHeaderPositionClick"]],{isOpen:[{isOpenChanged:0}],position:[{positionChanged:0}]}]]],["p-83f46030",[[769,"ai-chat-message",{role:[1],content:[1],format:[1],agentName:[1,"agent-name"],timestamp:[1],showActions:[4,"show-actions"],enableRegenerate:[4,"enable-regenerate"],feedbackValue:[1025,"feedback-value"],copySuccess:[32]}]]],["p-5f005ec5",[[769,"ai-conversation-summary",{conversation:[1],summary:[1],messageCount:[2,"message-count"],language:[1]}]]],["p-d02f2db5",[[513,"ai-in-chat-browser",{url:[1],pageTitle:[1,"page-title"],isLoading:[32],hasError:[32]},null,{url:[{onUrlChange:0}]}]]],["p-e6236df2",[[769,"ai-link",{label:[1],href:[1],target:[1],rel:[1]}]]],["p-cae762e0",[[513,"ai-loading",{mode:[1],statusText:[1,"status-text"],thinkingSubtext:[1,"thinking-subtext"],steps:[16],headerTitle:[1,"header-title"],currentAgent:[1,"current-agent"],showAgentBadges:[4,"show-agent-badges"],expanded:[1028],collapsible:[4],_expanded:[32]}]]],["p-6bd54e29",[[513,"ai-route-decision",{selectedAgent:[1,"selected-agent"],agentIcon:[1,"agent-icon"],reason:[1],confidence:[2],detectedLanguage:[1,"detected-language"],expanded:[1028],_expanded:[32]}]]],["p-062cad02",[[769,"ai-suggestion",{label:[1],disabled:[4]}]]],["p-187db371",[[513,"ai-voice-input",{disabled:[4],showWaveform:[4,"show-waveform"],autoStart:[4,"auto-start"],errorText:[1,"error-text"],waveformColor:[1,"waveform-color"],state:[32],error:[32],recordingDuration:[32],submitPulse:[32]}]]],["p-8fabdbe8",[[769,"ai-card",{noPadding:[4,"no-padding"],noShadow:[4,"no-shadow"]}]]],["p-17e5d542",[[513,"ai-conversation-list",{items:[16],activeId:[1,"active-id"],loading:[4],emptyText:[1,"empty-text"],error:[4],errorText:[1,"error-text"],retryLabel:[1,"retry-label"],deletingId:[1,"deleting-id"]}]]],["p-6b644d32",[[513,"ai-icon",{name:[1],size:[2]}]]]],e))));
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{p as e,H as t,c as i,h as r,d as a,t as n}from"./p-BPkf7wZg.js";import{i as s}from"./p-DlD8m3rf.js";const o=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.conversationSelect=i(this,"conversationSelect"),this.conversationDelete=i(this,"conversationDelete"),this.retryClick=i(this,"retryClick")}items=[];activeId="";loading=!1;emptyText="لا توجد محادثات";error=!1;errorText="تعذّر تحميل المحادثات";retryLabel="إعادة المحاولة";conversationSelect;conversationDelete;retryClick;renderIcon(e,t,i){const a=s[e];return a?r("span",{class:"icon-wrap",innerHTML:`<svg width="${t}" height="${i}" viewBox="${a.viewBox}" fill="none" xmlns="http://www.w3.org/2000/svg">${a.content}</svg>`}):null}formatRelativeTime(e){if(!e)return"";try{const t=new Date(e);if(isNaN(t.getTime()))return e;const i=Date.now()-t.getTime(),r=Math.floor(i/6e4),a=Math.floor(r/60),n=Math.floor(a/24),s="undefined"!=typeof document&&document.documentElement.lang||"ar",o=new Intl.RelativeTimeFormat(s,{numeric:"auto"});return r<1?o.format(0,"second"):r<60?o.format(-r,"minute"):a<24?o.format(-a,"hour"):o.format(-n,"day")}catch{return e}}renderRatingDots(e){return r("div",{class:"rating-dots","aria-label":e?`تقييم ${e} من 5`:void 0},Array.from({length:5},((t,i)=>r("span",{class:"rating-dot "+(i<(e??0)?"rating-dot--filled":"")}))))}renderSkeleton(){return r("div",{class:"skeleton-list"},[1,2,3,4].map((e=>r("div",{key:e,class:"skeleton-item"},r("div",{class:"skeleton-line skeleton-line--title"}),r("div",{class:"skeleton-line skeleton-line--preview"}),r("div",{class:"skeleton-line skeleton-line--meta"})))))}renderEmpty(){return r("div",{class:"empty-state"},r("div",{class:"empty-state__icon"},this.renderIcon("list",24,24)),r("p",{class:"empty-state__text"},this.emptyText))}renderError(){return r("div",{class:"error-state"},r("div",{class:"error-state__icon"},this.renderIcon("wifi-off",24,24)),r("p",{class:"error-state__text"},this.errorText),r("button",{class:"error-state__retry",onClick:()=>this.retryClick.emit()},this.renderIcon("reload",14,14),r("span",null,this.retryLabel)))}render(){const e=!this.loading&&!this.error&&0===this.items.length;return r(a,{key:"9be146c657629a6f7ac7f4325e1fbfdbea27f4de"},r("div",{key:"2e7f5daebdde0c69c5e22d581f9f31fc9f232308",class:"conversation-list"},r("div",{key:"f87e9462d0cac6e5d601528ada588aa18385b252",class:"list-scroll",role:"list"},this.loading?this.renderSkeleton():this.error?this.renderError():e?this.renderEmpty():this.items.map((e=>{const t=e.id===this.activeId;return r("div",{key:e.id,class:{"conv-item":!0,"conv-item--active":t},role:"listitem","aria-current":t?"true":void 0,onClick:()=>this.conversationSelect.emit(e.id)},r("div",{class:"conv-item__body"},r("p",{class:"conv-item__title"},e.title),r("p",{class:"conv-item__preview"},e.preview),r("div",{class:"conv-item__meta"},r("span",{class:"conv-item__time"},this.formatRelativeTime(e.timestamp)),null!=e.rating&&this.renderRatingDots(e.rating))),r("button",{class:"delete-btn","aria-label":"حذف المحادثة",onClick:t=>{t.stopPropagation(),this.conversationDelete.emit(e.id)}},this.renderIcon("cancel",14,14)))})))))}static get style(){return":host{display:flex;flex-direction:column;height:100%;min-height:0;overflow:hidden}.conversation-list{display:flex;flex-direction:column;gap:8px;flex:1;min-height:0;background:var(--ai-bg-surface)}.list-scroll{flex:1;min-height:0;overflow-y:auto;padding:0 8px 12px;scrollbar-width:thin;scrollbar-color:var(--ai-scrollbar-thumb) transparent}.list-scroll::-webkit-scrollbar{width:3px}.list-scroll::-webkit-scrollbar-track{background:transparent}.list-scroll::-webkit-scrollbar-thumb{background:var(--ai-scrollbar-thumb);border-radius:99px}.list-scroll::-webkit-scrollbar-thumb:hover{background:var(--ai-scrollbar-thumb-hover)}.conv-item{display:flex;align-items:flex-start;gap:6px;margin-top:6px;padding:10px 10px 10px 6px;border-radius:10px;cursor:pointer;transition:background 0.15s;position:relative}.conv-item:hover{background:var(--ai-bg-card)}.conv-item--active{background:var(--ai-bg-card);box-shadow:var(--ai-shadow-sm)}.conv-item__body{flex:1;min-width:0}.conv-item__title{margin:0 0 3px;font-size:13px;font-weight:600;color:var(--ai-text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.conv-item__preview{margin:0 0 5px;font-size:12px;color:var(--ai-text-muted);line-height:1.45;display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.conv-item__meta{display:flex;align-items:center;gap:8px}.conv-item__time{font-size:11px;color:var(--ai-text-muted);flex-shrink:0}.rating-dots{display:flex;align-items:center;gap:3px}.rating-dot{width:6px;height:6px;border-radius:50%;background:var(--ai-border-default);transition:background 0.15s}.rating-dot--filled{background:var(--ai-accent-warning, #ffaf44)}.delete-btn{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;background:transparent;border:none;border-radius:6px;cursor:pointer;color:var(--ai-text-muted);opacity:0;transition:opacity 0.15s, background 0.15s, color 0.15s;margin-block-start:2px}.conv-item:hover .delete-btn,.conv-item--active .delete-btn{opacity:1}.delete-btn:hover{background:var(--ai-status-danger-bg, rgba(239, 68, 68, 0.1));color:var(--ai-status-danger, #ef4444)}.delete-btn .icon-wrap{display:inline-flex;align-items:center;line-height:0}.empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:40px 16px;text-align:center}.empty-state__icon{display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:10px;background:var(--ai-bg-card);color:var(--ai-text-muted);line-height:0}.empty-state__icon .icon-wrap{display:inline-flex;align-items:center;line-height:0}.empty-state__text{margin:0;font-size:13px;color:var(--ai-text-muted);line-height:1.4}.error-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:40px 16px;text-align:center}.error-state__icon{display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:10px;background:var(--ai-status-danger-bg, rgba(239, 68, 68, 0.1));color:var(--ai-status-danger, #ef4444);line-height:0}.error-state__icon .icon-wrap{display:inline-flex;align-items:center;line-height:0}.error-state__text{margin:0;font-size:13px;color:var(--ai-text-muted);line-height:1.4}.error-state__retry{display:inline-flex;align-items:center;gap:4px;margin-top:4px;padding:6px 14px;font-size:12px;font-weight:600;color:var(--ai-text-primary);background:var(--ai-bg-card);border:1px solid var(--ai-border-default);border-radius:8px;cursor:pointer;transition:background 0.15s, box-shadow 0.15s}.error-state__retry:hover{box-shadow:var(--ai-shadow-sm)}.error-state__retry .icon-wrap{display:inline-flex;align-items:center;line-height:0}.skeleton-list{display:flex;flex-direction:column;gap:4px}.skeleton-item{padding:10px;border-radius:10px;display:flex;flex-direction:column;gap:6px}.skeleton-line{border-radius:6px;background:var(--ai-shimmer-gradient, linear-gradient(90deg, rgba(0, 0, 0, 0.06) 25%, rgba(0, 0, 0, 0.1) 50%, rgba(0, 0, 0, 0.06) 75%));background-size:200% 100%;animation:shimmer 2s linear infinite;height:12px}.skeleton-line--title{width:65%;height:13px}.skeleton-line--preview{width:100%}.skeleton-line--meta{width:35%;height:10px}@keyframes shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}"}},[513,"ai-conversation-list",{items:[16],activeId:[1,"active-id"],loading:[4],emptyText:[1,"empty-text"],error:[4],errorText:[1,"error-text"],retryLabel:[1,"retry-label"]}]);function l(){"undefined"!=typeof customElements&&["ai-conversation-list"].forEach((e=>{"ai-conversation-list"===e&&(customElements.get(n(e))||customElements.define(n(e),o))}))}export{o as A,l as d}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,c as t,h as i,H as r}from"./p-VMEwYfaX.js";import{i as a}from"./p-DlD8m3rf.js";const n=class{constructor(i){e(this,i),this.conversationSelect=t(this,"conversationSelect"),this.conversationDelete=t(this,"conversationDelete"),this.retryClick=t(this,"retryClick")}items=[];activeId="";loading=!1;emptyText="لا توجد محادثات";error=!1;errorText="تعذّر تحميل المحادثات";retryLabel="إعادة المحاولة";conversationSelect;conversationDelete;retryClick;renderIcon(e,t,r){const n=a[e];return n?i("span",{class:"icon-wrap",innerHTML:`<svg width="${t}" height="${r}" viewBox="${n.viewBox}" fill="none" xmlns="http://www.w3.org/2000/svg">${n.content}</svg>`}):null}formatRelativeTime(e){if(!e)return"";try{const t=new Date(e);if(isNaN(t.getTime()))return e;const i=Date.now()-t.getTime(),r=Math.floor(i/6e4),a=Math.floor(r/60),n=Math.floor(a/24),s="undefined"!=typeof document&&document.documentElement.lang||"ar",o=new Intl.RelativeTimeFormat(s,{numeric:"auto"});return r<1?o.format(0,"second"):r<60?o.format(-r,"minute"):a<24?o.format(-a,"hour"):o.format(-n,"day")}catch{return e}}renderRatingDots(e){return i("div",{class:"rating-dots","aria-label":e?`تقييم ${e} من 5`:void 0},Array.from({length:5},((t,r)=>i("span",{class:"rating-dot "+(r<(e??0)?"rating-dot--filled":"")}))))}renderSkeleton(){return i("div",{class:"skeleton-list"},[1,2,3,4].map((e=>i("div",{key:e,class:"skeleton-item"},i("div",{class:"skeleton-line skeleton-line--title"}),i("div",{class:"skeleton-line skeleton-line--preview"}),i("div",{class:"skeleton-line skeleton-line--meta"})))))}renderEmpty(){return i("div",{class:"empty-state"},i("div",{class:"empty-state__icon"},this.renderIcon("list",24,24)),i("p",{class:"empty-state__text"},this.emptyText))}renderError(){return i("div",{class:"error-state"},i("div",{class:"error-state__icon"},this.renderIcon("wifi-off",24,24)),i("p",{class:"error-state__text"},this.errorText),i("button",{class:"error-state__retry",onClick:()=>this.retryClick.emit()},this.renderIcon("reload",14,14),i("span",null,this.retryLabel)))}render(){const e=!this.loading&&!this.error&&0===this.items.length;return i(r,{key:"9be146c657629a6f7ac7f4325e1fbfdbea27f4de"},i("div",{key:"2e7f5daebdde0c69c5e22d581f9f31fc9f232308",class:"conversation-list"},i("div",{key:"f87e9462d0cac6e5d601528ada588aa18385b252",class:"list-scroll",role:"list"},this.loading?this.renderSkeleton():this.error?this.renderError():e?this.renderEmpty():this.items.map((e=>{const t=e.id===this.activeId;return i("div",{key:e.id,class:{"conv-item":!0,"conv-item--active":t},role:"listitem","aria-current":t?"true":void 0,onClick:()=>this.conversationSelect.emit(e.id)},i("div",{class:"conv-item__body"},i("p",{class:"conv-item__title"},e.title),i("p",{class:"conv-item__preview"},e.preview),i("div",{class:"conv-item__meta"},i("span",{class:"conv-item__time"},this.formatRelativeTime(e.timestamp)),null!=e.rating&&this.renderRatingDots(e.rating))),i("button",{class:"delete-btn","aria-label":"حذف المحادثة",onClick:t=>{t.stopPropagation(),this.conversationDelete.emit(e.id)}},this.renderIcon("cancel",14,14)))})))))}};n.style=":host{display:flex;flex-direction:column;height:100%;min-height:0;overflow:hidden}.conversation-list{display:flex;flex-direction:column;gap:8px;flex:1;min-height:0;background:var(--ai-bg-surface)}.list-scroll{flex:1;min-height:0;overflow-y:auto;padding:0 8px 12px;scrollbar-width:thin;scrollbar-color:var(--ai-scrollbar-thumb) transparent}.list-scroll::-webkit-scrollbar{width:3px}.list-scroll::-webkit-scrollbar-track{background:transparent}.list-scroll::-webkit-scrollbar-thumb{background:var(--ai-scrollbar-thumb);border-radius:99px}.list-scroll::-webkit-scrollbar-thumb:hover{background:var(--ai-scrollbar-thumb-hover)}.conv-item{display:flex;align-items:flex-start;gap:6px;margin-top:6px;padding:10px 10px 10px 6px;border-radius:10px;cursor:pointer;transition:background 0.15s;position:relative}.conv-item:hover{background:var(--ai-bg-card)}.conv-item--active{background:var(--ai-bg-card);box-shadow:var(--ai-shadow-sm)}.conv-item__body{flex:1;min-width:0}.conv-item__title{margin:0 0 3px;font-size:13px;font-weight:600;color:var(--ai-text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.conv-item__preview{margin:0 0 5px;font-size:12px;color:var(--ai-text-muted);line-height:1.45;display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.conv-item__meta{display:flex;align-items:center;gap:8px}.conv-item__time{font-size:11px;color:var(--ai-text-muted);flex-shrink:0}.rating-dots{display:flex;align-items:center;gap:3px}.rating-dot{width:6px;height:6px;border-radius:50%;background:var(--ai-border-default);transition:background 0.15s}.rating-dot--filled{background:var(--ai-accent-warning, #ffaf44)}.delete-btn{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;background:transparent;border:none;border-radius:6px;cursor:pointer;color:var(--ai-text-muted);opacity:0;transition:opacity 0.15s, background 0.15s, color 0.15s;margin-block-start:2px}.conv-item:hover .delete-btn,.conv-item--active .delete-btn{opacity:1}.delete-btn:hover{background:var(--ai-status-danger-bg, rgba(239, 68, 68, 0.1));color:var(--ai-status-danger, #ef4444)}.delete-btn .icon-wrap{display:inline-flex;align-items:center;line-height:0}.empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:40px 16px;text-align:center}.empty-state__icon{display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:10px;background:var(--ai-bg-card);color:var(--ai-text-muted);line-height:0}.empty-state__icon .icon-wrap{display:inline-flex;align-items:center;line-height:0}.empty-state__text{margin:0;font-size:13px;color:var(--ai-text-muted);line-height:1.4}.error-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:40px 16px;text-align:center}.error-state__icon{display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:10px;background:var(--ai-status-danger-bg, rgba(239, 68, 68, 0.1));color:var(--ai-status-danger, #ef4444);line-height:0}.error-state__icon .icon-wrap{display:inline-flex;align-items:center;line-height:0}.error-state__text{margin:0;font-size:13px;color:var(--ai-text-muted);line-height:1.4}.error-state__retry{display:inline-flex;align-items:center;gap:4px;margin-top:4px;padding:6px 14px;font-size:12px;font-weight:600;color:var(--ai-text-primary);background:var(--ai-bg-card);border:1px solid var(--ai-border-default);border-radius:8px;cursor:pointer;transition:background 0.15s, box-shadow 0.15s}.error-state__retry:hover{box-shadow:var(--ai-shadow-sm)}.error-state__retry .icon-wrap{display:inline-flex;align-items:center;line-height:0}.skeleton-list{display:flex;flex-direction:column;gap:4px}.skeleton-item{padding:10px;border-radius:10px;display:flex;flex-direction:column;gap:6px}.skeleton-line{border-radius:6px;background:var(--ai-shimmer-gradient, linear-gradient(90deg, rgba(0, 0, 0, 0.06) 25%, rgba(0, 0, 0, 0.1) 50%, rgba(0, 0, 0, 0.06) 75%));background-size:200% 100%;animation:shimmer 2s linear infinite;height:12px}.skeleton-line--title{width:65%;height:13px}.skeleton-line--preview{width:100%}.skeleton-line--meta{width:35%;height:10px}@keyframes shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}";export{n as ai_conversation_list}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as i,a as e,h as a,H as n}from"./p-VMEwYfaX.js";import{i as o}from"./p-DlD8m3rf.js";const s=class{constructor(e){t(this,e),this.closeClick=i(this,"closeClick"),this.newChatClick=i(this,"newChatClick"),this.dropdownClick=i(this,"dropdownClick"),this.positionClick=i(this,"positionClick"),this.headerPositionClick=i(this,"headerPositionClick"),this.backClick=i(this,"backClick"),this.headerDragStart=i(this,"headerDragStart"),this.openExternal=i(this,"openExternal"),this.conversationSelect=i(this,"conversationSelect"),this.conversationDelete=i(this,"conversationDelete")}get el(){return e(this)}mode="agent";conversation="محادثة جديدة";agentName="";agentStatus="";agentAvatar="";showBack=!0;statusIndicator="online";pageTitle="";pageUrl="";conversationItems=[];conversationActiveId="";conversationLoading=!1;titleLoading=!1;avatarError=!1;dropdownOpen=!1;isFloating=!1;parentPositionObserver=null;closeClick;newChatClick;dropdownClick;positionClick;headerPositionClick;backClick;headerDragStart;openExternal;conversationSelect;conversationDelete;handleDocumentClick(t){this.dropdownOpen&&!this.el.contains(t.target)&&(this.dropdownOpen=!1)}connectedCallback(){}componentDidLoad(){requestAnimationFrame((()=>{this.syncFloatingState(),this.observeParentPosition()}))}disconnectedCallback(){this.parentPositionObserver?.disconnect(),this.parentPositionObserver=null}observeParentPosition(){if(this.parentPositionObserver)return;const t=this.el.closest("ai-chat-container");t&&(this.parentPositionObserver=new MutationObserver((()=>this.syncFloatingState())),this.parentPositionObserver.observe(t,{attributes:!0,attributeFilter:["position"]}))}syncFloatingState(){const t=this.el.closest("ai-chat-container");if(t){const i="float"===t.getAttribute("position");this.isFloating!==i&&(this.isFloating=i)}else!1!==this.isFloating&&(this.isFloating=!1)}renderIcon(t,i,e){const n=o[t];return n?a("span",{class:"icon-wrap",innerHTML:`<svg width="${i}" height="${e}" viewBox="${n.viewBox}" fill="none" xmlns="http://www.w3.org/2000/svg">${n.content}</svg>`}):null}renderAvatar(){const t=this.agentName?this.agentName.charAt(0):"?";return!this.agentAvatar||this.avatarError?a("div",{class:"avatar-fallback"},t):a("img",{class:"avatar",src:this.agentAvatar,alt:this.agentName,onError:()=>{this.avatarError=!0}})}renderDragBtn(){return this.isFloating&&a("button",{class:"action-btn drag-btn","aria-label":"سحب / Drag",onPointerDown:t=>{t.preventDefault(),this.headerDragStart.emit({clientX:t.clientX,clientY:t.clientY})}},this.renderIcon("drag",11,15))}handleConversationSelect=t=>{t.stopPropagation(),this.conversationSelect.emit(t.detail),this.dropdownOpen=!1};handleConversationDelete=t=>{t.stopPropagation(),this.conversationDelete.emit(t.detail)};renderConversationDropdown(){return this.dropdownOpen&&"agent"===this.mode?a("div",{class:"conversation-dropdown"},a("ai-conversation-list",{items:this.conversationItems,activeId:this.conversationActiveId,loading:this.conversationLoading,onConversationSelect:this.handleConversationSelect,onConversationDelete:this.handleConversationDelete})):null}renderAgentMode(){return[this.renderDragBtn(),a("div",{class:"content agent dropdown-trigger",role:"button",onClick:()=>{this.titleLoading||(this.dropdownOpen=!this.dropdownOpen,this.dropdownClick.emit())},"aria-haspopup":"listbox","aria-expanded":this.dropdownOpen,"aria-label":`${this.conversation}, افتح قائمة المحادثات`},this.titleLoading?a("span",{class:"title-skeleton","aria-busy":"true","aria-label":"جاري التحميل"}):a("span",{class:"title"},this.conversation),!this.titleLoading&&a("span",{class:"dropdown-chevron"+(this.dropdownOpen?" open":"")},this.renderIcon("chevron-down",24,24))),a("div",{class:"actions"},a("button",{class:"action-btn","aria-label":"محادثة جديدة / New Chat",onClick:()=>this.newChatClick.emit()},this.renderIcon("pencil-edit",22,22)),a("button",{class:"action-btn","aria-label":"العرض / Position",onClick:()=>{this.positionClick.emit(),this.headerPositionClick.emit()}},this.renderIcon("hand",22,22)),a("button",{class:"action-btn","aria-label":"إغلاق / Close",onClick:()=>this.closeClick.emit()},this.renderIcon("cancel",22,22)))]}renderHumanMode(){return[this.renderDragBtn(),a("div",{class:"content human"},this.showBack&&a("button",{class:"back-btn","aria-label":"رجوع / Back",onClick:()=>this.backClick.emit()},this.renderIcon("arrow-right",24,24)),a("div",{class:"avatar-wrapper"},this.renderAvatar(),a("span",{class:`online-dot status-${this.statusIndicator}`},this.renderIcon("online-dot",10,10))),a("div",{class:"text-block"},a("span",{class:"agent-name"},this.agentName),this.agentStatus&&a("span",{class:"agent-status"},this.agentStatus))),a("div",{class:"actions"},a("button",{class:"action-btn","aria-label":"العرض / Position",onClick:()=>{this.positionClick.emit(),this.headerPositionClick.emit()}},this.renderIcon("hand",22,22)),a("button",{class:"action-btn","aria-label":"إغلاق / Close",onClick:()=>this.closeClick.emit()},this.renderIcon("cancel",22,22)))]}renderBrowserMode(){return[this.renderDragBtn(),a("div",{class:"content browser"},a("button",{class:"back-btn","aria-label":"رجوع / Back",onClick:()=>this.backClick.emit()},this.renderIcon("arrow-right",24,24)),a("span",{class:"browser-title"},this.pageTitle),a("button",{class:"browser-link-btn","aria-label":"فتح في نافذة جديدة / Open externally",onClick:()=>this.openExternal.emit(this.pageUrl)},this.renderIcon("link",14,14))),a("div",{class:"actions"},a("button",{class:"action-btn","aria-label":"العرض / Position",onClick:()=>{this.positionClick.emit(),this.headerPositionClick.emit()}},this.renderIcon("hand",22,22)),a("button",{class:"action-btn","aria-label":"إغلاق / Close",onClick:()=>this.closeClick.emit()},this.renderIcon("cancel",22,22)))]}render(){return a(n,{key:"b11b4d03d7f1980ec91b0fdba7db314971b7e7d3"},a("div",{key:"47f40b54a6861b69adee00bea45ab8a6691c13f2",class:"header-wrapper"},a("div",{key:"dcc18d4cb88457c2eb959bfccb2c8d72655d610a",class:"header-container"},"agent"===this.mode?this.renderAgentMode():"human"===this.mode?this.renderHumanMode():this.renderBrowserMode()),this.renderConversationDropdown()))}};s.style=":host{display:block;position:relative;z-index:10}.header-wrapper{position:relative;display:flex;flex-direction:column}.header-container{display:flex;align-items:center;gap:8px;padding:16px;background:var(--ai-bg-card);border-bottom:1px solid var(--ai-border-light);width:100%;box-sizing:border-box}.drag-btn{cursor:grab;color:var(--ai-text-muted)}.drag-btn:active{cursor:grabbing}.action-btn,.back-btn{width:40px;height:40px;padding:4px;display:flex;align-items:center;justify-content:center;background:var(--ai-bg-card);border:none;border-radius:8px;cursor:pointer;flex-shrink:0;color:var(--ai-text-primary);transition:background 0.15s ease}.action-btn:hover,.back-btn:hover{background:var(--ai-bg-surface)}.action-btn:focus-visible,.back-btn:focus-visible{outline:2px solid var(--ai-focus-ring);outline-offset:2px}.action-btn:active,.back-btn:active{background:var(--ai-bg-surface)}.actions{display:flex;align-items:center;gap:8px;flex-shrink:0}.content{flex:1 0 0;display:flex;align-items:center;justify-content:flex-start;min-width:0}.content.agent{gap:4px;height:40px}.content.human{gap:8px}.content.browser{gap:8px}.dropdown-trigger{display:flex;align-items:center;gap:4px;background:none;border:none;cursor:pointer;padding:0;flex-shrink:0;color:var(--ai-text-primary)}.dropdown-chevron{display:inline-flex;transition:transform 0.2s ease}.dropdown-chevron.open{transform:rotate(180deg)}.dropdown-trigger:focus-visible{outline:2px solid var(--ai-focus-ring);outline-offset:2px}.title{font-size:16px;font-weight:700;color:var(--ai-text-primary);white-space:nowrap;line-height:normal;min-width:0;overflow:hidden;text-overflow:ellipsis}@keyframes title-shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}.title-skeleton{display:inline-block;width:120px;height:16px;border-radius:8px;background:var(--ai-shimmer-gradient, linear-gradient(90deg, rgba(0,0,0,0.06) 25%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.06) 75%));background-size:200% 100%;animation:title-shimmer 1.6s ease-in-out infinite}.browser-title{font-size:14px;font-weight:600;color:var(--ai-text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;line-height:20px}.browser-link-btn{width:28px;height:28px;padding:0;display:inline-flex;align-items:center;justify-content:center;background:none;border:none;border-radius:8px;cursor:pointer;flex-shrink:0;color:var(--ai-text-secondary)}.browser-link-btn:focus-visible{outline:2px solid var(--ai-focus-ring);outline-offset:2px}.avatar-wrapper{position:relative;width:40px;height:40px;flex-shrink:0}.avatar{width:40px;height:40px;border-radius:9999px;border:1px solid var(--ai-border-default);object-fit:cover;display:block}.avatar-fallback{width:40px;height:40px;border-radius:9999px;border:1px solid var(--ai-border-default);background:var(--ai-bg-surface);color:var(--ai-text-primary);font-size:16px;font-weight:600;display:flex;align-items:center;justify-content:center;flex-shrink:0}.online-dot{position:absolute;bottom:0;inset-inline-end:0;width:10px;height:10px;display:inline-flex;align-items:center;justify-content:center;color:var(--ai-bg-card);}.online-dot.status-online{color:#22c55e;}.online-dot.status-offline{color:#9ca3af;}.online-dot.status-busy{color:#ef4444;}.online-dot.status-away{color:#f59e0b;}.text-block{display:flex;flex-direction:column;align-items:flex-start;gap:0;flex-shrink:0}.agent-name{font-size:14px;font-weight:500;color:var(--ai-text-primary);line-height:20px;white-space:nowrap}.agent-status{font-size:14px;font-weight:400;color:var(--ai-text-secondary);line-height:20px;white-space:nowrap}.icon-wrap{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}.icon-wrap svg{display:block}:host-context([dir='ltr']) .back-btn .icon-wrap,:host([dir='ltr']) .back-btn .icon-wrap{transform:scaleX(-1)}.conversation-dropdown{position:absolute;top:100%;left:0;right:0;z-index:20;height:360px;display:flex;flex-direction:column;background:var(--ai-bg-surface);border-bottom:1px solid var(--ai-border-light);box-shadow:var(--ai-shadow-md, 0 4px 12px rgba(0, 0, 0, 0.08));animation:slideDown 0.2s ease;overflow:hidden}.conversation-dropdown ai-conversation-list{display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden}@keyframes slideDown{from{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}";export{s as ai_chat_header}
|