@salla.sa/ui-ai-kit-core 2.2.4 → 2.2.5

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.
@@ -140,6 +140,7 @@ const ChatContainer = class {
140
140
  if (newVal === 'float') {
141
141
  this.setupDrag();
142
142
  }
143
+ this.positionChange.emit(newVal);
143
144
  }
144
145
  disconnectedCallback() {
145
146
  if (typeof window !== 'undefined') {
@@ -163,7 +164,6 @@ const ChatContainer = class {
163
164
  async cyclePosition() {
164
165
  const docked = this.direction === 'rtl' ? 'left' : 'right';
165
166
  this.position = this.position === 'float' ? docked : 'float';
166
- this.positionChange.emit(this.position);
167
167
  }
168
168
  handleWindowResize = () => {
169
169
  this.checkMobile();
@@ -235,7 +235,7 @@ const ChatContainer = class {
235
235
  return (index.h("div", { class: "error-state", role: "alert" }, index.h("svg", { class: "error-icon", width: "48", height: "48", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor", "stroke-width": "1.5" }), index.h("path", { d: "M12 7v6", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round" }), index.h("circle", { cx: "12", cy: "16.5", r: "0.75", fill: "currentColor" })), index.h("p", { class: "error-text" }, this.errorText), index.h("button", { class: "error-retry-btn", type: "button", onClick: () => this.retryClick.emit() }, this.retryLabel)));
236
236
  }
237
237
  render() {
238
- return (index.h(index.Host, { key: '6290736307488f10a4ed441e2a8e0b3a2e89af05', class: { dark: this.isDark() } }, index.h("div", { key: '6d6a731d9941457b786c71625243a7dd1e9f11f8', class: this.getContainerClasses(), style: this.getContainerStyle(), ref: el => (this.containerRef = el) }, this.showWatermark && !this.loading && !this.error && (index.h("div", { key: '0c2ae5b52f8c30bdf356a3c356d52305451cb19e', class: "watermark" }, index.h("svg", { key: '36076d8dd514f5736050228d22b9a03d5d48ce28', class: "watermark-circle-svg", width: "133", height: "133", viewBox: "0 0 133 133", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("g", { key: '737a3f3d8b7a0f91120258c292d047f9dc90871c', filter: "url(#wm_circle_shadow)" }, index.h("circle", { key: 'a59549c879ddaa2a0007c4fd9645c4382b14e73f', cx: "66.415", cy: "66.415", r: "66.415", class: "watermark-circle" })), index.h("defs", { key: '58d5edc4e05f3dd8a60f7a829b70f154ba85bfc1' }, index.h("filter", { key: 'd2cb7cb5a84bdf1496b56ec5a0c0c79001040670', id: "wm_circle_shadow", x: "0", y: "0", width: "132.83", height: "135.83", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB" }, index.h("feFlood", { key: 'e90404f557fba552a21bd3748ad728470172040f', "flood-opacity": "0", result: "BackgroundImageFix" }), index.h("feBlend", { key: 'ef5aee167a4973c35f8ffaa8ae4a0487de8266ee', mode: "normal", in: "SourceGraphic", in2: "BackgroundImageFix", result: "shape" }), index.h("feColorMatrix", { key: 'e0869202bc43610b91abce92e85e8e5264cda999', in: "SourceAlpha", type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0", result: "hardAlpha" }), index.h("feOffset", { key: '7bef38d885b93711fce4c0efbb719a83417eeefb', dy: "3" }), index.h("feGaussianBlur", { key: '053de38388f049be8db7867b99b53d403de934ca', stdDeviation: "3" }), index.h("feComposite", { key: 'e5f68fbcf0923174a177545bf3364d066a122347', in2: "hardAlpha", operator: "arithmetic", k2: "-1", k3: "1" }), index.h("feColorMatrix", { key: '62dc924cbdc92ce4adc0ec81be851c1d40e7a5b0', type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0" }), index.h("feBlend", { key: '908299725f9e553c636bd18eab6541c6a7c69fe5', mode: "normal", in2: "shape", result: "effect1_innerShadow" })))), index.h("svg", { key: '2a6ce2364bfd667c4eba56d859a1326f70a82901', class: "watermark-star-svg", width: "78", height: "78", viewBox: "0 0 78 78", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("g", { key: 'e2c431ac6bee320c817a7283e6e356edc4667146', filter: "url(#wm_star_shadow)" }, index.h("path", { key: 'd87d0313e649527f5909ac1b08f7af2979760d79', d: "M38.7421 0C39.5691 0 40.2689 0.286272 40.8414 0.858815C41.414 1.43136 41.7002 2.13113 41.7002 2.95814C41.7002 8.87442 43.1952 14.3772 46.1851 19.4665C49.1115 24.4285 53.0557 28.3727 58.0177 31.299C63.107 34.289 68.6097 35.7839 74.526 35.7839C75.353 35.7839 76.0528 36.0702 76.6254 36.6428C77.1979 37.2153 77.4842 37.9151 77.4842 38.7421C77.4842 39.5691 77.1979 40.2689 76.6254 40.8414C76.0528 41.414 75.353 41.7002 74.526 41.7002C68.6097 41.7002 63.107 43.1952 58.0177 46.1851C53.0557 49.1115 49.1115 53.0557 46.1851 58.0177C43.1952 63.107 41.7002 68.6097 41.7002 74.526C41.7002 75.353 41.414 76.0528 40.8414 76.6254C40.2689 77.1979 39.5691 77.4842 38.7421 77.4842C37.9151 77.4842 37.2153 77.1979 36.6428 76.6254C36.0702 76.0528 35.7839 75.353 35.7839 74.526C35.7839 68.6097 34.289 63.107 31.299 58.0177C28.3727 53.0557 24.4285 49.1115 19.4665 46.1851C14.3772 43.1952 8.87442 41.7002 2.95814 41.7002C2.13113 41.7002 1.43136 41.414 0.858815 40.8414C0.286272 40.2689 0 39.5691 0 38.7421C0 37.9151 0.286272 37.2153 0.858815 36.6428C1.43136 36.0702 2.13113 35.7839 2.95814 35.7839C8.87442 35.7839 14.3772 34.289 19.4665 31.299C24.4285 28.3727 28.3727 24.4285 31.299 19.4665C34.289 14.3772 35.7839 8.87442 35.7839 2.95814C35.7839 2.13113 36.0702 1.43136 36.6428 0.858815C37.2153 0.286272 37.9151 0 38.7421 0Z", class: "watermark-star" })), index.h("defs", { key: '51e7ef185399e3a10d0b19eb399500be3e5384f8' }, index.h("filter", { key: '09f52cd1b7084a8af9488bbce05c277fe07012f9', id: "wm_star_shadow", x: "0", y: "0", width: "77.4844", height: "79.4841", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB" }, index.h("feFlood", { key: '1b055616d714f824dd38a895a5c1a635fefc4a66', "flood-opacity": "0", result: "BackgroundImageFix" }), index.h("feBlend", { key: '044cba9d32d0a1d56fc39d318dfc1cdd0fdc0ae7', mode: "normal", in: "SourceGraphic", in2: "BackgroundImageFix", result: "shape" }), index.h("feColorMatrix", { key: '4bf50b36bd6b1ae90d29a95290762ef52dbfff7a', in: "SourceAlpha", type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0", result: "hardAlpha" }), index.h("feOffset", { key: '0988514af2fda03cb2ff43e95c1423137351186f', dy: "2" }), index.h("feGaussianBlur", { key: 'c96fb451b890e9bda84043dcd699c2a3f59c195c', stdDeviation: "2" }), index.h("feComposite", { key: '77b2bb3e01eefb08cac5f60a494c2cd15e97db4a', in2: "hardAlpha", operator: "arithmetic", k2: "-1", k3: "1" }), index.h("feColorMatrix", { key: 'aef785066c732cc5cbc16689f2e57a7df7d18bc5', type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0" }), index.h("feBlend", { key: '292a1d370d268312514f1c8fcee2167159c2d4e9', mode: "normal", in2: "shape", result: "effect1_innerShadow" })))))), index.h("slot", { key: '009fd561884a5a70e559d865dc1b1d55937d923c', name: "header" }), index.h("div", { key: 'fde5090720cd70c2b5fe72bcaec95007e7792f4e', class: "messages-area", ref: el => (this.messagesAreaRef = el) }, this.loading ? this.renderSkeleton() : this.error ? this.renderError() : index.h("slot", null)), index.h("slot", { key: '838ea2de9f788af2af70568a7882a08645c6b2ac', name: "footer" }))));
238
+ return (index.h(index.Host, { key: '1213110dce6a44b37c4a7b1f6a584368951964d2', class: { dark: this.isDark() } }, index.h("div", { key: 'df0df824b4ef271aae37dee7aa2fc85037ef647a', class: this.getContainerClasses(), style: this.getContainerStyle(), ref: el => (this.containerRef = el) }, this.showWatermark && !this.loading && !this.error && (index.h("div", { key: '168fd1510d8910f234331c03d4d549d0a9586472', class: "watermark" }, index.h("svg", { key: 'fde35527192a8501b190462bfdf66ae7d739742c', class: "watermark-circle-svg", width: "133", height: "133", viewBox: "0 0 133 133", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("g", { key: '63c94c35e3adafac862c39cda04d05d75199bae0', filter: "url(#wm_circle_shadow)" }, index.h("circle", { key: '8e8e304ae2132ad36855457a7755b2ba20770038', cx: "66.415", cy: "66.415", r: "66.415", class: "watermark-circle" })), index.h("defs", { key: 'c571edd0fb6a68bf9e62530398ba01e482f5755e' }, index.h("filter", { key: 'c63ab4c6c16db9eac63d944c481564af4667f493', id: "wm_circle_shadow", x: "0", y: "0", width: "132.83", height: "135.83", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB" }, index.h("feFlood", { key: '37105253941532ffc3136713df67e87b9ef123e5', "flood-opacity": "0", result: "BackgroundImageFix" }), index.h("feBlend", { key: 'ecde8a14cbc2a11125e548ebe412f00381aa561e', mode: "normal", in: "SourceGraphic", in2: "BackgroundImageFix", result: "shape" }), index.h("feColorMatrix", { key: '1001d9bf46d7df0f8788e46cfb311a90b5984f8d', in: "SourceAlpha", type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0", result: "hardAlpha" }), index.h("feOffset", { key: '4ffa296814b3eeb49e56688f1d6a981ac7055a92', dy: "3" }), index.h("feGaussianBlur", { key: '91a6bf8600f4b30c24af6717d61a7549584240f7', stdDeviation: "3" }), index.h("feComposite", { key: '325b8156a7a3cc8dfa1855d687436d170dc83bbb', in2: "hardAlpha", operator: "arithmetic", k2: "-1", k3: "1" }), index.h("feColorMatrix", { key: '48da64c927a7c97e21b499576cc8a421445ffd61', type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0" }), index.h("feBlend", { key: '2c3fcf67f6769a6e6cee16ee4f7a6115a2aa3fbc', mode: "normal", in2: "shape", result: "effect1_innerShadow" })))), index.h("svg", { key: '25669b41c62a83760adb26129d4547ece7d5f6d9', class: "watermark-star-svg", width: "78", height: "78", viewBox: "0 0 78 78", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("g", { key: 'e1347f63fe1b5b57c1be6d4958817c2682745972', filter: "url(#wm_star_shadow)" }, index.h("path", { key: '12ca3bbc4dcca07dbd4cc9e5b0227c2a4b5eeb98', d: "M38.7421 0C39.5691 0 40.2689 0.286272 40.8414 0.858815C41.414 1.43136 41.7002 2.13113 41.7002 2.95814C41.7002 8.87442 43.1952 14.3772 46.1851 19.4665C49.1115 24.4285 53.0557 28.3727 58.0177 31.299C63.107 34.289 68.6097 35.7839 74.526 35.7839C75.353 35.7839 76.0528 36.0702 76.6254 36.6428C77.1979 37.2153 77.4842 37.9151 77.4842 38.7421C77.4842 39.5691 77.1979 40.2689 76.6254 40.8414C76.0528 41.414 75.353 41.7002 74.526 41.7002C68.6097 41.7002 63.107 43.1952 58.0177 46.1851C53.0557 49.1115 49.1115 53.0557 46.1851 58.0177C43.1952 63.107 41.7002 68.6097 41.7002 74.526C41.7002 75.353 41.414 76.0528 40.8414 76.6254C40.2689 77.1979 39.5691 77.4842 38.7421 77.4842C37.9151 77.4842 37.2153 77.1979 36.6428 76.6254C36.0702 76.0528 35.7839 75.353 35.7839 74.526C35.7839 68.6097 34.289 63.107 31.299 58.0177C28.3727 53.0557 24.4285 49.1115 19.4665 46.1851C14.3772 43.1952 8.87442 41.7002 2.95814 41.7002C2.13113 41.7002 1.43136 41.414 0.858815 40.8414C0.286272 40.2689 0 39.5691 0 38.7421C0 37.9151 0.286272 37.2153 0.858815 36.6428C1.43136 36.0702 2.13113 35.7839 2.95814 35.7839C8.87442 35.7839 14.3772 34.289 19.4665 31.299C24.4285 28.3727 28.3727 24.4285 31.299 19.4665C34.289 14.3772 35.7839 8.87442 35.7839 2.95814C35.7839 2.13113 36.0702 1.43136 36.6428 0.858815C37.2153 0.286272 37.9151 0 38.7421 0Z", class: "watermark-star" })), index.h("defs", { key: '6118bbae343ffc6cdc52df3d2062b63dd655f96d' }, index.h("filter", { key: 'ac762ad5983155b7122e4e1466dcaa9230d2ad4f', id: "wm_star_shadow", x: "0", y: "0", width: "77.4844", height: "79.4841", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB" }, index.h("feFlood", { key: '452561901594c49f607f2a5a0dd149edab297703', "flood-opacity": "0", result: "BackgroundImageFix" }), index.h("feBlend", { key: 'bd77b4ec605953eff1b83d63b152f6bc0cf757f9', mode: "normal", in: "SourceGraphic", in2: "BackgroundImageFix", result: "shape" }), index.h("feColorMatrix", { key: '55215acb177fe0a8d7bf454244d1eec0a52657d9', in: "SourceAlpha", type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0", result: "hardAlpha" }), index.h("feOffset", { key: '2079610df4ddb703dffdb0ba26a83262b28ddb8e', dy: "2" }), index.h("feGaussianBlur", { key: 'b42acf138ed8ed2c51ce3a51eb774f8ccb3932a5', stdDeviation: "2" }), index.h("feComposite", { key: '6b2439a1f50c1355851333431d1745d864fd4a68', in2: "hardAlpha", operator: "arithmetic", k2: "-1", k3: "1" }), index.h("feColorMatrix", { key: 'da9900a125e3e0df5f3bb383382b949d0c967d9c', type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0" }), index.h("feBlend", { key: '579851be42d902cbd9939df09ba996b11210181f', mode: "normal", in2: "shape", result: "effect1_innerShadow" })))))), index.h("slot", { key: 'e2ef3a4097ff512ac2e9638fef4725b55cd4ea24', name: "header" }), index.h("div", { key: '46dac73e46b2eac797c88ed826497e4d6063f2d3', class: "messages-area", ref: el => (this.messagesAreaRef = el) }, this.loading ? this.renderSkeleton() : this.error ? this.renderError() : index.h("slot", null)), index.h("slot", { key: 'ff2cf3628bbab90bd0cdce07df6c08ae597867ba', name: "footer" }))));
239
239
  }
240
240
  static get watchers() { return {
241
241
  "isOpen": [{
@@ -57,11 +57,18 @@ const AiChatHeader = class {
57
57
  conversationDeletingId = '';
58
58
  /** Show a shimmer skeleton in place of the conversation title (e.g. while loading conversation) */
59
59
  titleLoading = false;
60
+ /** Hide the new-chat (pencil-edit) button */
61
+ disableNewChat = false;
62
+ /** Hide the conversation-list dropdown trigger (title chevron) */
63
+ disableConversationList = false;
60
64
  avatarError = false;
61
65
  dropdownOpen = false;
62
66
  /** Internally managed — true when the parent ai-chat-container has position="float" */
63
67
  isFloating = false;
68
+ /** Internally managed — true when viewport width < 768px (matches ai-chat-container logic) */
69
+ isMobile = false;
64
70
  parentPositionObserver = null;
71
+ handleWindowResize = () => this.checkMobile();
65
72
  /** Cancel / close button */
66
73
  closeClick;
67
74
  /** Pencil-edit button (agent mode) */
@@ -96,7 +103,7 @@ const AiChatHeader = class {
96
103
  }
97
104
  }
98
105
  connectedCallback() {
99
- // Initial sync will happen in componentDidLoad
106
+ this.checkMobile();
100
107
  }
101
108
  componentDidLoad() {
102
109
  // By this point, the element is fully in the DOM and parent relationships are established
@@ -105,10 +112,21 @@ const AiChatHeader = class {
105
112
  this.syncFloatingState();
106
113
  this.observeParentPosition();
107
114
  });
115
+ if (typeof window !== 'undefined') {
116
+ window.addEventListener('resize', this.handleWindowResize);
117
+ }
108
118
  }
109
119
  disconnectedCallback() {
110
120
  this.parentPositionObserver?.disconnect();
111
121
  this.parentPositionObserver = null;
122
+ if (typeof window !== 'undefined') {
123
+ window.removeEventListener('resize', this.handleWindowResize);
124
+ }
125
+ }
126
+ checkMobile() {
127
+ if (typeof window !== 'undefined') {
128
+ this.isMobile = window.innerWidth < 768;
129
+ }
112
130
  }
113
131
  observeParentPosition() {
114
132
  if (this.parentPositionObserver)
@@ -149,7 +167,7 @@ const AiChatHeader = class {
149
167
  } }));
150
168
  }
151
169
  renderDragBtn() {
152
- return (this.isFloating && (index.h("button", { class: "action-btn drag-btn", "aria-label": "\u0633\u062D\u0628 / Drag", onPointerDown: (e) => {
170
+ return (this.isFloating && !this.isMobile && (index.h("button", { class: "action-btn drag-btn", "aria-label": "\u0633\u062D\u0628 / Drag", onPointerDown: (e) => {
153
171
  e.preventDefault();
154
172
  this.headerDragStart.emit({ clientX: e.clientX, clientY: e.clientY });
155
173
  } }, this.renderIcon('drag', 11, 15))));
@@ -168,38 +186,39 @@ const AiChatHeader = class {
168
186
  this.conversationRetry.emit();
169
187
  };
170
188
  renderConversationDropdown() {
171
- if (!this.dropdownOpen || this.mode !== 'agent')
189
+ if (!this.dropdownOpen || this.mode !== 'agent' || this.disableConversationList)
172
190
  return null;
173
191
  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 })));
174
192
  }
175
193
  renderAgentMode() {
194
+ const titleContent = this.disableConversationList ? (index.h("div", { class: "content agent" }, this.titleLoading ? (index.h("span", { class: "title-skeleton", "aria-busy": "true", "aria-label": "\u062C\u0627\u0631\u064A \u0627\u0644\u062A\u062D\u0645\u064A\u0644" })) : (index.h("span", { class: "title" }, this.conversation)))) : (index.h("div", { class: "content agent dropdown-trigger", role: "button", onClick: () => {
195
+ if (this.titleLoading)
196
+ return;
197
+ this.dropdownOpen = !this.dropdownOpen;
198
+ this.dropdownClick.emit();
199
+ }, "aria-haspopup": "listbox", "aria-expanded": this.dropdownOpen, "aria-label": `${this.conversation}, افتح قائمة المحادثات` }, this.titleLoading ? (index.h("span", { class: "title-skeleton", "aria-busy": "true", "aria-label": "\u062C\u0627\u0631\u064A \u0627\u0644\u062A\u062D\u0645\u064A\u0644" })) : (index.h("span", { class: "title" }, this.conversation)), !this.titleLoading && (index.h("span", { class: `dropdown-chevron${this.dropdownOpen ? ' open' : ''}` }, this.renderIcon('chevron-down', 24, 24)))));
176
200
  return [
177
201
  this.renderDragBtn(),
178
- index.h("div", { class: "content agent dropdown-trigger", role: "button", onClick: () => {
179
- if (this.titleLoading)
180
- return;
181
- this.dropdownOpen = !this.dropdownOpen;
182
- this.dropdownClick.emit();
183
- }, "aria-haspopup": "listbox", "aria-expanded": this.dropdownOpen, "aria-label": `${this.conversation}, افتح قائمة المحادثات` }, this.titleLoading ? (index.h("span", { class: "title-skeleton", "aria-busy": "true", "aria-label": "\u062C\u0627\u0631\u064A \u0627\u0644\u062A\u062D\u0645\u064A\u0644" })) : (index.h("span", { class: "title" }, this.conversation)), !this.titleLoading && (index.h("span", { class: `dropdown-chevron${this.dropdownOpen ? ' open' : ''}` }, this.renderIcon('chevron-down', 24, 24)))),
184
- index.h("div", { class: "actions" }, index.h("button", { class: "action-btn", "aria-label": "\u0645\u062D\u0627\u062F\u062B\u0629 \u062C\u062F\u064A\u062F\u0629 / New Chat", onClick: () => this.newChatClick.emit() }, this.renderIcon('pencil-edit', 22, 22)), index.h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => { this.positionClick.emit(); this.headerPositionClick.emit(); } }, this.renderIcon('hand', 22, 22)), index.h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
202
+ titleContent,
203
+ index.h("div", { class: "actions" }, !this.disableNewChat && (index.h("button", { class: "action-btn", "aria-label": "\u0645\u062D\u0627\u062F\u062B\u0629 \u062C\u062F\u064A\u062F\u0629 / New Chat", onClick: () => this.newChatClick.emit() }, this.renderIcon('pencil-edit', 22, 22))), !this.isMobile && (index.h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => { this.positionClick.emit(); this.headerPositionClick.emit(); } }, this.renderIcon('hand', 22, 22))), index.h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
185
204
  ];
186
205
  }
187
206
  renderHumanMode() {
188
207
  return [
189
208
  this.renderDragBtn(),
190
209
  index.h("div", { class: "content human" }, this.showBack && (index.h("button", { class: "back-btn", "aria-label": "\u0631\u062C\u0648\u0639 / Back", onClick: () => this.backClick.emit() }, this.renderIcon('arrow-right', 24, 24))), index.h("div", { class: "avatar-wrapper" }, this.renderAvatar(), index.h("span", { class: `online-dot status-${this.statusIndicator}` }, this.renderIcon('online-dot', 10, 10))), index.h("div", { class: "text-block" }, index.h("span", { class: "agent-name" }, this.agentName), this.agentStatus && index.h("span", { class: "agent-status" }, this.agentStatus))),
191
- index.h("div", { class: "actions" }, index.h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => { this.positionClick.emit(); this.headerPositionClick.emit(); } }, this.renderIcon('hand', 22, 22)), index.h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
210
+ index.h("div", { class: "actions" }, !this.isMobile && (index.h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => { this.positionClick.emit(); this.headerPositionClick.emit(); } }, this.renderIcon('hand', 22, 22))), index.h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
192
211
  ];
193
212
  }
194
213
  renderBrowserMode() {
195
214
  return [
196
215
  this.renderDragBtn(),
197
216
  index.h("div", { class: "content browser" }, index.h("button", { class: "back-btn", "aria-label": "\u0631\u062C\u0648\u0639 / Back", onClick: () => this.backClick.emit() }, this.renderIcon('arrow-right', 24, 24)), index.h("span", { class: "browser-title" }, this.pageTitle), index.h("button", { class: "browser-link-btn", "aria-label": "\u0641\u062A\u062D \u0641\u064A \u0646\u0627\u0641\u0630\u0629 \u062C\u062F\u064A\u062F\u0629 / Open externally", onClick: () => this.openExternal.emit(this.pageUrl) }, this.renderIcon('link', 14, 14))),
198
- index.h("div", { class: "actions" }, index.h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => { this.positionClick.emit(); this.headerPositionClick.emit(); } }, this.renderIcon('hand', 22, 22)), index.h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
217
+ index.h("div", { class: "actions" }, !this.isMobile && (index.h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => { this.positionClick.emit(); this.headerPositionClick.emit(); } }, this.renderIcon('hand', 22, 22))), index.h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
199
218
  ];
200
219
  }
201
220
  render() {
202
- return (index.h(index.Host, { key: '80236bfcbfac98d3efa3955f03aab4ef68c9cfea' }, index.h("div", { key: 'dcc4142bba1d5f07782dbc7b0a3ec287e0154223', class: "header-wrapper" }, index.h("div", { key: 'ca0ff9a2946cead0b86cb82390624894ed414378', class: "header-container" }, this.mode === 'agent' ? this.renderAgentMode() : this.mode === 'human' ? this.renderHumanMode() : this.renderBrowserMode()), this.renderConversationDropdown())));
221
+ return (index.h(index.Host, { key: '4c51abf7f5fb572ec62191c0b097a4fdf9b218c3' }, index.h("div", { key: 'c05febe2f984bad8e80b9f0d9f2ceeebc812a9b4', class: "header-wrapper" }, index.h("div", { key: '927c606ae5452a9a5c1e19edd2145f9e1ee42d2c', class: "header-container" }, this.mode === 'agent' ? this.renderAgentMode() : this.mode === 'human' ? this.renderHumanMode() : this.renderBrowserMode()), this.renderConversationDropdown())));
203
222
  }
204
223
  };
205
224
  AiChatHeader.style = aiChatHeaderCss();
@@ -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"],"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);
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"],"disableNewChat":[4,"disable-new-chat"],"disableConversationList":[4,"disable-conversation-list"],"avatarError":[32],"dropdownOpen":[32],"isFloating":[32],"isMobile":[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"],"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);
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"],"disableNewChat":[4,"disable-new-chat"],"disableConversationList":[4,"disable-conversation-list"],"avatarError":[32],"dropdownOpen":[32],"isFloating":[32],"isMobile":[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;
@@ -130,6 +130,7 @@ export class ChatContainer {
130
130
  if (newVal === 'float') {
131
131
  this.setupDrag();
132
132
  }
133
+ this.positionChange.emit(newVal);
133
134
  }
134
135
  disconnectedCallback() {
135
136
  if (typeof window !== 'undefined') {
@@ -153,7 +154,6 @@ export class ChatContainer {
153
154
  async cyclePosition() {
154
155
  const docked = this.direction === 'rtl' ? 'left' : 'right';
155
156
  this.position = this.position === 'float' ? docked : 'float';
156
- this.positionChange.emit(this.position);
157
157
  }
158
158
  handleWindowResize = () => {
159
159
  this.checkMobile();
@@ -225,7 +225,7 @@ export class ChatContainer {
225
225
  return (h("div", { class: "error-state", role: "alert" }, h("svg", { class: "error-icon", width: "48", height: "48", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor", "stroke-width": "1.5" }), h("path", { d: "M12 7v6", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round" }), h("circle", { cx: "12", cy: "16.5", r: "0.75", fill: "currentColor" })), h("p", { class: "error-text" }, this.errorText), h("button", { class: "error-retry-btn", type: "button", onClick: () => this.retryClick.emit() }, this.retryLabel)));
226
226
  }
227
227
  render() {
228
- return (h(Host, { key: '6290736307488f10a4ed441e2a8e0b3a2e89af05', class: { dark: this.isDark() } }, h("div", { key: '6d6a731d9941457b786c71625243a7dd1e9f11f8', class: this.getContainerClasses(), style: this.getContainerStyle(), ref: el => (this.containerRef = el) }, this.showWatermark && !this.loading && !this.error && (h("div", { key: '0c2ae5b52f8c30bdf356a3c356d52305451cb19e', class: "watermark" }, h("svg", { key: '36076d8dd514f5736050228d22b9a03d5d48ce28', class: "watermark-circle-svg", width: "133", height: "133", viewBox: "0 0 133 133", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("g", { key: '737a3f3d8b7a0f91120258c292d047f9dc90871c', filter: "url(#wm_circle_shadow)" }, h("circle", { key: 'a59549c879ddaa2a0007c4fd9645c4382b14e73f', cx: "66.415", cy: "66.415", r: "66.415", class: "watermark-circle" })), h("defs", { key: '58d5edc4e05f3dd8a60f7a829b70f154ba85bfc1' }, h("filter", { key: 'd2cb7cb5a84bdf1496b56ec5a0c0c79001040670', id: "wm_circle_shadow", x: "0", y: "0", width: "132.83", height: "135.83", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB" }, h("feFlood", { key: 'e90404f557fba552a21bd3748ad728470172040f', "flood-opacity": "0", result: "BackgroundImageFix" }), h("feBlend", { key: 'ef5aee167a4973c35f8ffaa8ae4a0487de8266ee', mode: "normal", in: "SourceGraphic", in2: "BackgroundImageFix", result: "shape" }), h("feColorMatrix", { key: 'e0869202bc43610b91abce92e85e8e5264cda999', in: "SourceAlpha", type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0", result: "hardAlpha" }), h("feOffset", { key: '7bef38d885b93711fce4c0efbb719a83417eeefb', dy: "3" }), h("feGaussianBlur", { key: '053de38388f049be8db7867b99b53d403de934ca', stdDeviation: "3" }), h("feComposite", { key: 'e5f68fbcf0923174a177545bf3364d066a122347', in2: "hardAlpha", operator: "arithmetic", k2: "-1", k3: "1" }), h("feColorMatrix", { key: '62dc924cbdc92ce4adc0ec81be851c1d40e7a5b0', type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0" }), h("feBlend", { key: '908299725f9e553c636bd18eab6541c6a7c69fe5', mode: "normal", in2: "shape", result: "effect1_innerShadow" })))), h("svg", { key: '2a6ce2364bfd667c4eba56d859a1326f70a82901', class: "watermark-star-svg", width: "78", height: "78", viewBox: "0 0 78 78", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("g", { key: 'e2c431ac6bee320c817a7283e6e356edc4667146', filter: "url(#wm_star_shadow)" }, h("path", { key: 'd87d0313e649527f5909ac1b08f7af2979760d79', d: "M38.7421 0C39.5691 0 40.2689 0.286272 40.8414 0.858815C41.414 1.43136 41.7002 2.13113 41.7002 2.95814C41.7002 8.87442 43.1952 14.3772 46.1851 19.4665C49.1115 24.4285 53.0557 28.3727 58.0177 31.299C63.107 34.289 68.6097 35.7839 74.526 35.7839C75.353 35.7839 76.0528 36.0702 76.6254 36.6428C77.1979 37.2153 77.4842 37.9151 77.4842 38.7421C77.4842 39.5691 77.1979 40.2689 76.6254 40.8414C76.0528 41.414 75.353 41.7002 74.526 41.7002C68.6097 41.7002 63.107 43.1952 58.0177 46.1851C53.0557 49.1115 49.1115 53.0557 46.1851 58.0177C43.1952 63.107 41.7002 68.6097 41.7002 74.526C41.7002 75.353 41.414 76.0528 40.8414 76.6254C40.2689 77.1979 39.5691 77.4842 38.7421 77.4842C37.9151 77.4842 37.2153 77.1979 36.6428 76.6254C36.0702 76.0528 35.7839 75.353 35.7839 74.526C35.7839 68.6097 34.289 63.107 31.299 58.0177C28.3727 53.0557 24.4285 49.1115 19.4665 46.1851C14.3772 43.1952 8.87442 41.7002 2.95814 41.7002C2.13113 41.7002 1.43136 41.414 0.858815 40.8414C0.286272 40.2689 0 39.5691 0 38.7421C0 37.9151 0.286272 37.2153 0.858815 36.6428C1.43136 36.0702 2.13113 35.7839 2.95814 35.7839C8.87442 35.7839 14.3772 34.289 19.4665 31.299C24.4285 28.3727 28.3727 24.4285 31.299 19.4665C34.289 14.3772 35.7839 8.87442 35.7839 2.95814C35.7839 2.13113 36.0702 1.43136 36.6428 0.858815C37.2153 0.286272 37.9151 0 38.7421 0Z", class: "watermark-star" })), h("defs", { key: '51e7ef185399e3a10d0b19eb399500be3e5384f8' }, h("filter", { key: '09f52cd1b7084a8af9488bbce05c277fe07012f9', id: "wm_star_shadow", x: "0", y: "0", width: "77.4844", height: "79.4841", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB" }, h("feFlood", { key: '1b055616d714f824dd38a895a5c1a635fefc4a66', "flood-opacity": "0", result: "BackgroundImageFix" }), h("feBlend", { key: '044cba9d32d0a1d56fc39d318dfc1cdd0fdc0ae7', mode: "normal", in: "SourceGraphic", in2: "BackgroundImageFix", result: "shape" }), h("feColorMatrix", { key: '4bf50b36bd6b1ae90d29a95290762ef52dbfff7a', in: "SourceAlpha", type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0", result: "hardAlpha" }), h("feOffset", { key: '0988514af2fda03cb2ff43e95c1423137351186f', dy: "2" }), h("feGaussianBlur", { key: 'c96fb451b890e9bda84043dcd699c2a3f59c195c', stdDeviation: "2" }), h("feComposite", { key: '77b2bb3e01eefb08cac5f60a494c2cd15e97db4a', in2: "hardAlpha", operator: "arithmetic", k2: "-1", k3: "1" }), h("feColorMatrix", { key: 'aef785066c732cc5cbc16689f2e57a7df7d18bc5', type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0" }), h("feBlend", { key: '292a1d370d268312514f1c8fcee2167159c2d4e9', mode: "normal", in2: "shape", result: "effect1_innerShadow" })))))), h("slot", { key: '009fd561884a5a70e559d865dc1b1d55937d923c', name: "header" }), h("div", { key: 'fde5090720cd70c2b5fe72bcaec95007e7792f4e', class: "messages-area", ref: el => (this.messagesAreaRef = el) }, this.loading ? this.renderSkeleton() : this.error ? this.renderError() : h("slot", null)), h("slot", { key: '838ea2de9f788af2af70568a7882a08645c6b2ac', name: "footer" }))));
228
+ return (h(Host, { key: '1213110dce6a44b37c4a7b1f6a584368951964d2', class: { dark: this.isDark() } }, h("div", { key: 'df0df824b4ef271aae37dee7aa2fc85037ef647a', class: this.getContainerClasses(), style: this.getContainerStyle(), ref: el => (this.containerRef = el) }, this.showWatermark && !this.loading && !this.error && (h("div", { key: '168fd1510d8910f234331c03d4d549d0a9586472', class: "watermark" }, h("svg", { key: 'fde35527192a8501b190462bfdf66ae7d739742c', class: "watermark-circle-svg", width: "133", height: "133", viewBox: "0 0 133 133", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("g", { key: '63c94c35e3adafac862c39cda04d05d75199bae0', filter: "url(#wm_circle_shadow)" }, h("circle", { key: '8e8e304ae2132ad36855457a7755b2ba20770038', cx: "66.415", cy: "66.415", r: "66.415", class: "watermark-circle" })), h("defs", { key: 'c571edd0fb6a68bf9e62530398ba01e482f5755e' }, h("filter", { key: 'c63ab4c6c16db9eac63d944c481564af4667f493', id: "wm_circle_shadow", x: "0", y: "0", width: "132.83", height: "135.83", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB" }, h("feFlood", { key: '37105253941532ffc3136713df67e87b9ef123e5', "flood-opacity": "0", result: "BackgroundImageFix" }), h("feBlend", { key: 'ecde8a14cbc2a11125e548ebe412f00381aa561e', mode: "normal", in: "SourceGraphic", in2: "BackgroundImageFix", result: "shape" }), h("feColorMatrix", { key: '1001d9bf46d7df0f8788e46cfb311a90b5984f8d', in: "SourceAlpha", type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0", result: "hardAlpha" }), h("feOffset", { key: '4ffa296814b3eeb49e56688f1d6a981ac7055a92', dy: "3" }), h("feGaussianBlur", { key: '91a6bf8600f4b30c24af6717d61a7549584240f7', stdDeviation: "3" }), h("feComposite", { key: '325b8156a7a3cc8dfa1855d687436d170dc83bbb', in2: "hardAlpha", operator: "arithmetic", k2: "-1", k3: "1" }), h("feColorMatrix", { key: '48da64c927a7c97e21b499576cc8a421445ffd61', type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0" }), h("feBlend", { key: '2c3fcf67f6769a6e6cee16ee4f7a6115a2aa3fbc', mode: "normal", in2: "shape", result: "effect1_innerShadow" })))), h("svg", { key: '25669b41c62a83760adb26129d4547ece7d5f6d9', class: "watermark-star-svg", width: "78", height: "78", viewBox: "0 0 78 78", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("g", { key: 'e1347f63fe1b5b57c1be6d4958817c2682745972', filter: "url(#wm_star_shadow)" }, h("path", { key: '12ca3bbc4dcca07dbd4cc9e5b0227c2a4b5eeb98', d: "M38.7421 0C39.5691 0 40.2689 0.286272 40.8414 0.858815C41.414 1.43136 41.7002 2.13113 41.7002 2.95814C41.7002 8.87442 43.1952 14.3772 46.1851 19.4665C49.1115 24.4285 53.0557 28.3727 58.0177 31.299C63.107 34.289 68.6097 35.7839 74.526 35.7839C75.353 35.7839 76.0528 36.0702 76.6254 36.6428C77.1979 37.2153 77.4842 37.9151 77.4842 38.7421C77.4842 39.5691 77.1979 40.2689 76.6254 40.8414C76.0528 41.414 75.353 41.7002 74.526 41.7002C68.6097 41.7002 63.107 43.1952 58.0177 46.1851C53.0557 49.1115 49.1115 53.0557 46.1851 58.0177C43.1952 63.107 41.7002 68.6097 41.7002 74.526C41.7002 75.353 41.414 76.0528 40.8414 76.6254C40.2689 77.1979 39.5691 77.4842 38.7421 77.4842C37.9151 77.4842 37.2153 77.1979 36.6428 76.6254C36.0702 76.0528 35.7839 75.353 35.7839 74.526C35.7839 68.6097 34.289 63.107 31.299 58.0177C28.3727 53.0557 24.4285 49.1115 19.4665 46.1851C14.3772 43.1952 8.87442 41.7002 2.95814 41.7002C2.13113 41.7002 1.43136 41.414 0.858815 40.8414C0.286272 40.2689 0 39.5691 0 38.7421C0 37.9151 0.286272 37.2153 0.858815 36.6428C1.43136 36.0702 2.13113 35.7839 2.95814 35.7839C8.87442 35.7839 14.3772 34.289 19.4665 31.299C24.4285 28.3727 28.3727 24.4285 31.299 19.4665C34.289 14.3772 35.7839 8.87442 35.7839 2.95814C35.7839 2.13113 36.0702 1.43136 36.6428 0.858815C37.2153 0.286272 37.9151 0 38.7421 0Z", class: "watermark-star" })), h("defs", { key: '6118bbae343ffc6cdc52df3d2062b63dd655f96d' }, h("filter", { key: 'ac762ad5983155b7122e4e1466dcaa9230d2ad4f', id: "wm_star_shadow", x: "0", y: "0", width: "77.4844", height: "79.4841", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB" }, h("feFlood", { key: '452561901594c49f607f2a5a0dd149edab297703', "flood-opacity": "0", result: "BackgroundImageFix" }), h("feBlend", { key: 'bd77b4ec605953eff1b83d63b152f6bc0cf757f9', mode: "normal", in: "SourceGraphic", in2: "BackgroundImageFix", result: "shape" }), h("feColorMatrix", { key: '55215acb177fe0a8d7bf454244d1eec0a52657d9', in: "SourceAlpha", type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0", result: "hardAlpha" }), h("feOffset", { key: '2079610df4ddb703dffdb0ba26a83262b28ddb8e', dy: "2" }), h("feGaussianBlur", { key: 'b42acf138ed8ed2c51ce3a51eb774f8ccb3932a5', stdDeviation: "2" }), h("feComposite", { key: '6b2439a1f50c1355851333431d1745d864fd4a68', in2: "hardAlpha", operator: "arithmetic", k2: "-1", k3: "1" }), h("feColorMatrix", { key: 'da9900a125e3e0df5f3bb383382b949d0c967d9c', type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0" }), h("feBlend", { key: '579851be42d902cbd9939df09ba996b11210181f', mode: "normal", in2: "shape", result: "effect1_innerShadow" })))))), h("slot", { key: 'e2ef3a4097ff512ac2e9638fef4725b55cd4ea24', name: "header" }), h("div", { key: '46dac73e46b2eac797c88ed826497e4d6063f2d3', class: "messages-area", ref: el => (this.messagesAreaRef = el) }, this.loading ? this.renderSkeleton() : this.error ? this.renderError() : h("slot", null)), h("slot", { key: 'ff2cf3628bbab90bd0cdce07df6c08ae597867ba', name: "footer" }))));
229
229
  }
230
230
  static get is() { return "ai-chat-container"; }
231
231
  static get encapsulation() { return "shadow"; }
@@ -38,11 +38,18 @@ export class AiChatHeader {
38
38
  conversationDeletingId = '';
39
39
  /** Show a shimmer skeleton in place of the conversation title (e.g. while loading conversation) */
40
40
  titleLoading = false;
41
+ /** Hide the new-chat (pencil-edit) button */
42
+ disableNewChat = false;
43
+ /** Hide the conversation-list dropdown trigger (title chevron) */
44
+ disableConversationList = false;
41
45
  avatarError = false;
42
46
  dropdownOpen = false;
43
47
  /** Internally managed — true when the parent ai-chat-container has position="float" */
44
48
  isFloating = false;
49
+ /** Internally managed — true when viewport width < 768px (matches ai-chat-container logic) */
50
+ isMobile = false;
45
51
  parentPositionObserver = null;
52
+ handleWindowResize = () => this.checkMobile();
46
53
  /** Cancel / close button */
47
54
  closeClick;
48
55
  /** Pencil-edit button (agent mode) */
@@ -77,7 +84,7 @@ export class AiChatHeader {
77
84
  }
78
85
  }
79
86
  connectedCallback() {
80
- // Initial sync will happen in componentDidLoad
87
+ this.checkMobile();
81
88
  }
82
89
  componentDidLoad() {
83
90
  // By this point, the element is fully in the DOM and parent relationships are established
@@ -86,10 +93,21 @@ export class AiChatHeader {
86
93
  this.syncFloatingState();
87
94
  this.observeParentPosition();
88
95
  });
96
+ if (typeof window !== 'undefined') {
97
+ window.addEventListener('resize', this.handleWindowResize);
98
+ }
89
99
  }
90
100
  disconnectedCallback() {
91
101
  this.parentPositionObserver?.disconnect();
92
102
  this.parentPositionObserver = null;
103
+ if (typeof window !== 'undefined') {
104
+ window.removeEventListener('resize', this.handleWindowResize);
105
+ }
106
+ }
107
+ checkMobile() {
108
+ if (typeof window !== 'undefined') {
109
+ this.isMobile = window.innerWidth < 768;
110
+ }
93
111
  }
94
112
  observeParentPosition() {
95
113
  if (this.parentPositionObserver)
@@ -130,7 +148,7 @@ export class AiChatHeader {
130
148
  } }));
131
149
  }
132
150
  renderDragBtn() {
133
- return (this.isFloating && (h("button", { class: "action-btn drag-btn", "aria-label": "\u0633\u062D\u0628 / Drag", onPointerDown: (e) => {
151
+ return (this.isFloating && !this.isMobile && (h("button", { class: "action-btn drag-btn", "aria-label": "\u0633\u062D\u0628 / Drag", onPointerDown: (e) => {
134
152
  e.preventDefault();
135
153
  this.headerDragStart.emit({ clientX: e.clientX, clientY: e.clientY });
136
154
  } }, this.renderIcon('drag', 11, 15))));
@@ -149,38 +167,39 @@ export class AiChatHeader {
149
167
  this.conversationRetry.emit();
150
168
  };
151
169
  renderConversationDropdown() {
152
- if (!this.dropdownOpen || this.mode !== 'agent')
170
+ if (!this.dropdownOpen || this.mode !== 'agent' || this.disableConversationList)
153
171
  return null;
154
172
  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
173
  }
156
174
  renderAgentMode() {
175
+ const titleContent = this.disableConversationList ? (h("div", { class: "content agent" }, this.titleLoading ? (h("span", { class: "title-skeleton", "aria-busy": "true", "aria-label": "\u062C\u0627\u0631\u064A \u0627\u0644\u062A\u062D\u0645\u064A\u0644" })) : (h("span", { class: "title" }, this.conversation)))) : (h("div", { class: "content agent dropdown-trigger", role: "button", onClick: () => {
176
+ if (this.titleLoading)
177
+ return;
178
+ this.dropdownOpen = !this.dropdownOpen;
179
+ this.dropdownClick.emit();
180
+ }, "aria-haspopup": "listbox", "aria-expanded": this.dropdownOpen, "aria-label": `${this.conversation}, افتح قائمة المحادثات` }, this.titleLoading ? (h("span", { class: "title-skeleton", "aria-busy": "true", "aria-label": "\u062C\u0627\u0631\u064A \u0627\u0644\u062A\u062D\u0645\u064A\u0644" })) : (h("span", { class: "title" }, this.conversation)), !this.titleLoading && (h("span", { class: `dropdown-chevron${this.dropdownOpen ? ' open' : ''}` }, this.renderIcon('chevron-down', 24, 24)))));
157
181
  return [
158
182
  this.renderDragBtn(),
159
- h("div", { class: "content agent dropdown-trigger", role: "button", onClick: () => {
160
- if (this.titleLoading)
161
- return;
162
- this.dropdownOpen = !this.dropdownOpen;
163
- this.dropdownClick.emit();
164
- }, "aria-haspopup": "listbox", "aria-expanded": this.dropdownOpen, "aria-label": `${this.conversation}, افتح قائمة المحادثات` }, this.titleLoading ? (h("span", { class: "title-skeleton", "aria-busy": "true", "aria-label": "\u062C\u0627\u0631\u064A \u0627\u0644\u062A\u062D\u0645\u064A\u0644" })) : (h("span", { class: "title" }, this.conversation)), !this.titleLoading && (h("span", { class: `dropdown-chevron${this.dropdownOpen ? ' open' : ''}` }, this.renderIcon('chevron-down', 24, 24)))),
165
- h("div", { class: "actions" }, h("button", { class: "action-btn", "aria-label": "\u0645\u062D\u0627\u062F\u062B\u0629 \u062C\u062F\u064A\u062F\u0629 / New Chat", onClick: () => this.newChatClick.emit() }, this.renderIcon('pencil-edit', 22, 22)), h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => { this.positionClick.emit(); this.headerPositionClick.emit(); } }, this.renderIcon('hand', 22, 22)), h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
183
+ titleContent,
184
+ h("div", { class: "actions" }, !this.disableNewChat && (h("button", { class: "action-btn", "aria-label": "\u0645\u062D\u0627\u062F\u062B\u0629 \u062C\u062F\u064A\u062F\u0629 / New Chat", onClick: () => this.newChatClick.emit() }, this.renderIcon('pencil-edit', 22, 22))), !this.isMobile && (h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => { this.positionClick.emit(); this.headerPositionClick.emit(); } }, this.renderIcon('hand', 22, 22))), h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
166
185
  ];
167
186
  }
168
187
  renderHumanMode() {
169
188
  return [
170
189
  this.renderDragBtn(),
171
190
  h("div", { class: "content human" }, this.showBack && (h("button", { class: "back-btn", "aria-label": "\u0631\u062C\u0648\u0639 / Back", onClick: () => this.backClick.emit() }, this.renderIcon('arrow-right', 24, 24))), h("div", { class: "avatar-wrapper" }, this.renderAvatar(), h("span", { class: `online-dot status-${this.statusIndicator}` }, this.renderIcon('online-dot', 10, 10))), h("div", { class: "text-block" }, h("span", { class: "agent-name" }, this.agentName), this.agentStatus && h("span", { class: "agent-status" }, this.agentStatus))),
172
- h("div", { class: "actions" }, h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => { this.positionClick.emit(); this.headerPositionClick.emit(); } }, this.renderIcon('hand', 22, 22)), h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
191
+ h("div", { class: "actions" }, !this.isMobile && (h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => { this.positionClick.emit(); this.headerPositionClick.emit(); } }, this.renderIcon('hand', 22, 22))), h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
173
192
  ];
174
193
  }
175
194
  renderBrowserMode() {
176
195
  return [
177
196
  this.renderDragBtn(),
178
197
  h("div", { class: "content browser" }, h("button", { class: "back-btn", "aria-label": "\u0631\u062C\u0648\u0639 / Back", onClick: () => this.backClick.emit() }, this.renderIcon('arrow-right', 24, 24)), h("span", { class: "browser-title" }, this.pageTitle), h("button", { class: "browser-link-btn", "aria-label": "\u0641\u062A\u062D \u0641\u064A \u0646\u0627\u0641\u0630\u0629 \u062C\u062F\u064A\u062F\u0629 / Open externally", onClick: () => this.openExternal.emit(this.pageUrl) }, this.renderIcon('link', 14, 14))),
179
- h("div", { class: "actions" }, h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => { this.positionClick.emit(); this.headerPositionClick.emit(); } }, this.renderIcon('hand', 22, 22)), h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
198
+ h("div", { class: "actions" }, !this.isMobile && (h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => { this.positionClick.emit(); this.headerPositionClick.emit(); } }, this.renderIcon('hand', 22, 22))), h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
180
199
  ];
181
200
  }
182
201
  render() {
183
- return (h(Host, { key: '80236bfcbfac98d3efa3955f03aab4ef68c9cfea' }, h("div", { key: 'dcc4142bba1d5f07782dbc7b0a3ec287e0154223', class: "header-wrapper" }, h("div", { key: 'ca0ff9a2946cead0b86cb82390624894ed414378', class: "header-container" }, this.mode === 'agent' ? this.renderAgentMode() : this.mode === 'human' ? this.renderHumanMode() : this.renderBrowserMode()), this.renderConversationDropdown())));
202
+ return (h(Host, { key: '4c51abf7f5fb572ec62191c0b097a4fdf9b218c3' }, h("div", { key: 'c05febe2f984bad8e80b9f0d9f2ceeebc812a9b4', class: "header-wrapper" }, h("div", { key: '927c606ae5452a9a5c1e19edd2145f9e1ee42d2c', class: "header-container" }, this.mode === 'agent' ? this.renderAgentMode() : this.mode === 'human' ? this.renderHumanMode() : this.renderBrowserMode()), this.renderConversationDropdown())));
184
203
  }
185
204
  static get is() { return "ai-chat-header"; }
186
205
  static get encapsulation() { return "shadow"; }
@@ -560,6 +579,46 @@ export class AiChatHeader {
560
579
  "reflect": false,
561
580
  "attribute": "title-loading",
562
581
  "defaultValue": "false"
582
+ },
583
+ "disableNewChat": {
584
+ "type": "boolean",
585
+ "mutable": false,
586
+ "complexType": {
587
+ "original": "boolean",
588
+ "resolved": "boolean",
589
+ "references": {}
590
+ },
591
+ "required": false,
592
+ "optional": false,
593
+ "docs": {
594
+ "tags": [],
595
+ "text": "Hide the new-chat (pencil-edit) button"
596
+ },
597
+ "getter": false,
598
+ "setter": false,
599
+ "reflect": false,
600
+ "attribute": "disable-new-chat",
601
+ "defaultValue": "false"
602
+ },
603
+ "disableConversationList": {
604
+ "type": "boolean",
605
+ "mutable": false,
606
+ "complexType": {
607
+ "original": "boolean",
608
+ "resolved": "boolean",
609
+ "references": {}
610
+ },
611
+ "required": false,
612
+ "optional": false,
613
+ "docs": {
614
+ "tags": [],
615
+ "text": "Hide the conversation-list dropdown trigger (title chevron)"
616
+ },
617
+ "getter": false,
618
+ "setter": false,
619
+ "reflect": false,
620
+ "attribute": "disable-conversation-list",
621
+ "defaultValue": "false"
563
622
  }
564
623
  };
565
624
  }
@@ -567,7 +626,8 @@ export class AiChatHeader {
567
626
  return {
568
627
  "avatarError": {},
569
628
  "dropdownOpen": {},
570
- "isFloating": {}
629
+ "isFloating": {},
630
+ "isMobile": {}
571
631
  };
572
632
  }
573
633
  static get events() {
@@ -1 +1 @@
1
- import{p as e,H as t,c as a,h as r,d as i,t as o}from"./p-BPkf7wZg.js";const s=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.retryClick=a(this,"retryClick"),this.positionChange=a(this,"positionChange")}get el(){return this}isOpen=!1;position="left";width="28rem";autoScroll=!0;showWatermark=!1;floatHeight="600px";theme="light";loading=!1;error=!1;errorText="تعذّر تحميل المحادثة";retryLabel="إعادة المحاولة";direction="rtl";retryClick;positionChange;isMobile=!1;floatLeft="24px";floatTop="24px";containerRef;messagesAreaRef;dragState=null;mutationObserver=null;resizeObserver=null;dragListener=e=>{if("undefined"==typeof window)return;const t=this.containerRef;if(!t)return;const{clientX:a,clientY:r}=e.detail,i=t.getBoundingClientRect();this.dragState={startX:a,startY:r,initLeft:i.left,initTop:i.top},this.floatLeft=i.left+"px",this.floatTop=i.top+"px";const o=e=>{if(!this.dragState)return;let a=this.dragState.initLeft+(e.clientX-this.dragState.startX),r=this.dragState.initTop+(e.clientY-this.dragState.startY);const i=window.innerWidth,o=window.innerHeight,s=t.offsetHeight;a=Math.max(0,Math.min(a,i-t.offsetWidth)),r=Math.max(0,Math.min(r,o-s)),this.floatLeft=a+"px",this.floatTop=r+"px"},s=()=>{this.dragState=null,document.removeEventListener("pointermove",o),document.removeEventListener("pointerup",s)};document.addEventListener("pointermove",o),document.addEventListener("pointerup",s)};handleHeaderPositionClick(){this.cyclePosition()}componentWillLoad(){this.checkMobile()}componentDidLoad(){"undefined"!=typeof window&&("undefined"!=typeof ResizeObserver&&(this.resizeObserver=new ResizeObserver((()=>{this.checkMobile(),this.clampFloatPosition()})),this.resizeObserver.observe(this.el)),window.addEventListener("resize",this.handleWindowResize),"float"===this.position&&this.setupDrag(),this.mutationObserver=new MutationObserver((()=>{this.autoScroll&&this.messagesAreaRef&&requestAnimationFrame((()=>{this.messagesAreaRef.scrollTop=this.messagesAreaRef.scrollHeight}))})),this.mutationObserver.observe(this.el,{childList:!0,subtree:!0}))}isOpenChanged(e){e&&this.autoScroll&&this.messagesAreaRef&&requestAnimationFrame((()=>{this.messagesAreaRef.scrollTop=this.messagesAreaRef.scrollHeight}))}positionChanged(e){"float"===e&&this.setupDrag()}disconnectedCallback(){"undefined"!=typeof window&&window.removeEventListener("resize",this.handleWindowResize),this.el.removeEventListener("headerDragStart",this.dragListener),this.mutationObserver?.disconnect(),this.resizeObserver?.disconnect()}async scrollToBottom(){this.messagesAreaRef&&(this.messagesAreaRef.scrollTop=this.messagesAreaRef.scrollHeight)}async cyclePosition(){this.position="float"===this.position?"rtl"===this.direction?"left":"right":"float",this.positionChange.emit(this.position)}handleWindowResize=()=>{this.checkMobile(),this.clampFloatPosition()};checkMobile(){"undefined"!=typeof window&&(this.isMobile=window.innerWidth<768)}clampFloatPosition(){if("undefined"==typeof window||"float"!==this.position||!this.containerRef)return;const e=window.innerWidth,t=window.innerHeight,a=this.containerRef.offsetWidth,r=this.containerRef.offsetHeight;let i=parseFloat(this.floatLeft)||0,o=parseFloat(this.floatTop)||0;i=Math.max(0,Math.min(i,e-a)),o=Math.max(0,Math.min(o,t-r)),this.floatLeft=i+"px",this.floatTop=o+"px"}setupDrag(){this.el.removeEventListener("headerDragStart",this.dragListener),this.el.addEventListener("headerDragStart",this.dragListener)}getContainerClasses(){const e=["chat-container",this.position];return this.isOpen&&e.push("open"),this.isMobile&&e.push("mobile"),e.join(" ")}getContainerStyle(){const e={};return this.isMobile||("float"===this.position?(e.width=this.width,e.height=this.floatHeight,e.left=this.floatLeft,e.top=this.floatTop):e.width=this.width),e}isDark(){return"dark"===this.theme||"auto"===this.theme&&"undefined"!=typeof window&&window.matchMedia("(prefers-color-scheme: dark)").matches}renderSkeleton(){return r("div",{class:"skeleton-messages","aria-busy":"true","aria-label":"Loading conversation"},r("div",{class:"skeleton-row agent"},r("div",{class:"skeleton-bubble"},r("div",{class:"skeleton-line",style:{width:"80%"}}),r("div",{class:"skeleton-line",style:{width:"60%"}}),r("div",{class:"skeleton-line",style:{width:"40%"}}))),r("div",{class:"skeleton-row user"},r("div",{class:"skeleton-bubble"},r("div",{class:"skeleton-line",style:{width:"70%"}}))),r("div",{class:"skeleton-row agent"},r("div",{class:"skeleton-bubble"},r("div",{class:"skeleton-line",style:{width:"90%"}}),r("div",{class:"skeleton-line",style:{width:"55%"}}))),r("div",{class:"skeleton-row user"},r("div",{class:"skeleton-bubble"},r("div",{class:"skeleton-line",style:{width:"50%"}}),r("div",{class:"skeleton-line",style:{width:"35%"}}))))}renderError(){return r("div",{class:"error-state",role:"alert"},r("svg",{class:"error-icon",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"1.5"}),r("path",{d:"M12 7v6",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"}),r("circle",{cx:"12",cy:"16.5",r:"0.75",fill:"currentColor"})),r("p",{class:"error-text"},this.errorText),r("button",{class:"error-retry-btn",type:"button",onClick:()=>this.retryClick.emit()},this.retryLabel))}render(){return r(i,{key:"6290736307488f10a4ed441e2a8e0b3a2e89af05",class:{dark:this.isDark()}},r("div",{key:"6d6a731d9941457b786c71625243a7dd1e9f11f8",class:this.getContainerClasses(),style:this.getContainerStyle(),ref:e=>this.containerRef=e},this.showWatermark&&!this.loading&&!this.error&&r("div",{key:"0c2ae5b52f8c30bdf356a3c356d52305451cb19e",class:"watermark"},r("svg",{key:"36076d8dd514f5736050228d22b9a03d5d48ce28",class:"watermark-circle-svg",width:"133",height:"133",viewBox:"0 0 133 133",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r("g",{key:"737a3f3d8b7a0f91120258c292d047f9dc90871c",filter:"url(#wm_circle_shadow)"},r("circle",{key:"a59549c879ddaa2a0007c4fd9645c4382b14e73f",cx:"66.415",cy:"66.415",r:"66.415",class:"watermark-circle"})),r("defs",{key:"58d5edc4e05f3dd8a60f7a829b70f154ba85bfc1"},r("filter",{key:"d2cb7cb5a84bdf1496b56ec5a0c0c79001040670",id:"wm_circle_shadow",x:"0",y:"0",width:"132.83",height:"135.83",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},r("feFlood",{key:"e90404f557fba552a21bd3748ad728470172040f","flood-opacity":"0",result:"BackgroundImageFix"}),r("feBlend",{key:"ef5aee167a4973c35f8ffaa8ae4a0487de8266ee",mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feColorMatrix",{key:"e0869202bc43610b91abce92e85e8e5264cda999",in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),r("feOffset",{key:"7bef38d885b93711fce4c0efbb719a83417eeefb",dy:"3"}),r("feGaussianBlur",{key:"053de38388f049be8db7867b99b53d403de934ca",stdDeviation:"3"}),r("feComposite",{key:"e5f68fbcf0923174a177545bf3364d066a122347",in2:"hardAlpha",operator:"arithmetic",k2:"-1",k3:"1"}),r("feColorMatrix",{key:"62dc924cbdc92ce4adc0ec81be851c1d40e7a5b0",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0"}),r("feBlend",{key:"908299725f9e553c636bd18eab6541c6a7c69fe5",mode:"normal",in2:"shape",result:"effect1_innerShadow"})))),r("svg",{key:"2a6ce2364bfd667c4eba56d859a1326f70a82901",class:"watermark-star-svg",width:"78",height:"78",viewBox:"0 0 78 78",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r("g",{key:"e2c431ac6bee320c817a7283e6e356edc4667146",filter:"url(#wm_star_shadow)"},r("path",{key:"d87d0313e649527f5909ac1b08f7af2979760d79",d:"M38.7421 0C39.5691 0 40.2689 0.286272 40.8414 0.858815C41.414 1.43136 41.7002 2.13113 41.7002 2.95814C41.7002 8.87442 43.1952 14.3772 46.1851 19.4665C49.1115 24.4285 53.0557 28.3727 58.0177 31.299C63.107 34.289 68.6097 35.7839 74.526 35.7839C75.353 35.7839 76.0528 36.0702 76.6254 36.6428C77.1979 37.2153 77.4842 37.9151 77.4842 38.7421C77.4842 39.5691 77.1979 40.2689 76.6254 40.8414C76.0528 41.414 75.353 41.7002 74.526 41.7002C68.6097 41.7002 63.107 43.1952 58.0177 46.1851C53.0557 49.1115 49.1115 53.0557 46.1851 58.0177C43.1952 63.107 41.7002 68.6097 41.7002 74.526C41.7002 75.353 41.414 76.0528 40.8414 76.6254C40.2689 77.1979 39.5691 77.4842 38.7421 77.4842C37.9151 77.4842 37.2153 77.1979 36.6428 76.6254C36.0702 76.0528 35.7839 75.353 35.7839 74.526C35.7839 68.6097 34.289 63.107 31.299 58.0177C28.3727 53.0557 24.4285 49.1115 19.4665 46.1851C14.3772 43.1952 8.87442 41.7002 2.95814 41.7002C2.13113 41.7002 1.43136 41.414 0.858815 40.8414C0.286272 40.2689 0 39.5691 0 38.7421C0 37.9151 0.286272 37.2153 0.858815 36.6428C1.43136 36.0702 2.13113 35.7839 2.95814 35.7839C8.87442 35.7839 14.3772 34.289 19.4665 31.299C24.4285 28.3727 28.3727 24.4285 31.299 19.4665C34.289 14.3772 35.7839 8.87442 35.7839 2.95814C35.7839 2.13113 36.0702 1.43136 36.6428 0.858815C37.2153 0.286272 37.9151 0 38.7421 0Z",class:"watermark-star"})),r("defs",{key:"51e7ef185399e3a10d0b19eb399500be3e5384f8"},r("filter",{key:"09f52cd1b7084a8af9488bbce05c277fe07012f9",id:"wm_star_shadow",x:"0",y:"0",width:"77.4844",height:"79.4841",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},r("feFlood",{key:"1b055616d714f824dd38a895a5c1a635fefc4a66","flood-opacity":"0",result:"BackgroundImageFix"}),r("feBlend",{key:"044cba9d32d0a1d56fc39d318dfc1cdd0fdc0ae7",mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feColorMatrix",{key:"4bf50b36bd6b1ae90d29a95290762ef52dbfff7a",in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),r("feOffset",{key:"0988514af2fda03cb2ff43e95c1423137351186f",dy:"2"}),r("feGaussianBlur",{key:"c96fb451b890e9bda84043dcd699c2a3f59c195c",stdDeviation:"2"}),r("feComposite",{key:"77b2bb3e01eefb08cac5f60a494c2cd15e97db4a",in2:"hardAlpha",operator:"arithmetic",k2:"-1",k3:"1"}),r("feColorMatrix",{key:"aef785066c732cc5cbc16689f2e57a7df7d18bc5",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0"}),r("feBlend",{key:"292a1d370d268312514f1c8fcee2167159c2d4e9",mode:"normal",in2:"shape",result:"effect1_innerShadow"}))))),r("slot",{key:"009fd561884a5a70e559d865dc1b1d55937d923c",name:"header"}),r("div",{key:"fde5090720cd70c2b5fe72bcaec95007e7792f4e",class:"messages-area",ref:e=>this.messagesAreaRef=e},this.loading?this.renderSkeleton():this.error?this.renderError():r("slot",null)),r("slot",{key:"838ea2de9f788af2af70568a7882a08645c6b2ac",name:"footer"})))}static get watchers(){return{isOpen:[{isOpenChanged:0}],position:[{positionChanged:0}]}}static get style(){return":host{display:contents}.chat-container{font-family:var(--ai-font-family);display:flex;flex-direction:column;overflow:hidden;position:relative;background-color:var(--ai-container-bg, var(--ai-bg-card));border:1px solid var(--ai-border-default);z-index:50;box-sizing:border-box}.messages-area{flex:1;overflow-y:auto;min-height:0;scrollbar-width:thin;padding:var(--ai-spacing-2xl, 16px);scrollbar-color:var(--ai-scrollbar-thumb) transparent}.messages-area::-webkit-scrollbar{width:3px}.messages-area::-webkit-scrollbar-track{background:transparent}.messages-area::-webkit-scrollbar-thumb{background:var(--ai-scrollbar-thumb);border-radius:99px}.messages-area::-webkit-scrollbar-thumb:hover{background:var(--ai-scrollbar-thumb-hover)}.chat-container.left,.chat-container.right{position:fixed;top:0;bottom:0;transition:transform 300ms cubic-bezier(0.4, 0, 0.2, 1)}.chat-container.left{left:0;transform:translateX(-100%)}.chat-container.right{right:0;transform:translateX(100%)}.chat-container.left.open,.chat-container.right.open{transform:translateX(0)}.chat-container.float{position:fixed;border-radius:16px;box-shadow:var(--ai-shadow-float);opacity:0;pointer-events:none;transform:scale(0.95);transform-origin:bottom left;transition:opacity 200ms ease, transform 200ms ease}.chat-container.float.open{opacity:1;pointer-events:auto;transform:scale(1)}.watermark{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);pointer-events:none;width:133px;height:133px}.watermark .watermark-circle-svg{position:absolute;top:0;left:0}.watermark .watermark-star-svg{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}.watermark .watermark-circle{fill:var(--ai-watermark-circle, #FCFCFC)}.watermark .watermark-star{fill:var(--ai-watermark-star, #FAFAFA)}:host(.dark) .watermark .watermark-circle{fill:var(--ai-watermark-circle, #222222)}:host(.dark) .watermark .watermark-star{fill:var(--ai-watermark-star, #292B2C)}.chat-container.mobile{width:100% !important}.chat-container.float.mobile{left:0 !important;right:0 !important;top:0 !important;bottom:0 !important;height:100% !important;border-radius:0 !important}@media (max-width: 767px){.chat-container{width:100% !important}.chat-container.float{left:0 !important;right:0 !important;top:0 !important;bottom:0 !important;height:100% !important;border-radius:0 !important}}@keyframes skeleton-shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}.skeleton-messages{display:flex;flex-direction:column;gap:20px;padding:8px 0}.skeleton-row{display:flex;align-items:flex-start;gap:10px}.skeleton-row.agent{flex-direction:row}.skeleton-row.user{flex-direction:row-reverse}.skeleton-avatar{width:32px;height:32px;min-width:32px;border-radius:50%;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:skeleton-shimmer 1.6s ease-in-out infinite}.skeleton-bubble{display:flex;flex-direction:column;gap:8px;padding:14px 16px;border-radius:16px;background-color:var(--ai-bg-surface, #f9fafb);max-width:75%;min-width:120px}.skeleton-row.user .skeleton-bubble{background-color:var(--ai-user-bubble-bg, var(--ai-accent, #004956));border-radius:16px}.skeleton-line{height:12px;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:skeleton-shimmer 1.6s ease-in-out infinite}.skeleton-row.user .skeleton-line{background:linear-gradient(90deg, rgba(255,255,255,0.08) 25%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.08) 75%);background-size:200% 100%;animation:skeleton-shimmer 1.6s ease-in-out infinite}:host(.dark) .skeleton-avatar{background:var(--ai-shimmer-gradient, linear-gradient(90deg, rgba(255,255,255,0.06) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.06) 75%));background-size:200% 100%;animation:skeleton-shimmer 1.6s ease-in-out infinite}:host(.dark) .skeleton-bubble{background-color:var(--ai-bg-surface, #1f2937)}:host(.dark) .skeleton-line{background:var(--ai-shimmer-gradient, linear-gradient(90deg, rgba(255,255,255,0.06) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.06) 75%));background-size:200% 100%;animation:skeleton-shimmer 1.6s ease-in-out infinite}.error-state{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:12px;padding:48px 24px;flex:1}.error-icon{color:var(--ai-text-muted, #9ca3af);opacity:0.7}.error-text{margin:0;font-size:14px;line-height:1.5;color:var(--ai-text-secondary, #6b7280)}.error-retry-btn{display:inline-flex;align-items:center;justify-content:center;padding:8px 20px;border-radius:9999px;border:1px solid var(--ai-border-default);background-color:var(--ai-bg-surface, #f9fafb);color:var(--ai-text-primary);font-size:13px;font-weight:500;font-family:inherit;cursor:pointer;transition:background-color 0.15s ease, border-color 0.15s ease}.error-retry-btn:hover{background-color:var(--ai-hover-overlay, rgba(0, 0, 0, 0.04));border-color:var(--ai-accent, #004956)}.error-retry-btn:focus-visible{outline:2px solid var(--ai-focus-ring-color, var(--ai-focus-ring));outline-offset:2px}:host(.dark) .error-retry-btn{background-color:var(--ai-bg-surface, #1f2937);color:var(--ai-text-primary, #f9fafb)}:host(.dark) .error-retry-btn:hover{background-color:var(--ai-hover-overlay, rgba(255, 255, 255, 0.06))}"}},[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}]}]),n=s,l=function(){"undefined"!=typeof customElements&&["ai-chat-container"].forEach((e=>{"ai-chat-container"===e&&(customElements.get(o(e))||customElements.define(o(e),s))}))};export{n as AiChatContainer,l as defineCustomElement}
1
+ import{p as e,H as t,c as a,h as r,d as i,t as o}from"./p-BPkf7wZg.js";const s=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.retryClick=a(this,"retryClick"),this.positionChange=a(this,"positionChange")}get el(){return this}isOpen=!1;position="left";width="28rem";autoScroll=!0;showWatermark=!1;floatHeight="600px";theme="light";loading=!1;error=!1;errorText="تعذّر تحميل المحادثة";retryLabel="إعادة المحاولة";direction="rtl";retryClick;positionChange;isMobile=!1;floatLeft="24px";floatTop="24px";containerRef;messagesAreaRef;dragState=null;mutationObserver=null;resizeObserver=null;dragListener=e=>{if("undefined"==typeof window)return;const t=this.containerRef;if(!t)return;const{clientX:a,clientY:r}=e.detail,i=t.getBoundingClientRect();this.dragState={startX:a,startY:r,initLeft:i.left,initTop:i.top},this.floatLeft=i.left+"px",this.floatTop=i.top+"px";const o=e=>{if(!this.dragState)return;let a=this.dragState.initLeft+(e.clientX-this.dragState.startX),r=this.dragState.initTop+(e.clientY-this.dragState.startY);const i=window.innerWidth,o=window.innerHeight,s=t.offsetHeight;a=Math.max(0,Math.min(a,i-t.offsetWidth)),r=Math.max(0,Math.min(r,o-s)),this.floatLeft=a+"px",this.floatTop=r+"px"},s=()=>{this.dragState=null,document.removeEventListener("pointermove",o),document.removeEventListener("pointerup",s)};document.addEventListener("pointermove",o),document.addEventListener("pointerup",s)};handleHeaderPositionClick(){this.cyclePosition()}componentWillLoad(){this.checkMobile()}componentDidLoad(){"undefined"!=typeof window&&("undefined"!=typeof ResizeObserver&&(this.resizeObserver=new ResizeObserver((()=>{this.checkMobile(),this.clampFloatPosition()})),this.resizeObserver.observe(this.el)),window.addEventListener("resize",this.handleWindowResize),"float"===this.position&&this.setupDrag(),this.mutationObserver=new MutationObserver((()=>{this.autoScroll&&this.messagesAreaRef&&requestAnimationFrame((()=>{this.messagesAreaRef.scrollTop=this.messagesAreaRef.scrollHeight}))})),this.mutationObserver.observe(this.el,{childList:!0,subtree:!0}))}isOpenChanged(e){e&&this.autoScroll&&this.messagesAreaRef&&requestAnimationFrame((()=>{this.messagesAreaRef.scrollTop=this.messagesAreaRef.scrollHeight}))}positionChanged(e){"float"===e&&this.setupDrag(),this.positionChange.emit(e)}disconnectedCallback(){"undefined"!=typeof window&&window.removeEventListener("resize",this.handleWindowResize),this.el.removeEventListener("headerDragStart",this.dragListener),this.mutationObserver?.disconnect(),this.resizeObserver?.disconnect()}async scrollToBottom(){this.messagesAreaRef&&(this.messagesAreaRef.scrollTop=this.messagesAreaRef.scrollHeight)}async cyclePosition(){this.position="float"===this.position?"rtl"===this.direction?"left":"right":"float"}handleWindowResize=()=>{this.checkMobile(),this.clampFloatPosition()};checkMobile(){"undefined"!=typeof window&&(this.isMobile=window.innerWidth<768)}clampFloatPosition(){if("undefined"==typeof window||"float"!==this.position||!this.containerRef)return;const e=window.innerWidth,t=window.innerHeight,a=this.containerRef.offsetWidth,r=this.containerRef.offsetHeight;let i=parseFloat(this.floatLeft)||0,o=parseFloat(this.floatTop)||0;i=Math.max(0,Math.min(i,e-a)),o=Math.max(0,Math.min(o,t-r)),this.floatLeft=i+"px",this.floatTop=o+"px"}setupDrag(){this.el.removeEventListener("headerDragStart",this.dragListener),this.el.addEventListener("headerDragStart",this.dragListener)}getContainerClasses(){const e=["chat-container",this.position];return this.isOpen&&e.push("open"),this.isMobile&&e.push("mobile"),e.join(" ")}getContainerStyle(){const e={};return this.isMobile||("float"===this.position?(e.width=this.width,e.height=this.floatHeight,e.left=this.floatLeft,e.top=this.floatTop):e.width=this.width),e}isDark(){return"dark"===this.theme||"auto"===this.theme&&"undefined"!=typeof window&&window.matchMedia("(prefers-color-scheme: dark)").matches}renderSkeleton(){return r("div",{class:"skeleton-messages","aria-busy":"true","aria-label":"Loading conversation"},r("div",{class:"skeleton-row agent"},r("div",{class:"skeleton-bubble"},r("div",{class:"skeleton-line",style:{width:"80%"}}),r("div",{class:"skeleton-line",style:{width:"60%"}}),r("div",{class:"skeleton-line",style:{width:"40%"}}))),r("div",{class:"skeleton-row user"},r("div",{class:"skeleton-bubble"},r("div",{class:"skeleton-line",style:{width:"70%"}}))),r("div",{class:"skeleton-row agent"},r("div",{class:"skeleton-bubble"},r("div",{class:"skeleton-line",style:{width:"90%"}}),r("div",{class:"skeleton-line",style:{width:"55%"}}))),r("div",{class:"skeleton-row user"},r("div",{class:"skeleton-bubble"},r("div",{class:"skeleton-line",style:{width:"50%"}}),r("div",{class:"skeleton-line",style:{width:"35%"}}))))}renderError(){return r("div",{class:"error-state",role:"alert"},r("svg",{class:"error-icon",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"1.5"}),r("path",{d:"M12 7v6",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"}),r("circle",{cx:"12",cy:"16.5",r:"0.75",fill:"currentColor"})),r("p",{class:"error-text"},this.errorText),r("button",{class:"error-retry-btn",type:"button",onClick:()=>this.retryClick.emit()},this.retryLabel))}render(){return r(i,{key:"1213110dce6a44b37c4a7b1f6a584368951964d2",class:{dark:this.isDark()}},r("div",{key:"df0df824b4ef271aae37dee7aa2fc85037ef647a",class:this.getContainerClasses(),style:this.getContainerStyle(),ref:e=>this.containerRef=e},this.showWatermark&&!this.loading&&!this.error&&r("div",{key:"168fd1510d8910f234331c03d4d549d0a9586472",class:"watermark"},r("svg",{key:"fde35527192a8501b190462bfdf66ae7d739742c",class:"watermark-circle-svg",width:"133",height:"133",viewBox:"0 0 133 133",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r("g",{key:"63c94c35e3adafac862c39cda04d05d75199bae0",filter:"url(#wm_circle_shadow)"},r("circle",{key:"8e8e304ae2132ad36855457a7755b2ba20770038",cx:"66.415",cy:"66.415",r:"66.415",class:"watermark-circle"})),r("defs",{key:"c571edd0fb6a68bf9e62530398ba01e482f5755e"},r("filter",{key:"c63ab4c6c16db9eac63d944c481564af4667f493",id:"wm_circle_shadow",x:"0",y:"0",width:"132.83",height:"135.83",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},r("feFlood",{key:"37105253941532ffc3136713df67e87b9ef123e5","flood-opacity":"0",result:"BackgroundImageFix"}),r("feBlend",{key:"ecde8a14cbc2a11125e548ebe412f00381aa561e",mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feColorMatrix",{key:"1001d9bf46d7df0f8788e46cfb311a90b5984f8d",in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),r("feOffset",{key:"4ffa296814b3eeb49e56688f1d6a981ac7055a92",dy:"3"}),r("feGaussianBlur",{key:"91a6bf8600f4b30c24af6717d61a7549584240f7",stdDeviation:"3"}),r("feComposite",{key:"325b8156a7a3cc8dfa1855d687436d170dc83bbb",in2:"hardAlpha",operator:"arithmetic",k2:"-1",k3:"1"}),r("feColorMatrix",{key:"48da64c927a7c97e21b499576cc8a421445ffd61",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0"}),r("feBlend",{key:"2c3fcf67f6769a6e6cee16ee4f7a6115a2aa3fbc",mode:"normal",in2:"shape",result:"effect1_innerShadow"})))),r("svg",{key:"25669b41c62a83760adb26129d4547ece7d5f6d9",class:"watermark-star-svg",width:"78",height:"78",viewBox:"0 0 78 78",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r("g",{key:"e1347f63fe1b5b57c1be6d4958817c2682745972",filter:"url(#wm_star_shadow)"},r("path",{key:"12ca3bbc4dcca07dbd4cc9e5b0227c2a4b5eeb98",d:"M38.7421 0C39.5691 0 40.2689 0.286272 40.8414 0.858815C41.414 1.43136 41.7002 2.13113 41.7002 2.95814C41.7002 8.87442 43.1952 14.3772 46.1851 19.4665C49.1115 24.4285 53.0557 28.3727 58.0177 31.299C63.107 34.289 68.6097 35.7839 74.526 35.7839C75.353 35.7839 76.0528 36.0702 76.6254 36.6428C77.1979 37.2153 77.4842 37.9151 77.4842 38.7421C77.4842 39.5691 77.1979 40.2689 76.6254 40.8414C76.0528 41.414 75.353 41.7002 74.526 41.7002C68.6097 41.7002 63.107 43.1952 58.0177 46.1851C53.0557 49.1115 49.1115 53.0557 46.1851 58.0177C43.1952 63.107 41.7002 68.6097 41.7002 74.526C41.7002 75.353 41.414 76.0528 40.8414 76.6254C40.2689 77.1979 39.5691 77.4842 38.7421 77.4842C37.9151 77.4842 37.2153 77.1979 36.6428 76.6254C36.0702 76.0528 35.7839 75.353 35.7839 74.526C35.7839 68.6097 34.289 63.107 31.299 58.0177C28.3727 53.0557 24.4285 49.1115 19.4665 46.1851C14.3772 43.1952 8.87442 41.7002 2.95814 41.7002C2.13113 41.7002 1.43136 41.414 0.858815 40.8414C0.286272 40.2689 0 39.5691 0 38.7421C0 37.9151 0.286272 37.2153 0.858815 36.6428C1.43136 36.0702 2.13113 35.7839 2.95814 35.7839C8.87442 35.7839 14.3772 34.289 19.4665 31.299C24.4285 28.3727 28.3727 24.4285 31.299 19.4665C34.289 14.3772 35.7839 8.87442 35.7839 2.95814C35.7839 2.13113 36.0702 1.43136 36.6428 0.858815C37.2153 0.286272 37.9151 0 38.7421 0Z",class:"watermark-star"})),r("defs",{key:"6118bbae343ffc6cdc52df3d2062b63dd655f96d"},r("filter",{key:"ac762ad5983155b7122e4e1466dcaa9230d2ad4f",id:"wm_star_shadow",x:"0",y:"0",width:"77.4844",height:"79.4841",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},r("feFlood",{key:"452561901594c49f607f2a5a0dd149edab297703","flood-opacity":"0",result:"BackgroundImageFix"}),r("feBlend",{key:"bd77b4ec605953eff1b83d63b152f6bc0cf757f9",mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feColorMatrix",{key:"55215acb177fe0a8d7bf454244d1eec0a52657d9",in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),r("feOffset",{key:"2079610df4ddb703dffdb0ba26a83262b28ddb8e",dy:"2"}),r("feGaussianBlur",{key:"b42acf138ed8ed2c51ce3a51eb774f8ccb3932a5",stdDeviation:"2"}),r("feComposite",{key:"6b2439a1f50c1355851333431d1745d864fd4a68",in2:"hardAlpha",operator:"arithmetic",k2:"-1",k3:"1"}),r("feColorMatrix",{key:"da9900a125e3e0df5f3bb383382b949d0c967d9c",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0"}),r("feBlend",{key:"579851be42d902cbd9939df09ba996b11210181f",mode:"normal",in2:"shape",result:"effect1_innerShadow"}))))),r("slot",{key:"e2ef3a4097ff512ac2e9638fef4725b55cd4ea24",name:"header"}),r("div",{key:"46dac73e46b2eac797c88ed826497e4d6063f2d3",class:"messages-area",ref:e=>this.messagesAreaRef=e},this.loading?this.renderSkeleton():this.error?this.renderError():r("slot",null)),r("slot",{key:"ff2cf3628bbab90bd0cdce07df6c08ae597867ba",name:"footer"})))}static get watchers(){return{isOpen:[{isOpenChanged:0}],position:[{positionChanged:0}]}}static get style(){return":host{display:contents}.chat-container{font-family:var(--ai-font-family);display:flex;flex-direction:column;overflow:hidden;position:relative;background-color:var(--ai-container-bg, var(--ai-bg-card));border:1px solid var(--ai-border-default);z-index:50;box-sizing:border-box}.messages-area{flex:1;overflow-y:auto;min-height:0;scrollbar-width:thin;padding:var(--ai-spacing-2xl, 16px);scrollbar-color:var(--ai-scrollbar-thumb) transparent}.messages-area::-webkit-scrollbar{width:3px}.messages-area::-webkit-scrollbar-track{background:transparent}.messages-area::-webkit-scrollbar-thumb{background:var(--ai-scrollbar-thumb);border-radius:99px}.messages-area::-webkit-scrollbar-thumb:hover{background:var(--ai-scrollbar-thumb-hover)}.chat-container.left,.chat-container.right{position:fixed;top:0;bottom:0;transition:transform 300ms cubic-bezier(0.4, 0, 0.2, 1)}.chat-container.left{left:0;transform:translateX(-100%)}.chat-container.right{right:0;transform:translateX(100%)}.chat-container.left.open,.chat-container.right.open{transform:translateX(0)}.chat-container.float{position:fixed;border-radius:16px;box-shadow:var(--ai-shadow-float);opacity:0;pointer-events:none;transform:scale(0.95);transform-origin:bottom left;transition:opacity 200ms ease, transform 200ms ease}.chat-container.float.open{opacity:1;pointer-events:auto;transform:scale(1)}.watermark{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);pointer-events:none;width:133px;height:133px}.watermark .watermark-circle-svg{position:absolute;top:0;left:0}.watermark .watermark-star-svg{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}.watermark .watermark-circle{fill:var(--ai-watermark-circle, #FCFCFC)}.watermark .watermark-star{fill:var(--ai-watermark-star, #FAFAFA)}:host(.dark) .watermark .watermark-circle{fill:var(--ai-watermark-circle, #222222)}:host(.dark) .watermark .watermark-star{fill:var(--ai-watermark-star, #292B2C)}.chat-container.mobile{width:100% !important}.chat-container.float.mobile{left:0 !important;right:0 !important;top:0 !important;bottom:0 !important;height:100% !important;border-radius:0 !important}@media (max-width: 767px){.chat-container{width:100% !important}.chat-container.float{left:0 !important;right:0 !important;top:0 !important;bottom:0 !important;height:100% !important;border-radius:0 !important}}@keyframes skeleton-shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}.skeleton-messages{display:flex;flex-direction:column;gap:20px;padding:8px 0}.skeleton-row{display:flex;align-items:flex-start;gap:10px}.skeleton-row.agent{flex-direction:row}.skeleton-row.user{flex-direction:row-reverse}.skeleton-avatar{width:32px;height:32px;min-width:32px;border-radius:50%;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:skeleton-shimmer 1.6s ease-in-out infinite}.skeleton-bubble{display:flex;flex-direction:column;gap:8px;padding:14px 16px;border-radius:16px;background-color:var(--ai-bg-surface, #f9fafb);max-width:75%;min-width:120px}.skeleton-row.user .skeleton-bubble{background-color:var(--ai-user-bubble-bg, var(--ai-accent, #004956));border-radius:16px}.skeleton-line{height:12px;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:skeleton-shimmer 1.6s ease-in-out infinite}.skeleton-row.user .skeleton-line{background:linear-gradient(90deg, rgba(255,255,255,0.08) 25%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.08) 75%);background-size:200% 100%;animation:skeleton-shimmer 1.6s ease-in-out infinite}:host(.dark) .skeleton-avatar{background:var(--ai-shimmer-gradient, linear-gradient(90deg, rgba(255,255,255,0.06) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.06) 75%));background-size:200% 100%;animation:skeleton-shimmer 1.6s ease-in-out infinite}:host(.dark) .skeleton-bubble{background-color:var(--ai-bg-surface, #1f2937)}:host(.dark) .skeleton-line{background:var(--ai-shimmer-gradient, linear-gradient(90deg, rgba(255,255,255,0.06) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.06) 75%));background-size:200% 100%;animation:skeleton-shimmer 1.6s ease-in-out infinite}.error-state{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:12px;padding:48px 24px;flex:1}.error-icon{color:var(--ai-text-muted, #9ca3af);opacity:0.7}.error-text{margin:0;font-size:14px;line-height:1.5;color:var(--ai-text-secondary, #6b7280)}.error-retry-btn{display:inline-flex;align-items:center;justify-content:center;padding:8px 20px;border-radius:9999px;border:1px solid var(--ai-border-default);background-color:var(--ai-bg-surface, #f9fafb);color:var(--ai-text-primary);font-size:13px;font-weight:500;font-family:inherit;cursor:pointer;transition:background-color 0.15s ease, border-color 0.15s ease}.error-retry-btn:hover{background-color:var(--ai-hover-overlay, rgba(0, 0, 0, 0.04));border-color:var(--ai-accent, #004956)}.error-retry-btn:focus-visible{outline:2px solid var(--ai-focus-ring-color, var(--ai-focus-ring));outline-offset:2px}:host(.dark) .error-retry-btn{background-color:var(--ai-bg-surface, #1f2937);color:var(--ai-text-primary, #f9fafb)}:host(.dark) .error-retry-btn:hover{background-color:var(--ai-hover-overlay, rgba(255, 255, 255, 0.06))}"}},[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}]}]),n=s,l=function(){"undefined"!=typeof customElements&&["ai-chat-container"].forEach((e=>{"ai-chat-container"===e&&(customElements.get(o(e))||customElements.define(o(e),s))}))};export{n as AiChatContainer,l as defineCustomElement}
@@ -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-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 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)};handleConversationRetry=t=>{t.stopPropagation(),this.conversationRetry.emit()};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,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(),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:"80236bfcbfac98d3efa3955f03aab4ef68c9cfea"},a("div",{key:"dcc4142bba1d5f07782dbc7b0a3ec287e0154223",class:"header-wrapper"},a("div",{key:"ca0ff9a2946cead0b86cb82390624894ed414378",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
+ 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;disableNewChat=!1;disableConversationList=!1;avatarError=!1;dropdownOpen=!1;isFloating=!1;isMobile=!1;parentPositionObserver=null;handleWindowResize=()=>this.checkMobile();closeClick;newChatClick;dropdownClick;positionClick;headerPositionClick;backClick;headerDragStart;openExternal;conversationSelect;conversationDelete;conversationRetry;handleDocumentClick(t){this.dropdownOpen&&!this.el.contains(t.target)&&(this.dropdownOpen=!1)}connectedCallback(){this.checkMobile()}componentDidLoad(){requestAnimationFrame((()=>{this.syncFloatingState(),this.observeParentPosition()})),"undefined"!=typeof window&&window.addEventListener("resize",this.handleWindowResize)}disconnectedCallback(){this.parentPositionObserver?.disconnect(),this.parentPositionObserver=null,"undefined"!=typeof window&&window.removeEventListener("resize",this.handleWindowResize)}checkMobile(){"undefined"!=typeof window&&(this.isMobile=window.innerWidth<768)}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&&!this.isMobile&&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||this.disableConversationList?null: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}))}renderAgentMode(){const t=this.disableConversationList?n("div",{class:"content agent"},this.titleLoading?n("span",{class:"title-skeleton","aria-busy":"true","aria-label":"جاري التحميل"}):n("span",{class:"title"},this.conversation)):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)));return[this.renderDragBtn(),t,n("div",{class:"actions"},!this.disableNewChat&&n("button",{class:"action-btn","aria-label":"محادثة جديدة / New Chat",onClick:()=>this.newChatClick.emit()},this.renderIcon("pencil-edit",22,22)),!this.isMobile&&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"},!this.isMobile&&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"},!this.isMobile&&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:"4c51abf7f5fb572ec62191c0b097a4fdf9b218c3"},n("div",{key:"c05febe2f984bad8e80b9f0d9f2ceeebc812a9b4",class:"header-wrapper"},n("div",{key:"927c606ae5452a9a5c1e19edd2145f9e1ee42d2c",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"],disableNewChat:[4,"disable-new-chat"],disableConversationList:[4,"disable-conversation-list"],avatarError:[32],dropdownOpen:[32],isFloating:[32],isMobile:[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}
@@ -138,6 +138,7 @@ const ChatContainer = class {
138
138
  if (newVal === 'float') {
139
139
  this.setupDrag();
140
140
  }
141
+ this.positionChange.emit(newVal);
141
142
  }
142
143
  disconnectedCallback() {
143
144
  if (typeof window !== 'undefined') {
@@ -161,7 +162,6 @@ const ChatContainer = class {
161
162
  async cyclePosition() {
162
163
  const docked = this.direction === 'rtl' ? 'left' : 'right';
163
164
  this.position = this.position === 'float' ? docked : 'float';
164
- this.positionChange.emit(this.position);
165
165
  }
166
166
  handleWindowResize = () => {
167
167
  this.checkMobile();
@@ -233,7 +233,7 @@ const ChatContainer = class {
233
233
  return (h("div", { class: "error-state", role: "alert" }, h("svg", { class: "error-icon", width: "48", height: "48", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor", "stroke-width": "1.5" }), h("path", { d: "M12 7v6", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round" }), h("circle", { cx: "12", cy: "16.5", r: "0.75", fill: "currentColor" })), h("p", { class: "error-text" }, this.errorText), h("button", { class: "error-retry-btn", type: "button", onClick: () => this.retryClick.emit() }, this.retryLabel)));
234
234
  }
235
235
  render() {
236
- return (h(Host, { key: '6290736307488f10a4ed441e2a8e0b3a2e89af05', class: { dark: this.isDark() } }, h("div", { key: '6d6a731d9941457b786c71625243a7dd1e9f11f8', class: this.getContainerClasses(), style: this.getContainerStyle(), ref: el => (this.containerRef = el) }, this.showWatermark && !this.loading && !this.error && (h("div", { key: '0c2ae5b52f8c30bdf356a3c356d52305451cb19e', class: "watermark" }, h("svg", { key: '36076d8dd514f5736050228d22b9a03d5d48ce28', class: "watermark-circle-svg", width: "133", height: "133", viewBox: "0 0 133 133", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("g", { key: '737a3f3d8b7a0f91120258c292d047f9dc90871c', filter: "url(#wm_circle_shadow)" }, h("circle", { key: 'a59549c879ddaa2a0007c4fd9645c4382b14e73f', cx: "66.415", cy: "66.415", r: "66.415", class: "watermark-circle" })), h("defs", { key: '58d5edc4e05f3dd8a60f7a829b70f154ba85bfc1' }, h("filter", { key: 'd2cb7cb5a84bdf1496b56ec5a0c0c79001040670', id: "wm_circle_shadow", x: "0", y: "0", width: "132.83", height: "135.83", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB" }, h("feFlood", { key: 'e90404f557fba552a21bd3748ad728470172040f', "flood-opacity": "0", result: "BackgroundImageFix" }), h("feBlend", { key: 'ef5aee167a4973c35f8ffaa8ae4a0487de8266ee', mode: "normal", in: "SourceGraphic", in2: "BackgroundImageFix", result: "shape" }), h("feColorMatrix", { key: 'e0869202bc43610b91abce92e85e8e5264cda999', in: "SourceAlpha", type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0", result: "hardAlpha" }), h("feOffset", { key: '7bef38d885b93711fce4c0efbb719a83417eeefb', dy: "3" }), h("feGaussianBlur", { key: '053de38388f049be8db7867b99b53d403de934ca', stdDeviation: "3" }), h("feComposite", { key: 'e5f68fbcf0923174a177545bf3364d066a122347', in2: "hardAlpha", operator: "arithmetic", k2: "-1", k3: "1" }), h("feColorMatrix", { key: '62dc924cbdc92ce4adc0ec81be851c1d40e7a5b0', type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0" }), h("feBlend", { key: '908299725f9e553c636bd18eab6541c6a7c69fe5', mode: "normal", in2: "shape", result: "effect1_innerShadow" })))), h("svg", { key: '2a6ce2364bfd667c4eba56d859a1326f70a82901', class: "watermark-star-svg", width: "78", height: "78", viewBox: "0 0 78 78", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("g", { key: 'e2c431ac6bee320c817a7283e6e356edc4667146', filter: "url(#wm_star_shadow)" }, h("path", { key: 'd87d0313e649527f5909ac1b08f7af2979760d79', d: "M38.7421 0C39.5691 0 40.2689 0.286272 40.8414 0.858815C41.414 1.43136 41.7002 2.13113 41.7002 2.95814C41.7002 8.87442 43.1952 14.3772 46.1851 19.4665C49.1115 24.4285 53.0557 28.3727 58.0177 31.299C63.107 34.289 68.6097 35.7839 74.526 35.7839C75.353 35.7839 76.0528 36.0702 76.6254 36.6428C77.1979 37.2153 77.4842 37.9151 77.4842 38.7421C77.4842 39.5691 77.1979 40.2689 76.6254 40.8414C76.0528 41.414 75.353 41.7002 74.526 41.7002C68.6097 41.7002 63.107 43.1952 58.0177 46.1851C53.0557 49.1115 49.1115 53.0557 46.1851 58.0177C43.1952 63.107 41.7002 68.6097 41.7002 74.526C41.7002 75.353 41.414 76.0528 40.8414 76.6254C40.2689 77.1979 39.5691 77.4842 38.7421 77.4842C37.9151 77.4842 37.2153 77.1979 36.6428 76.6254C36.0702 76.0528 35.7839 75.353 35.7839 74.526C35.7839 68.6097 34.289 63.107 31.299 58.0177C28.3727 53.0557 24.4285 49.1115 19.4665 46.1851C14.3772 43.1952 8.87442 41.7002 2.95814 41.7002C2.13113 41.7002 1.43136 41.414 0.858815 40.8414C0.286272 40.2689 0 39.5691 0 38.7421C0 37.9151 0.286272 37.2153 0.858815 36.6428C1.43136 36.0702 2.13113 35.7839 2.95814 35.7839C8.87442 35.7839 14.3772 34.289 19.4665 31.299C24.4285 28.3727 28.3727 24.4285 31.299 19.4665C34.289 14.3772 35.7839 8.87442 35.7839 2.95814C35.7839 2.13113 36.0702 1.43136 36.6428 0.858815C37.2153 0.286272 37.9151 0 38.7421 0Z", class: "watermark-star" })), h("defs", { key: '51e7ef185399e3a10d0b19eb399500be3e5384f8' }, h("filter", { key: '09f52cd1b7084a8af9488bbce05c277fe07012f9', id: "wm_star_shadow", x: "0", y: "0", width: "77.4844", height: "79.4841", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB" }, h("feFlood", { key: '1b055616d714f824dd38a895a5c1a635fefc4a66', "flood-opacity": "0", result: "BackgroundImageFix" }), h("feBlend", { key: '044cba9d32d0a1d56fc39d318dfc1cdd0fdc0ae7', mode: "normal", in: "SourceGraphic", in2: "BackgroundImageFix", result: "shape" }), h("feColorMatrix", { key: '4bf50b36bd6b1ae90d29a95290762ef52dbfff7a', in: "SourceAlpha", type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0", result: "hardAlpha" }), h("feOffset", { key: '0988514af2fda03cb2ff43e95c1423137351186f', dy: "2" }), h("feGaussianBlur", { key: 'c96fb451b890e9bda84043dcd699c2a3f59c195c', stdDeviation: "2" }), h("feComposite", { key: '77b2bb3e01eefb08cac5f60a494c2cd15e97db4a', in2: "hardAlpha", operator: "arithmetic", k2: "-1", k3: "1" }), h("feColorMatrix", { key: 'aef785066c732cc5cbc16689f2e57a7df7d18bc5', type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0" }), h("feBlend", { key: '292a1d370d268312514f1c8fcee2167159c2d4e9', mode: "normal", in2: "shape", result: "effect1_innerShadow" })))))), h("slot", { key: '009fd561884a5a70e559d865dc1b1d55937d923c', name: "header" }), h("div", { key: 'fde5090720cd70c2b5fe72bcaec95007e7792f4e', class: "messages-area", ref: el => (this.messagesAreaRef = el) }, this.loading ? this.renderSkeleton() : this.error ? this.renderError() : h("slot", null)), h("slot", { key: '838ea2de9f788af2af70568a7882a08645c6b2ac', name: "footer" }))));
236
+ return (h(Host, { key: '1213110dce6a44b37c4a7b1f6a584368951964d2', class: { dark: this.isDark() } }, h("div", { key: 'df0df824b4ef271aae37dee7aa2fc85037ef647a', class: this.getContainerClasses(), style: this.getContainerStyle(), ref: el => (this.containerRef = el) }, this.showWatermark && !this.loading && !this.error && (h("div", { key: '168fd1510d8910f234331c03d4d549d0a9586472', class: "watermark" }, h("svg", { key: 'fde35527192a8501b190462bfdf66ae7d739742c', class: "watermark-circle-svg", width: "133", height: "133", viewBox: "0 0 133 133", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("g", { key: '63c94c35e3adafac862c39cda04d05d75199bae0', filter: "url(#wm_circle_shadow)" }, h("circle", { key: '8e8e304ae2132ad36855457a7755b2ba20770038', cx: "66.415", cy: "66.415", r: "66.415", class: "watermark-circle" })), h("defs", { key: 'c571edd0fb6a68bf9e62530398ba01e482f5755e' }, h("filter", { key: 'c63ab4c6c16db9eac63d944c481564af4667f493', id: "wm_circle_shadow", x: "0", y: "0", width: "132.83", height: "135.83", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB" }, h("feFlood", { key: '37105253941532ffc3136713df67e87b9ef123e5', "flood-opacity": "0", result: "BackgroundImageFix" }), h("feBlend", { key: 'ecde8a14cbc2a11125e548ebe412f00381aa561e', mode: "normal", in: "SourceGraphic", in2: "BackgroundImageFix", result: "shape" }), h("feColorMatrix", { key: '1001d9bf46d7df0f8788e46cfb311a90b5984f8d', in: "SourceAlpha", type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0", result: "hardAlpha" }), h("feOffset", { key: '4ffa296814b3eeb49e56688f1d6a981ac7055a92', dy: "3" }), h("feGaussianBlur", { key: '91a6bf8600f4b30c24af6717d61a7549584240f7', stdDeviation: "3" }), h("feComposite", { key: '325b8156a7a3cc8dfa1855d687436d170dc83bbb', in2: "hardAlpha", operator: "arithmetic", k2: "-1", k3: "1" }), h("feColorMatrix", { key: '48da64c927a7c97e21b499576cc8a421445ffd61', type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0" }), h("feBlend", { key: '2c3fcf67f6769a6e6cee16ee4f7a6115a2aa3fbc', mode: "normal", in2: "shape", result: "effect1_innerShadow" })))), h("svg", { key: '25669b41c62a83760adb26129d4547ece7d5f6d9', class: "watermark-star-svg", width: "78", height: "78", viewBox: "0 0 78 78", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("g", { key: 'e1347f63fe1b5b57c1be6d4958817c2682745972', filter: "url(#wm_star_shadow)" }, h("path", { key: '12ca3bbc4dcca07dbd4cc9e5b0227c2a4b5eeb98', d: "M38.7421 0C39.5691 0 40.2689 0.286272 40.8414 0.858815C41.414 1.43136 41.7002 2.13113 41.7002 2.95814C41.7002 8.87442 43.1952 14.3772 46.1851 19.4665C49.1115 24.4285 53.0557 28.3727 58.0177 31.299C63.107 34.289 68.6097 35.7839 74.526 35.7839C75.353 35.7839 76.0528 36.0702 76.6254 36.6428C77.1979 37.2153 77.4842 37.9151 77.4842 38.7421C77.4842 39.5691 77.1979 40.2689 76.6254 40.8414C76.0528 41.414 75.353 41.7002 74.526 41.7002C68.6097 41.7002 63.107 43.1952 58.0177 46.1851C53.0557 49.1115 49.1115 53.0557 46.1851 58.0177C43.1952 63.107 41.7002 68.6097 41.7002 74.526C41.7002 75.353 41.414 76.0528 40.8414 76.6254C40.2689 77.1979 39.5691 77.4842 38.7421 77.4842C37.9151 77.4842 37.2153 77.1979 36.6428 76.6254C36.0702 76.0528 35.7839 75.353 35.7839 74.526C35.7839 68.6097 34.289 63.107 31.299 58.0177C28.3727 53.0557 24.4285 49.1115 19.4665 46.1851C14.3772 43.1952 8.87442 41.7002 2.95814 41.7002C2.13113 41.7002 1.43136 41.414 0.858815 40.8414C0.286272 40.2689 0 39.5691 0 38.7421C0 37.9151 0.286272 37.2153 0.858815 36.6428C1.43136 36.0702 2.13113 35.7839 2.95814 35.7839C8.87442 35.7839 14.3772 34.289 19.4665 31.299C24.4285 28.3727 28.3727 24.4285 31.299 19.4665C34.289 14.3772 35.7839 8.87442 35.7839 2.95814C35.7839 2.13113 36.0702 1.43136 36.6428 0.858815C37.2153 0.286272 37.9151 0 38.7421 0Z", class: "watermark-star" })), h("defs", { key: '6118bbae343ffc6cdc52df3d2062b63dd655f96d' }, h("filter", { key: 'ac762ad5983155b7122e4e1466dcaa9230d2ad4f', id: "wm_star_shadow", x: "0", y: "0", width: "77.4844", height: "79.4841", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB" }, h("feFlood", { key: '452561901594c49f607f2a5a0dd149edab297703', "flood-opacity": "0", result: "BackgroundImageFix" }), h("feBlend", { key: 'bd77b4ec605953eff1b83d63b152f6bc0cf757f9', mode: "normal", in: "SourceGraphic", in2: "BackgroundImageFix", result: "shape" }), h("feColorMatrix", { key: '55215acb177fe0a8d7bf454244d1eec0a52657d9', in: "SourceAlpha", type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0", result: "hardAlpha" }), h("feOffset", { key: '2079610df4ddb703dffdb0ba26a83262b28ddb8e', dy: "2" }), h("feGaussianBlur", { key: 'b42acf138ed8ed2c51ce3a51eb774f8ccb3932a5', stdDeviation: "2" }), h("feComposite", { key: '6b2439a1f50c1355851333431d1745d864fd4a68', in2: "hardAlpha", operator: "arithmetic", k2: "-1", k3: "1" }), h("feColorMatrix", { key: 'da9900a125e3e0df5f3bb383382b949d0c967d9c', type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0" }), h("feBlend", { key: '579851be42d902cbd9939df09ba996b11210181f', mode: "normal", in2: "shape", result: "effect1_innerShadow" })))))), h("slot", { key: 'e2ef3a4097ff512ac2e9638fef4725b55cd4ea24', name: "header" }), h("div", { key: '46dac73e46b2eac797c88ed826497e4d6063f2d3', class: "messages-area", ref: el => (this.messagesAreaRef = el) }, this.loading ? this.renderSkeleton() : this.error ? this.renderError() : h("slot", null)), h("slot", { key: 'ff2cf3628bbab90bd0cdce07df6c08ae597867ba', name: "footer" }))));
237
237
  }
238
238
  static get watchers() { return {
239
239
  "isOpen": [{
@@ -55,11 +55,18 @@ const AiChatHeader = class {
55
55
  conversationDeletingId = '';
56
56
  /** Show a shimmer skeleton in place of the conversation title (e.g. while loading conversation) */
57
57
  titleLoading = false;
58
+ /** Hide the new-chat (pencil-edit) button */
59
+ disableNewChat = false;
60
+ /** Hide the conversation-list dropdown trigger (title chevron) */
61
+ disableConversationList = false;
58
62
  avatarError = false;
59
63
  dropdownOpen = false;
60
64
  /** Internally managed — true when the parent ai-chat-container has position="float" */
61
65
  isFloating = false;
66
+ /** Internally managed — true when viewport width < 768px (matches ai-chat-container logic) */
67
+ isMobile = false;
62
68
  parentPositionObserver = null;
69
+ handleWindowResize = () => this.checkMobile();
63
70
  /** Cancel / close button */
64
71
  closeClick;
65
72
  /** Pencil-edit button (agent mode) */
@@ -94,7 +101,7 @@ const AiChatHeader = class {
94
101
  }
95
102
  }
96
103
  connectedCallback() {
97
- // Initial sync will happen in componentDidLoad
104
+ this.checkMobile();
98
105
  }
99
106
  componentDidLoad() {
100
107
  // By this point, the element is fully in the DOM and parent relationships are established
@@ -103,10 +110,21 @@ const AiChatHeader = class {
103
110
  this.syncFloatingState();
104
111
  this.observeParentPosition();
105
112
  });
113
+ if (typeof window !== 'undefined') {
114
+ window.addEventListener('resize', this.handleWindowResize);
115
+ }
106
116
  }
107
117
  disconnectedCallback() {
108
118
  this.parentPositionObserver?.disconnect();
109
119
  this.parentPositionObserver = null;
120
+ if (typeof window !== 'undefined') {
121
+ window.removeEventListener('resize', this.handleWindowResize);
122
+ }
123
+ }
124
+ checkMobile() {
125
+ if (typeof window !== 'undefined') {
126
+ this.isMobile = window.innerWidth < 768;
127
+ }
110
128
  }
111
129
  observeParentPosition() {
112
130
  if (this.parentPositionObserver)
@@ -147,7 +165,7 @@ const AiChatHeader = class {
147
165
  } }));
148
166
  }
149
167
  renderDragBtn() {
150
- return (this.isFloating && (h("button", { class: "action-btn drag-btn", "aria-label": "\u0633\u062D\u0628 / Drag", onPointerDown: (e) => {
168
+ return (this.isFloating && !this.isMobile && (h("button", { class: "action-btn drag-btn", "aria-label": "\u0633\u062D\u0628 / Drag", onPointerDown: (e) => {
151
169
  e.preventDefault();
152
170
  this.headerDragStart.emit({ clientX: e.clientX, clientY: e.clientY });
153
171
  } }, this.renderIcon('drag', 11, 15))));
@@ -166,38 +184,39 @@ const AiChatHeader = class {
166
184
  this.conversationRetry.emit();
167
185
  };
168
186
  renderConversationDropdown() {
169
- if (!this.dropdownOpen || this.mode !== 'agent')
187
+ if (!this.dropdownOpen || this.mode !== 'agent' || this.disableConversationList)
170
188
  return null;
171
189
  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 })));
172
190
  }
173
191
  renderAgentMode() {
192
+ const titleContent = this.disableConversationList ? (h("div", { class: "content agent" }, this.titleLoading ? (h("span", { class: "title-skeleton", "aria-busy": "true", "aria-label": "\u062C\u0627\u0631\u064A \u0627\u0644\u062A\u062D\u0645\u064A\u0644" })) : (h("span", { class: "title" }, this.conversation)))) : (h("div", { class: "content agent dropdown-trigger", role: "button", onClick: () => {
193
+ if (this.titleLoading)
194
+ return;
195
+ this.dropdownOpen = !this.dropdownOpen;
196
+ this.dropdownClick.emit();
197
+ }, "aria-haspopup": "listbox", "aria-expanded": this.dropdownOpen, "aria-label": `${this.conversation}, افتح قائمة المحادثات` }, this.titleLoading ? (h("span", { class: "title-skeleton", "aria-busy": "true", "aria-label": "\u062C\u0627\u0631\u064A \u0627\u0644\u062A\u062D\u0645\u064A\u0644" })) : (h("span", { class: "title" }, this.conversation)), !this.titleLoading && (h("span", { class: `dropdown-chevron${this.dropdownOpen ? ' open' : ''}` }, this.renderIcon('chevron-down', 24, 24)))));
174
198
  return [
175
199
  this.renderDragBtn(),
176
- h("div", { class: "content agent dropdown-trigger", role: "button", onClick: () => {
177
- if (this.titleLoading)
178
- return;
179
- this.dropdownOpen = !this.dropdownOpen;
180
- this.dropdownClick.emit();
181
- }, "aria-haspopup": "listbox", "aria-expanded": this.dropdownOpen, "aria-label": `${this.conversation}, افتح قائمة المحادثات` }, this.titleLoading ? (h("span", { class: "title-skeleton", "aria-busy": "true", "aria-label": "\u062C\u0627\u0631\u064A \u0627\u0644\u062A\u062D\u0645\u064A\u0644" })) : (h("span", { class: "title" }, this.conversation)), !this.titleLoading && (h("span", { class: `dropdown-chevron${this.dropdownOpen ? ' open' : ''}` }, this.renderIcon('chevron-down', 24, 24)))),
182
- h("div", { class: "actions" }, h("button", { class: "action-btn", "aria-label": "\u0645\u062D\u0627\u062F\u062B\u0629 \u062C\u062F\u064A\u062F\u0629 / New Chat", onClick: () => this.newChatClick.emit() }, this.renderIcon('pencil-edit', 22, 22)), h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => { this.positionClick.emit(); this.headerPositionClick.emit(); } }, this.renderIcon('hand', 22, 22)), h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
200
+ titleContent,
201
+ h("div", { class: "actions" }, !this.disableNewChat && (h("button", { class: "action-btn", "aria-label": "\u0645\u062D\u0627\u062F\u062B\u0629 \u062C\u062F\u064A\u062F\u0629 / New Chat", onClick: () => this.newChatClick.emit() }, this.renderIcon('pencil-edit', 22, 22))), !this.isMobile && (h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => { this.positionClick.emit(); this.headerPositionClick.emit(); } }, this.renderIcon('hand', 22, 22))), h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
183
202
  ];
184
203
  }
185
204
  renderHumanMode() {
186
205
  return [
187
206
  this.renderDragBtn(),
188
207
  h("div", { class: "content human" }, this.showBack && (h("button", { class: "back-btn", "aria-label": "\u0631\u062C\u0648\u0639 / Back", onClick: () => this.backClick.emit() }, this.renderIcon('arrow-right', 24, 24))), h("div", { class: "avatar-wrapper" }, this.renderAvatar(), h("span", { class: `online-dot status-${this.statusIndicator}` }, this.renderIcon('online-dot', 10, 10))), h("div", { class: "text-block" }, h("span", { class: "agent-name" }, this.agentName), this.agentStatus && h("span", { class: "agent-status" }, this.agentStatus))),
189
- h("div", { class: "actions" }, h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => { this.positionClick.emit(); this.headerPositionClick.emit(); } }, this.renderIcon('hand', 22, 22)), h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
208
+ h("div", { class: "actions" }, !this.isMobile && (h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => { this.positionClick.emit(); this.headerPositionClick.emit(); } }, this.renderIcon('hand', 22, 22))), h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
190
209
  ];
191
210
  }
192
211
  renderBrowserMode() {
193
212
  return [
194
213
  this.renderDragBtn(),
195
214
  h("div", { class: "content browser" }, h("button", { class: "back-btn", "aria-label": "\u0631\u062C\u0648\u0639 / Back", onClick: () => this.backClick.emit() }, this.renderIcon('arrow-right', 24, 24)), h("span", { class: "browser-title" }, this.pageTitle), h("button", { class: "browser-link-btn", "aria-label": "\u0641\u062A\u062D \u0641\u064A \u0646\u0627\u0641\u0630\u0629 \u062C\u062F\u064A\u062F\u0629 / Open externally", onClick: () => this.openExternal.emit(this.pageUrl) }, this.renderIcon('link', 14, 14))),
196
- h("div", { class: "actions" }, h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => { this.positionClick.emit(); this.headerPositionClick.emit(); } }, this.renderIcon('hand', 22, 22)), h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
215
+ h("div", { class: "actions" }, !this.isMobile && (h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => { this.positionClick.emit(); this.headerPositionClick.emit(); } }, this.renderIcon('hand', 22, 22))), h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
197
216
  ];
198
217
  }
199
218
  render() {
200
- return (h(Host, { key: '80236bfcbfac98d3efa3955f03aab4ef68c9cfea' }, h("div", { key: 'dcc4142bba1d5f07782dbc7b0a3ec287e0154223', class: "header-wrapper" }, h("div", { key: 'ca0ff9a2946cead0b86cb82390624894ed414378', class: "header-container" }, this.mode === 'agent' ? this.renderAgentMode() : this.mode === 'human' ? this.renderHumanMode() : this.renderBrowserMode()), this.renderConversationDropdown())));
219
+ return (h(Host, { key: '4c51abf7f5fb572ec62191c0b097a4fdf9b218c3' }, h("div", { key: 'c05febe2f984bad8e80b9f0d9f2ceeebc812a9b4', class: "header-wrapper" }, h("div", { key: '927c606ae5452a9a5c1e19edd2145f9e1ee42d2c', class: "header-container" }, this.mode === 'agent' ? this.renderAgentMode() : this.mode === 'human' ? this.renderHumanMode() : this.renderBrowserMode()), this.renderConversationDropdown())));
201
220
  }
202
221
  };
203
222
  AiChatHeader.style = aiChatHeaderCss();
@@ -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"],"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);
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"],"disableNewChat":[4,"disable-new-chat"],"disableConversationList":[4,"disable-conversation-list"],"avatarError":[32],"dropdownOpen":[32],"isFloating":[32],"isMobile":[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 };
@@ -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"],"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);
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"],"disableNewChat":[4,"disable-new-chat"],"disableConversationList":[4,"disable-conversation-list"],"avatarError":[32],"dropdownOpen":[32],"isFloating":[32],"isMobile":[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
  });
@@ -51,7 +51,7 @@ export declare class ChatContainer {
51
51
  componentWillLoad(): void;
52
52
  componentDidLoad(): void;
53
53
  isOpenChanged(newVal: boolean): void;
54
- positionChanged(newVal: string): void;
54
+ positionChanged(newVal: ChatPosition): void;
55
55
  disconnectedCallback(): void;
56
56
  /** Programmatically scroll the messages area to the bottom */
57
57
  scrollToBottom(): Promise<void>;
@@ -38,11 +38,18 @@ export declare class AiChatHeader {
38
38
  conversationDeletingId: string;
39
39
  /** Show a shimmer skeleton in place of the conversation title (e.g. while loading conversation) */
40
40
  titleLoading: boolean;
41
+ /** Hide the new-chat (pencil-edit) button */
42
+ disableNewChat: boolean;
43
+ /** Hide the conversation-list dropdown trigger (title chevron) */
44
+ disableConversationList: boolean;
41
45
  private avatarError;
42
46
  private dropdownOpen;
43
47
  /** Internally managed — true when the parent ai-chat-container has position="float" */
44
48
  private isFloating;
49
+ /** Internally managed — true when viewport width < 768px (matches ai-chat-container logic) */
50
+ private isMobile;
45
51
  private parentPositionObserver;
52
+ private handleWindowResize;
46
53
  /** Cancel / close button */
47
54
  closeClick: EventEmitter<void>;
48
55
  /** Pencil-edit button (agent mode) */
@@ -78,6 +85,7 @@ export declare class AiChatHeader {
78
85
  connectedCallback(): void;
79
86
  componentDidLoad(): void;
80
87
  disconnectedCallback(): void;
88
+ private checkMobile;
81
89
  private observeParentPosition;
82
90
  private syncFloatingState;
83
91
  private renderIcon;
@@ -193,6 +193,16 @@ export namespace Components {
193
193
  * @default 'إعادة المحاولة'
194
194
  */
195
195
  "conversationRetryLabel": string;
196
+ /**
197
+ * Hide the conversation-list dropdown trigger (title chevron)
198
+ * @default false
199
+ */
200
+ "disableConversationList": boolean;
201
+ /**
202
+ * Hide the new-chat (pencil-edit) button
203
+ * @default false
204
+ */
205
+ "disableNewChat": boolean;
196
206
  /**
197
207
  * Layout variant
198
208
  * @default 'agent'
@@ -1022,6 +1032,16 @@ declare namespace LocalJSX {
1022
1032
  * @default 'إعادة المحاولة'
1023
1033
  */
1024
1034
  "conversationRetryLabel"?: string;
1035
+ /**
1036
+ * Hide the conversation-list dropdown trigger (title chevron)
1037
+ * @default false
1038
+ */
1039
+ "disableConversationList"?: boolean;
1040
+ /**
1041
+ * Hide the new-chat (pencil-edit) button
1042
+ * @default false
1043
+ */
1044
+ "disableNewChat"?: boolean;
1025
1045
  /**
1026
1046
  * Layout variant
1027
1047
  * @default 'agent'
@@ -1484,6 +1504,8 @@ declare namespace LocalJSX {
1484
1504
  "conversationEmptyText": string;
1485
1505
  "conversationDeletingId": string;
1486
1506
  "titleLoading": boolean;
1507
+ "disableNewChat": boolean;
1508
+ "disableConversationList": boolean;
1487
1509
  }
1488
1510
  interface AiChatMessageAttributes {
1489
1511
  "role": 'user' | 'agent';
@@ -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 s}from"./p-DlD8m3rf.js";const o=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;disableNewChat=!1;disableConversationList=!1;avatarError=!1;dropdownOpen=!1;isFloating=!1;isMobile=!1;parentPositionObserver=null;handleWindowResize=()=>this.checkMobile();closeClick;newChatClick;dropdownClick;positionClick;headerPositionClick;backClick;headerDragStart;openExternal;conversationSelect;conversationDelete;conversationRetry;handleDocumentClick(t){this.dropdownOpen&&!this.el.contains(t.target)&&(this.dropdownOpen=!1)}connectedCallback(){this.checkMobile()}componentDidLoad(){requestAnimationFrame((()=>{this.syncFloatingState(),this.observeParentPosition()})),"undefined"!=typeof window&&window.addEventListener("resize",this.handleWindowResize)}disconnectedCallback(){this.parentPositionObserver?.disconnect(),this.parentPositionObserver=null,"undefined"!=typeof window&&window.removeEventListener("resize",this.handleWindowResize)}checkMobile(){"undefined"!=typeof window&&(this.isMobile=window.innerWidth<768)}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&&!this.isMobile&&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||this.disableConversationList?null: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}))}renderAgentMode(){const t=this.disableConversationList?n("div",{class:"content agent"},this.titleLoading?n("span",{class:"title-skeleton","aria-busy":"true","aria-label":"جاري التحميل"}):n("span",{class:"title"},this.conversation)):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)));return[this.renderDragBtn(),t,n("div",{class:"actions"},!this.disableNewChat&&n("button",{class:"action-btn","aria-label":"محادثة جديدة / New Chat",onClick:()=>this.newChatClick.emit()},this.renderIcon("pencil-edit",22,22)),!this.isMobile&&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"},!this.isMobile&&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"},!this.isMobile&&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:"4c51abf7f5fb572ec62191c0b097a4fdf9b218c3"},n("div",{key:"c05febe2f984bad8e80b9f0d9f2ceeebc812a9b4",class:"header-wrapper"},n("div",{key:"927c606ae5452a9a5c1e19edd2145f9e1ee42d2c",class:"header-container"},"agent"===this.mode?this.renderAgentMode():"human"===this.mode?this.renderHumanMode():this.renderBrowserMode()),this.renderConversationDropdown()))}};o.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{o as ai_chat_header}
@@ -0,0 +1 @@
1
+ import{r as e,c as t,a,h as r,H as i}from"./p-VMEwYfaX.js";const o=class{constructor(a){e(this,a),this.retryClick=t(this,"retryClick"),this.positionChange=t(this,"positionChange")}get el(){return a(this)}isOpen=!1;position="left";width="28rem";autoScroll=!0;showWatermark=!1;floatHeight="600px";theme="light";loading=!1;error=!1;errorText="تعذّر تحميل المحادثة";retryLabel="إعادة المحاولة";direction="rtl";retryClick;positionChange;isMobile=!1;floatLeft="24px";floatTop="24px";containerRef;messagesAreaRef;dragState=null;mutationObserver=null;resizeObserver=null;dragListener=e=>{if("undefined"==typeof window)return;const t=this.containerRef;if(!t)return;const{clientX:a,clientY:r}=e.detail,i=t.getBoundingClientRect();this.dragState={startX:a,startY:r,initLeft:i.left,initTop:i.top},this.floatLeft=`${i.left}px`,this.floatTop=`${i.top}px`;const o=e=>{if(!this.dragState)return;let a=this.dragState.initLeft+(e.clientX-this.dragState.startX),r=this.dragState.initTop+(e.clientY-this.dragState.startY);const i=window.innerWidth,o=window.innerHeight,s=t.offsetHeight;a=Math.max(0,Math.min(a,i-t.offsetWidth)),r=Math.max(0,Math.min(r,o-s)),this.floatLeft=`${a}px`,this.floatTop=`${r}px`},s=()=>{this.dragState=null,document.removeEventListener("pointermove",o),document.removeEventListener("pointerup",s)};document.addEventListener("pointermove",o),document.addEventListener("pointerup",s)};handleHeaderPositionClick(){this.cyclePosition()}componentWillLoad(){this.checkMobile()}componentDidLoad(){"undefined"!=typeof window&&("undefined"!=typeof ResizeObserver&&(this.resizeObserver=new ResizeObserver((()=>{this.checkMobile(),this.clampFloatPosition()})),this.resizeObserver.observe(this.el)),window.addEventListener("resize",this.handleWindowResize),"float"===this.position&&this.setupDrag(),this.mutationObserver=new MutationObserver((()=>{this.autoScroll&&this.messagesAreaRef&&requestAnimationFrame((()=>{this.messagesAreaRef.scrollTop=this.messagesAreaRef.scrollHeight}))})),this.mutationObserver.observe(this.el,{childList:!0,subtree:!0}))}isOpenChanged(e){e&&this.autoScroll&&this.messagesAreaRef&&requestAnimationFrame((()=>{this.messagesAreaRef.scrollTop=this.messagesAreaRef.scrollHeight}))}positionChanged(e){"float"===e&&this.setupDrag(),this.positionChange.emit(e)}disconnectedCallback(){"undefined"!=typeof window&&window.removeEventListener("resize",this.handleWindowResize),this.el.removeEventListener("headerDragStart",this.dragListener),this.mutationObserver?.disconnect(),this.resizeObserver?.disconnect()}async scrollToBottom(){this.messagesAreaRef&&(this.messagesAreaRef.scrollTop=this.messagesAreaRef.scrollHeight)}async cyclePosition(){this.position="float"===this.position?"rtl"===this.direction?"left":"right":"float"}handleWindowResize=()=>{this.checkMobile(),this.clampFloatPosition()};checkMobile(){"undefined"!=typeof window&&(this.isMobile=window.innerWidth<768)}clampFloatPosition(){if("undefined"==typeof window||"float"!==this.position||!this.containerRef)return;const e=window.innerWidth,t=window.innerHeight,a=this.containerRef.offsetWidth,r=this.containerRef.offsetHeight;let i=parseFloat(this.floatLeft)||0,o=parseFloat(this.floatTop)||0;i=Math.max(0,Math.min(i,e-a)),o=Math.max(0,Math.min(o,t-r)),this.floatLeft=`${i}px`,this.floatTop=`${o}px`}setupDrag(){this.el.removeEventListener("headerDragStart",this.dragListener),this.el.addEventListener("headerDragStart",this.dragListener)}getContainerClasses(){const e=["chat-container",this.position];return this.isOpen&&e.push("open"),this.isMobile&&e.push("mobile"),e.join(" ")}getContainerStyle(){const e={};return this.isMobile||("float"===this.position?(e.width=this.width,e.height=this.floatHeight,e.left=this.floatLeft,e.top=this.floatTop):e.width=this.width),e}isDark(){return"dark"===this.theme||"auto"===this.theme&&"undefined"!=typeof window&&window.matchMedia("(prefers-color-scheme: dark)").matches}renderSkeleton(){return r("div",{class:"skeleton-messages","aria-busy":"true","aria-label":"Loading conversation"},r("div",{class:"skeleton-row agent"},r("div",{class:"skeleton-bubble"},r("div",{class:"skeleton-line",style:{width:"80%"}}),r("div",{class:"skeleton-line",style:{width:"60%"}}),r("div",{class:"skeleton-line",style:{width:"40%"}}))),r("div",{class:"skeleton-row user"},r("div",{class:"skeleton-bubble"},r("div",{class:"skeleton-line",style:{width:"70%"}}))),r("div",{class:"skeleton-row agent"},r("div",{class:"skeleton-bubble"},r("div",{class:"skeleton-line",style:{width:"90%"}}),r("div",{class:"skeleton-line",style:{width:"55%"}}))),r("div",{class:"skeleton-row user"},r("div",{class:"skeleton-bubble"},r("div",{class:"skeleton-line",style:{width:"50%"}}),r("div",{class:"skeleton-line",style:{width:"35%"}}))))}renderError(){return r("div",{class:"error-state",role:"alert"},r("svg",{class:"error-icon",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"1.5"}),r("path",{d:"M12 7v6",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"}),r("circle",{cx:"12",cy:"16.5",r:"0.75",fill:"currentColor"})),r("p",{class:"error-text"},this.errorText),r("button",{class:"error-retry-btn",type:"button",onClick:()=>this.retryClick.emit()},this.retryLabel))}render(){return r(i,{key:"1213110dce6a44b37c4a7b1f6a584368951964d2",class:{dark:this.isDark()}},r("div",{key:"df0df824b4ef271aae37dee7aa2fc85037ef647a",class:this.getContainerClasses(),style:this.getContainerStyle(),ref:e=>this.containerRef=e},this.showWatermark&&!this.loading&&!this.error&&r("div",{key:"168fd1510d8910f234331c03d4d549d0a9586472",class:"watermark"},r("svg",{key:"fde35527192a8501b190462bfdf66ae7d739742c",class:"watermark-circle-svg",width:"133",height:"133",viewBox:"0 0 133 133",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r("g",{key:"63c94c35e3adafac862c39cda04d05d75199bae0",filter:"url(#wm_circle_shadow)"},r("circle",{key:"8e8e304ae2132ad36855457a7755b2ba20770038",cx:"66.415",cy:"66.415",r:"66.415",class:"watermark-circle"})),r("defs",{key:"c571edd0fb6a68bf9e62530398ba01e482f5755e"},r("filter",{key:"c63ab4c6c16db9eac63d944c481564af4667f493",id:"wm_circle_shadow",x:"0",y:"0",width:"132.83",height:"135.83",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},r("feFlood",{key:"37105253941532ffc3136713df67e87b9ef123e5","flood-opacity":"0",result:"BackgroundImageFix"}),r("feBlend",{key:"ecde8a14cbc2a11125e548ebe412f00381aa561e",mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feColorMatrix",{key:"1001d9bf46d7df0f8788e46cfb311a90b5984f8d",in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),r("feOffset",{key:"4ffa296814b3eeb49e56688f1d6a981ac7055a92",dy:"3"}),r("feGaussianBlur",{key:"91a6bf8600f4b30c24af6717d61a7549584240f7",stdDeviation:"3"}),r("feComposite",{key:"325b8156a7a3cc8dfa1855d687436d170dc83bbb",in2:"hardAlpha",operator:"arithmetic",k2:"-1",k3:"1"}),r("feColorMatrix",{key:"48da64c927a7c97e21b499576cc8a421445ffd61",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0"}),r("feBlend",{key:"2c3fcf67f6769a6e6cee16ee4f7a6115a2aa3fbc",mode:"normal",in2:"shape",result:"effect1_innerShadow"})))),r("svg",{key:"25669b41c62a83760adb26129d4547ece7d5f6d9",class:"watermark-star-svg",width:"78",height:"78",viewBox:"0 0 78 78",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r("g",{key:"e1347f63fe1b5b57c1be6d4958817c2682745972",filter:"url(#wm_star_shadow)"},r("path",{key:"12ca3bbc4dcca07dbd4cc9e5b0227c2a4b5eeb98",d:"M38.7421 0C39.5691 0 40.2689 0.286272 40.8414 0.858815C41.414 1.43136 41.7002 2.13113 41.7002 2.95814C41.7002 8.87442 43.1952 14.3772 46.1851 19.4665C49.1115 24.4285 53.0557 28.3727 58.0177 31.299C63.107 34.289 68.6097 35.7839 74.526 35.7839C75.353 35.7839 76.0528 36.0702 76.6254 36.6428C77.1979 37.2153 77.4842 37.9151 77.4842 38.7421C77.4842 39.5691 77.1979 40.2689 76.6254 40.8414C76.0528 41.414 75.353 41.7002 74.526 41.7002C68.6097 41.7002 63.107 43.1952 58.0177 46.1851C53.0557 49.1115 49.1115 53.0557 46.1851 58.0177C43.1952 63.107 41.7002 68.6097 41.7002 74.526C41.7002 75.353 41.414 76.0528 40.8414 76.6254C40.2689 77.1979 39.5691 77.4842 38.7421 77.4842C37.9151 77.4842 37.2153 77.1979 36.6428 76.6254C36.0702 76.0528 35.7839 75.353 35.7839 74.526C35.7839 68.6097 34.289 63.107 31.299 58.0177C28.3727 53.0557 24.4285 49.1115 19.4665 46.1851C14.3772 43.1952 8.87442 41.7002 2.95814 41.7002C2.13113 41.7002 1.43136 41.414 0.858815 40.8414C0.286272 40.2689 0 39.5691 0 38.7421C0 37.9151 0.286272 37.2153 0.858815 36.6428C1.43136 36.0702 2.13113 35.7839 2.95814 35.7839C8.87442 35.7839 14.3772 34.289 19.4665 31.299C24.4285 28.3727 28.3727 24.4285 31.299 19.4665C34.289 14.3772 35.7839 8.87442 35.7839 2.95814C35.7839 2.13113 36.0702 1.43136 36.6428 0.858815C37.2153 0.286272 37.9151 0 38.7421 0Z",class:"watermark-star"})),r("defs",{key:"6118bbae343ffc6cdc52df3d2062b63dd655f96d"},r("filter",{key:"ac762ad5983155b7122e4e1466dcaa9230d2ad4f",id:"wm_star_shadow",x:"0",y:"0",width:"77.4844",height:"79.4841",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},r("feFlood",{key:"452561901594c49f607f2a5a0dd149edab297703","flood-opacity":"0",result:"BackgroundImageFix"}),r("feBlend",{key:"bd77b4ec605953eff1b83d63b152f6bc0cf757f9",mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feColorMatrix",{key:"55215acb177fe0a8d7bf454244d1eec0a52657d9",in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),r("feOffset",{key:"2079610df4ddb703dffdb0ba26a83262b28ddb8e",dy:"2"}),r("feGaussianBlur",{key:"b42acf138ed8ed2c51ce3a51eb774f8ccb3932a5",stdDeviation:"2"}),r("feComposite",{key:"6b2439a1f50c1355851333431d1745d864fd4a68",in2:"hardAlpha",operator:"arithmetic",k2:"-1",k3:"1"}),r("feColorMatrix",{key:"da9900a125e3e0df5f3bb383382b949d0c967d9c",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0"}),r("feBlend",{key:"579851be42d902cbd9939df09ba996b11210181f",mode:"normal",in2:"shape",result:"effect1_innerShadow"}))))),r("slot",{key:"e2ef3a4097ff512ac2e9638fef4725b55cd4ea24",name:"header"}),r("div",{key:"46dac73e46b2eac797c88ed826497e4d6063f2d3",class:"messages-area",ref:e=>this.messagesAreaRef=e},this.loading?this.renderSkeleton():this.error?this.renderError():r("slot",null)),r("slot",{key:"ff2cf3628bbab90bd0cdce07df6c08ae597867ba",name:"footer"})))}static get watchers(){return{isOpen:[{isOpenChanged:0}],position:[{positionChanged:0}]}}};o.style=":host{display:contents}.chat-container{font-family:var(--ai-font-family);display:flex;flex-direction:column;overflow:hidden;position:relative;background-color:var(--ai-container-bg, var(--ai-bg-card));border:1px solid var(--ai-border-default);z-index:50;box-sizing:border-box}.messages-area{flex:1;overflow-y:auto;min-height:0;scrollbar-width:thin;padding:var(--ai-spacing-2xl, 16px);scrollbar-color:var(--ai-scrollbar-thumb) transparent}.messages-area::-webkit-scrollbar{width:3px}.messages-area::-webkit-scrollbar-track{background:transparent}.messages-area::-webkit-scrollbar-thumb{background:var(--ai-scrollbar-thumb);border-radius:99px}.messages-area::-webkit-scrollbar-thumb:hover{background:var(--ai-scrollbar-thumb-hover)}.chat-container.left,.chat-container.right{position:fixed;top:0;bottom:0;transition:transform 300ms cubic-bezier(0.4, 0, 0.2, 1)}.chat-container.left{left:0;transform:translateX(-100%)}.chat-container.right{right:0;transform:translateX(100%)}.chat-container.left.open,.chat-container.right.open{transform:translateX(0)}.chat-container.float{position:fixed;border-radius:16px;box-shadow:var(--ai-shadow-float);opacity:0;pointer-events:none;transform:scale(0.95);transform-origin:bottom left;transition:opacity 200ms ease, transform 200ms ease}.chat-container.float.open{opacity:1;pointer-events:auto;transform:scale(1)}.watermark{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);pointer-events:none;width:133px;height:133px}.watermark .watermark-circle-svg{position:absolute;top:0;left:0}.watermark .watermark-star-svg{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}.watermark .watermark-circle{fill:var(--ai-watermark-circle, #FCFCFC)}.watermark .watermark-star{fill:var(--ai-watermark-star, #FAFAFA)}:host(.dark) .watermark .watermark-circle{fill:var(--ai-watermark-circle, #222222)}:host(.dark) .watermark .watermark-star{fill:var(--ai-watermark-star, #292B2C)}.chat-container.mobile{width:100% !important}.chat-container.float.mobile{left:0 !important;right:0 !important;top:0 !important;bottom:0 !important;height:100% !important;border-radius:0 !important}@media (max-width: 767px){.chat-container{width:100% !important}.chat-container.float{left:0 !important;right:0 !important;top:0 !important;bottom:0 !important;height:100% !important;border-radius:0 !important}}@keyframes skeleton-shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}.skeleton-messages{display:flex;flex-direction:column;gap:20px;padding:8px 0}.skeleton-row{display:flex;align-items:flex-start;gap:10px}.skeleton-row.agent{flex-direction:row}.skeleton-row.user{flex-direction:row-reverse}.skeleton-avatar{width:32px;height:32px;min-width:32px;border-radius:50%;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:skeleton-shimmer 1.6s ease-in-out infinite}.skeleton-bubble{display:flex;flex-direction:column;gap:8px;padding:14px 16px;border-radius:16px;background-color:var(--ai-bg-surface, #f9fafb);max-width:75%;min-width:120px}.skeleton-row.user .skeleton-bubble{background-color:var(--ai-user-bubble-bg, var(--ai-accent, #004956));border-radius:16px}.skeleton-line{height:12px;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:skeleton-shimmer 1.6s ease-in-out infinite}.skeleton-row.user .skeleton-line{background:linear-gradient(90deg, rgba(255,255,255,0.08) 25%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.08) 75%);background-size:200% 100%;animation:skeleton-shimmer 1.6s ease-in-out infinite}:host(.dark) .skeleton-avatar{background:var(--ai-shimmer-gradient, linear-gradient(90deg, rgba(255,255,255,0.06) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.06) 75%));background-size:200% 100%;animation:skeleton-shimmer 1.6s ease-in-out infinite}:host(.dark) .skeleton-bubble{background-color:var(--ai-bg-surface, #1f2937)}:host(.dark) .skeleton-line{background:var(--ai-shimmer-gradient, linear-gradient(90deg, rgba(255,255,255,0.06) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.06) 75%));background-size:200% 100%;animation:skeleton-shimmer 1.6s ease-in-out infinite}.error-state{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:12px;padding:48px 24px;flex:1}.error-icon{color:var(--ai-text-muted, #9ca3af);opacity:0.7}.error-text{margin:0;font-size:14px;line-height:1.5;color:var(--ai-text-secondary, #6b7280)}.error-retry-btn{display:inline-flex;align-items:center;justify-content:center;padding:8px 20px;border-radius:9999px;border:1px solid var(--ai-border-default);background-color:var(--ai-bg-surface, #f9fafb);color:var(--ai-text-primary);font-size:13px;font-weight:500;font-family:inherit;cursor:pointer;transition:background-color 0.15s ease, border-color 0.15s ease}.error-retry-btn:hover{background-color:var(--ai-hover-overlay, rgba(0, 0, 0, 0.04));border-color:var(--ai-accent, #004956)}.error-retry-btn:focus-visible{outline:2px solid var(--ai-focus-ring-color, var(--ai-focus-ring));outline-offset:2px}:host(.dark) .error-retry-btn{background-color:var(--ai-bg-surface, #1f2937);color:var(--ai-text-primary, #f9fafb)}:host(.dark) .error-retry-btn:hover{background-color:var(--ai-hover-overlay, rgba(255, 255, 255, 0.06))}";export{o as ai_chat_container}
@@ -1 +1 @@
1
- import{p as e,g as a,b as t}from"./p-VMEwYfaX.js";export{s as setNonce}from"./p-VMEwYfaX.js";(()=>{const a=import.meta.url,t={};return""!==a&&(t.resourcesUrl=new URL(".",a).href),e(t)})().then((async e=>(await a(),t([["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-efb68380",[[513,"ai-rating",{question:[1],subtitle:[1],successMessage:[1,"success-message"],value:[1026],disabled:[4],hovered:[32],submitted:[32]}]]],["p-2fd7529e",[[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-8b1d056d",[[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-11c960d8",[[769,"ai-conversation-summary",{conversation:[1],summary:[1],messageCount:[2,"message-count"],language:[1]}]]],["p-79309690",[[513,"ai-in-chat-browser",{url:[1],pageTitle:[1,"page-title"],isLoading:[32],hasError:[32]},null,{url:[{onUrlChange:0}]}]]],["p-e1a2a622",[[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-9a8614d0",[[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-9af03dbd",[[769,"ai-suggestion",{label:[1],disabled:[4]}]]],["p-a5f53c8c",[[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-cde479ea",[[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))));
1
+ import{p as e,g as a,b as t}from"./p-VMEwYfaX.js";export{s as setNonce}from"./p-VMEwYfaX.js";(()=>{const a=import.meta.url,t={};return""!==a&&(t.resourcesUrl=new URL(".",a).href),e(t)})().then((async e=>(await a(),t([["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-efb68380",[[513,"ai-rating",{question:[1],subtitle:[1],successMessage:[1,"success-message"],value:[1026],disabled:[4],hovered:[32],submitted:[32]}]]],["p-3007f89b",[[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"],disableNewChat:[4,"disable-new-chat"],disableConversationList:[4,"disable-conversation-list"],avatarError:[32],dropdownOpen:[32],isFloating:[32],isMobile:[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-f645c832",[[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-8b1d056d",[[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-11c960d8",[[769,"ai-conversation-summary",{conversation:[1],summary:[1],messageCount:[2,"message-count"],language:[1]}]]],["p-79309690",[[513,"ai-in-chat-browser",{url:[1],pageTitle:[1,"page-title"],isLoading:[32],hasError:[32]},null,{url:[{onUrlChange:0}]}]]],["p-e1a2a622",[[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-9a8614d0",[[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-9af03dbd",[[769,"ai-suggestion",{label:[1],disabled:[4]}]]],["p-a5f53c8c",[[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-cde479ea",[[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,6 +1,6 @@
1
1
  {
2
2
  "name": "@salla.sa/ui-ai-kit-core",
3
- "version": "2.2.4",
3
+ "version": "2.2.5",
4
4
  "main": "dist/index.cjs.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -1 +0,0 @@
1
- import{r as e,c as t,a,h as r,H as i}from"./p-VMEwYfaX.js";const o=class{constructor(a){e(this,a),this.retryClick=t(this,"retryClick"),this.positionChange=t(this,"positionChange")}get el(){return a(this)}isOpen=!1;position="left";width="28rem";autoScroll=!0;showWatermark=!1;floatHeight="600px";theme="light";loading=!1;error=!1;errorText="تعذّر تحميل المحادثة";retryLabel="إعادة المحاولة";direction="rtl";retryClick;positionChange;isMobile=!1;floatLeft="24px";floatTop="24px";containerRef;messagesAreaRef;dragState=null;mutationObserver=null;resizeObserver=null;dragListener=e=>{if("undefined"==typeof window)return;const t=this.containerRef;if(!t)return;const{clientX:a,clientY:r}=e.detail,i=t.getBoundingClientRect();this.dragState={startX:a,startY:r,initLeft:i.left,initTop:i.top},this.floatLeft=`${i.left}px`,this.floatTop=`${i.top}px`;const o=e=>{if(!this.dragState)return;let a=this.dragState.initLeft+(e.clientX-this.dragState.startX),r=this.dragState.initTop+(e.clientY-this.dragState.startY);const i=window.innerWidth,o=window.innerHeight,s=t.offsetHeight;a=Math.max(0,Math.min(a,i-t.offsetWidth)),r=Math.max(0,Math.min(r,o-s)),this.floatLeft=`${a}px`,this.floatTop=`${r}px`},s=()=>{this.dragState=null,document.removeEventListener("pointermove",o),document.removeEventListener("pointerup",s)};document.addEventListener("pointermove",o),document.addEventListener("pointerup",s)};handleHeaderPositionClick(){this.cyclePosition()}componentWillLoad(){this.checkMobile()}componentDidLoad(){"undefined"!=typeof window&&("undefined"!=typeof ResizeObserver&&(this.resizeObserver=new ResizeObserver((()=>{this.checkMobile(),this.clampFloatPosition()})),this.resizeObserver.observe(this.el)),window.addEventListener("resize",this.handleWindowResize),"float"===this.position&&this.setupDrag(),this.mutationObserver=new MutationObserver((()=>{this.autoScroll&&this.messagesAreaRef&&requestAnimationFrame((()=>{this.messagesAreaRef.scrollTop=this.messagesAreaRef.scrollHeight}))})),this.mutationObserver.observe(this.el,{childList:!0,subtree:!0}))}isOpenChanged(e){e&&this.autoScroll&&this.messagesAreaRef&&requestAnimationFrame((()=>{this.messagesAreaRef.scrollTop=this.messagesAreaRef.scrollHeight}))}positionChanged(e){"float"===e&&this.setupDrag()}disconnectedCallback(){"undefined"!=typeof window&&window.removeEventListener("resize",this.handleWindowResize),this.el.removeEventListener("headerDragStart",this.dragListener),this.mutationObserver?.disconnect(),this.resizeObserver?.disconnect()}async scrollToBottom(){this.messagesAreaRef&&(this.messagesAreaRef.scrollTop=this.messagesAreaRef.scrollHeight)}async cyclePosition(){this.position="float"===this.position?"rtl"===this.direction?"left":"right":"float",this.positionChange.emit(this.position)}handleWindowResize=()=>{this.checkMobile(),this.clampFloatPosition()};checkMobile(){"undefined"!=typeof window&&(this.isMobile=window.innerWidth<768)}clampFloatPosition(){if("undefined"==typeof window||"float"!==this.position||!this.containerRef)return;const e=window.innerWidth,t=window.innerHeight,a=this.containerRef.offsetWidth,r=this.containerRef.offsetHeight;let i=parseFloat(this.floatLeft)||0,o=parseFloat(this.floatTop)||0;i=Math.max(0,Math.min(i,e-a)),o=Math.max(0,Math.min(o,t-r)),this.floatLeft=`${i}px`,this.floatTop=`${o}px`}setupDrag(){this.el.removeEventListener("headerDragStart",this.dragListener),this.el.addEventListener("headerDragStart",this.dragListener)}getContainerClasses(){const e=["chat-container",this.position];return this.isOpen&&e.push("open"),this.isMobile&&e.push("mobile"),e.join(" ")}getContainerStyle(){const e={};return this.isMobile||("float"===this.position?(e.width=this.width,e.height=this.floatHeight,e.left=this.floatLeft,e.top=this.floatTop):e.width=this.width),e}isDark(){return"dark"===this.theme||"auto"===this.theme&&"undefined"!=typeof window&&window.matchMedia("(prefers-color-scheme: dark)").matches}renderSkeleton(){return r("div",{class:"skeleton-messages","aria-busy":"true","aria-label":"Loading conversation"},r("div",{class:"skeleton-row agent"},r("div",{class:"skeleton-bubble"},r("div",{class:"skeleton-line",style:{width:"80%"}}),r("div",{class:"skeleton-line",style:{width:"60%"}}),r("div",{class:"skeleton-line",style:{width:"40%"}}))),r("div",{class:"skeleton-row user"},r("div",{class:"skeleton-bubble"},r("div",{class:"skeleton-line",style:{width:"70%"}}))),r("div",{class:"skeleton-row agent"},r("div",{class:"skeleton-bubble"},r("div",{class:"skeleton-line",style:{width:"90%"}}),r("div",{class:"skeleton-line",style:{width:"55%"}}))),r("div",{class:"skeleton-row user"},r("div",{class:"skeleton-bubble"},r("div",{class:"skeleton-line",style:{width:"50%"}}),r("div",{class:"skeleton-line",style:{width:"35%"}}))))}renderError(){return r("div",{class:"error-state",role:"alert"},r("svg",{class:"error-icon",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"1.5"}),r("path",{d:"M12 7v6",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"}),r("circle",{cx:"12",cy:"16.5",r:"0.75",fill:"currentColor"})),r("p",{class:"error-text"},this.errorText),r("button",{class:"error-retry-btn",type:"button",onClick:()=>this.retryClick.emit()},this.retryLabel))}render(){return r(i,{key:"6290736307488f10a4ed441e2a8e0b3a2e89af05",class:{dark:this.isDark()}},r("div",{key:"6d6a731d9941457b786c71625243a7dd1e9f11f8",class:this.getContainerClasses(),style:this.getContainerStyle(),ref:e=>this.containerRef=e},this.showWatermark&&!this.loading&&!this.error&&r("div",{key:"0c2ae5b52f8c30bdf356a3c356d52305451cb19e",class:"watermark"},r("svg",{key:"36076d8dd514f5736050228d22b9a03d5d48ce28",class:"watermark-circle-svg",width:"133",height:"133",viewBox:"0 0 133 133",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r("g",{key:"737a3f3d8b7a0f91120258c292d047f9dc90871c",filter:"url(#wm_circle_shadow)"},r("circle",{key:"a59549c879ddaa2a0007c4fd9645c4382b14e73f",cx:"66.415",cy:"66.415",r:"66.415",class:"watermark-circle"})),r("defs",{key:"58d5edc4e05f3dd8a60f7a829b70f154ba85bfc1"},r("filter",{key:"d2cb7cb5a84bdf1496b56ec5a0c0c79001040670",id:"wm_circle_shadow",x:"0",y:"0",width:"132.83",height:"135.83",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},r("feFlood",{key:"e90404f557fba552a21bd3748ad728470172040f","flood-opacity":"0",result:"BackgroundImageFix"}),r("feBlend",{key:"ef5aee167a4973c35f8ffaa8ae4a0487de8266ee",mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feColorMatrix",{key:"e0869202bc43610b91abce92e85e8e5264cda999",in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),r("feOffset",{key:"7bef38d885b93711fce4c0efbb719a83417eeefb",dy:"3"}),r("feGaussianBlur",{key:"053de38388f049be8db7867b99b53d403de934ca",stdDeviation:"3"}),r("feComposite",{key:"e5f68fbcf0923174a177545bf3364d066a122347",in2:"hardAlpha",operator:"arithmetic",k2:"-1",k3:"1"}),r("feColorMatrix",{key:"62dc924cbdc92ce4adc0ec81be851c1d40e7a5b0",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0"}),r("feBlend",{key:"908299725f9e553c636bd18eab6541c6a7c69fe5",mode:"normal",in2:"shape",result:"effect1_innerShadow"})))),r("svg",{key:"2a6ce2364bfd667c4eba56d859a1326f70a82901",class:"watermark-star-svg",width:"78",height:"78",viewBox:"0 0 78 78",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r("g",{key:"e2c431ac6bee320c817a7283e6e356edc4667146",filter:"url(#wm_star_shadow)"},r("path",{key:"d87d0313e649527f5909ac1b08f7af2979760d79",d:"M38.7421 0C39.5691 0 40.2689 0.286272 40.8414 0.858815C41.414 1.43136 41.7002 2.13113 41.7002 2.95814C41.7002 8.87442 43.1952 14.3772 46.1851 19.4665C49.1115 24.4285 53.0557 28.3727 58.0177 31.299C63.107 34.289 68.6097 35.7839 74.526 35.7839C75.353 35.7839 76.0528 36.0702 76.6254 36.6428C77.1979 37.2153 77.4842 37.9151 77.4842 38.7421C77.4842 39.5691 77.1979 40.2689 76.6254 40.8414C76.0528 41.414 75.353 41.7002 74.526 41.7002C68.6097 41.7002 63.107 43.1952 58.0177 46.1851C53.0557 49.1115 49.1115 53.0557 46.1851 58.0177C43.1952 63.107 41.7002 68.6097 41.7002 74.526C41.7002 75.353 41.414 76.0528 40.8414 76.6254C40.2689 77.1979 39.5691 77.4842 38.7421 77.4842C37.9151 77.4842 37.2153 77.1979 36.6428 76.6254C36.0702 76.0528 35.7839 75.353 35.7839 74.526C35.7839 68.6097 34.289 63.107 31.299 58.0177C28.3727 53.0557 24.4285 49.1115 19.4665 46.1851C14.3772 43.1952 8.87442 41.7002 2.95814 41.7002C2.13113 41.7002 1.43136 41.414 0.858815 40.8414C0.286272 40.2689 0 39.5691 0 38.7421C0 37.9151 0.286272 37.2153 0.858815 36.6428C1.43136 36.0702 2.13113 35.7839 2.95814 35.7839C8.87442 35.7839 14.3772 34.289 19.4665 31.299C24.4285 28.3727 28.3727 24.4285 31.299 19.4665C34.289 14.3772 35.7839 8.87442 35.7839 2.95814C35.7839 2.13113 36.0702 1.43136 36.6428 0.858815C37.2153 0.286272 37.9151 0 38.7421 0Z",class:"watermark-star"})),r("defs",{key:"51e7ef185399e3a10d0b19eb399500be3e5384f8"},r("filter",{key:"09f52cd1b7084a8af9488bbce05c277fe07012f9",id:"wm_star_shadow",x:"0",y:"0",width:"77.4844",height:"79.4841",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},r("feFlood",{key:"1b055616d714f824dd38a895a5c1a635fefc4a66","flood-opacity":"0",result:"BackgroundImageFix"}),r("feBlend",{key:"044cba9d32d0a1d56fc39d318dfc1cdd0fdc0ae7",mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feColorMatrix",{key:"4bf50b36bd6b1ae90d29a95290762ef52dbfff7a",in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),r("feOffset",{key:"0988514af2fda03cb2ff43e95c1423137351186f",dy:"2"}),r("feGaussianBlur",{key:"c96fb451b890e9bda84043dcd699c2a3f59c195c",stdDeviation:"2"}),r("feComposite",{key:"77b2bb3e01eefb08cac5f60a494c2cd15e97db4a",in2:"hardAlpha",operator:"arithmetic",k2:"-1",k3:"1"}),r("feColorMatrix",{key:"aef785066c732cc5cbc16689f2e57a7df7d18bc5",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0"}),r("feBlend",{key:"292a1d370d268312514f1c8fcee2167159c2d4e9",mode:"normal",in2:"shape",result:"effect1_innerShadow"}))))),r("slot",{key:"009fd561884a5a70e559d865dc1b1d55937d923c",name:"header"}),r("div",{key:"fde5090720cd70c2b5fe72bcaec95007e7792f4e",class:"messages-area",ref:e=>this.messagesAreaRef=e},this.loading?this.renderSkeleton():this.error?this.renderError():r("slot",null)),r("slot",{key:"838ea2de9f788af2af70568a7882a08645c6b2ac",name:"footer"})))}static get watchers(){return{isOpen:[{isOpenChanged:0}],position:[{positionChanged:0}]}}};o.style=":host{display:contents}.chat-container{font-family:var(--ai-font-family);display:flex;flex-direction:column;overflow:hidden;position:relative;background-color:var(--ai-container-bg, var(--ai-bg-card));border:1px solid var(--ai-border-default);z-index:50;box-sizing:border-box}.messages-area{flex:1;overflow-y:auto;min-height:0;scrollbar-width:thin;padding:var(--ai-spacing-2xl, 16px);scrollbar-color:var(--ai-scrollbar-thumb) transparent}.messages-area::-webkit-scrollbar{width:3px}.messages-area::-webkit-scrollbar-track{background:transparent}.messages-area::-webkit-scrollbar-thumb{background:var(--ai-scrollbar-thumb);border-radius:99px}.messages-area::-webkit-scrollbar-thumb:hover{background:var(--ai-scrollbar-thumb-hover)}.chat-container.left,.chat-container.right{position:fixed;top:0;bottom:0;transition:transform 300ms cubic-bezier(0.4, 0, 0.2, 1)}.chat-container.left{left:0;transform:translateX(-100%)}.chat-container.right{right:0;transform:translateX(100%)}.chat-container.left.open,.chat-container.right.open{transform:translateX(0)}.chat-container.float{position:fixed;border-radius:16px;box-shadow:var(--ai-shadow-float);opacity:0;pointer-events:none;transform:scale(0.95);transform-origin:bottom left;transition:opacity 200ms ease, transform 200ms ease}.chat-container.float.open{opacity:1;pointer-events:auto;transform:scale(1)}.watermark{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);pointer-events:none;width:133px;height:133px}.watermark .watermark-circle-svg{position:absolute;top:0;left:0}.watermark .watermark-star-svg{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}.watermark .watermark-circle{fill:var(--ai-watermark-circle, #FCFCFC)}.watermark .watermark-star{fill:var(--ai-watermark-star, #FAFAFA)}:host(.dark) .watermark .watermark-circle{fill:var(--ai-watermark-circle, #222222)}:host(.dark) .watermark .watermark-star{fill:var(--ai-watermark-star, #292B2C)}.chat-container.mobile{width:100% !important}.chat-container.float.mobile{left:0 !important;right:0 !important;top:0 !important;bottom:0 !important;height:100% !important;border-radius:0 !important}@media (max-width: 767px){.chat-container{width:100% !important}.chat-container.float{left:0 !important;right:0 !important;top:0 !important;bottom:0 !important;height:100% !important;border-radius:0 !important}}@keyframes skeleton-shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}.skeleton-messages{display:flex;flex-direction:column;gap:20px;padding:8px 0}.skeleton-row{display:flex;align-items:flex-start;gap:10px}.skeleton-row.agent{flex-direction:row}.skeleton-row.user{flex-direction:row-reverse}.skeleton-avatar{width:32px;height:32px;min-width:32px;border-radius:50%;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:skeleton-shimmer 1.6s ease-in-out infinite}.skeleton-bubble{display:flex;flex-direction:column;gap:8px;padding:14px 16px;border-radius:16px;background-color:var(--ai-bg-surface, #f9fafb);max-width:75%;min-width:120px}.skeleton-row.user .skeleton-bubble{background-color:var(--ai-user-bubble-bg, var(--ai-accent, #004956));border-radius:16px}.skeleton-line{height:12px;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:skeleton-shimmer 1.6s ease-in-out infinite}.skeleton-row.user .skeleton-line{background:linear-gradient(90deg, rgba(255,255,255,0.08) 25%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.08) 75%);background-size:200% 100%;animation:skeleton-shimmer 1.6s ease-in-out infinite}:host(.dark) .skeleton-avatar{background:var(--ai-shimmer-gradient, linear-gradient(90deg, rgba(255,255,255,0.06) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.06) 75%));background-size:200% 100%;animation:skeleton-shimmer 1.6s ease-in-out infinite}:host(.dark) .skeleton-bubble{background-color:var(--ai-bg-surface, #1f2937)}:host(.dark) .skeleton-line{background:var(--ai-shimmer-gradient, linear-gradient(90deg, rgba(255,255,255,0.06) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.06) 75%));background-size:200% 100%;animation:skeleton-shimmer 1.6s ease-in-out infinite}.error-state{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:12px;padding:48px 24px;flex:1}.error-icon{color:var(--ai-text-muted, #9ca3af);opacity:0.7}.error-text{margin:0;font-size:14px;line-height:1.5;color:var(--ai-text-secondary, #6b7280)}.error-retry-btn{display:inline-flex;align-items:center;justify-content:center;padding:8px 20px;border-radius:9999px;border:1px solid var(--ai-border-default);background-color:var(--ai-bg-surface, #f9fafb);color:var(--ai-text-primary);font-size:13px;font-weight:500;font-family:inherit;cursor:pointer;transition:background-color 0.15s ease, border-color 0.15s ease}.error-retry-btn:hover{background-color:var(--ai-hover-overlay, rgba(0, 0, 0, 0.04));border-color:var(--ai-accent, #004956)}.error-retry-btn:focus-visible{outline:2px solid var(--ai-focus-ring-color, var(--ai-focus-ring));outline-offset:2px}:host(.dark) .error-retry-btn{background-color:var(--ai-bg-surface, #1f2937);color:var(--ai-text-primary, #f9fafb)}:host(.dark) .error-retry-btn:hover{background-color:var(--ai-hover-overlay, rgba(255, 255, 255, 0.06))}";export{o as ai_chat_container}
@@ -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"),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 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)};handleConversationRetry=t=>{t.stopPropagation(),this.conversationRetry.emit()};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,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(),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:"80236bfcbfac98d3efa3955f03aab4ef68c9cfea"},a("div",{key:"dcc4142bba1d5f07782dbc7b0a3ec287e0154223",class:"header-wrapper"},a("div",{key:"ca0ff9a2946cead0b86cb82390624894ed414378",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}