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

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.
@@ -1389,7 +1389,7 @@ function createDOMPurify() {
1389
1389
  }
1390
1390
  var purify = createDOMPurify();
1391
1391
 
1392
- const aiChatMessageCss = () => `:host{--ai-msg-user-bg:var(--ai-user-bubble-bg);--ai-msg-user-border:1px solid var(--ai-border-default);--ai-msg-agent-bg:var(--ai-agent-bubble-bg);--ai-msg-agent-border:1px solid var(--ai-border-default);--ai-msg-border-radius:16px;--ai-msg-padding:16px;--ai-msg-font-size:14px;--ai-msg-action-active-bg:var(--ai-accent);--ai-user-msg-max-width:80%;--ai-agent-msg-max-width:80%;display:block}.message-row{display:flex}.user-row{flex-direction:column;align-items:flex-end}.user-bubble{background:var(--ai-msg-user-bg);color:var(--ai-text-primary);border:var(--ai-msg-user-border);border-radius:var(--ai-msg-border-radius);padding:var(--ai-msg-padding);font-size:var(--ai-msg-font-size);max-width:var(--ai-user-msg-max-width);line-height:1.5;word-break:break-word;box-shadow:var(--ai-shadow-sm)}.user-row .timestamp{font-size:12px;color:var(--ai-text-secondary);margin-top:4px}.agent-row{flex-direction:row;justify-content:flex-start}.agent-bubble-wrapper{display:flex;flex-direction:column;gap:6px;width:100%;max-width:var(--ai-msg-agent-max-width);min-width:0}.agent-bubble{background:var(--ai-msg-agent-bg);color:var(--ai-text-primary);border:var(--ai-msg-agent-border);border-radius:var(--ai-msg-border-radius);padding:var(--ai-msg-padding);font-size:var(--ai-msg-font-size);line-height:1.6;word-break:break-word;box-shadow:var(--ai-shadow-sm);display:flex;flex-direction:column;gap:12px}.message-content{white-space:pre-wrap}.message-content p{margin:0 0 8px 0}.message-content p:last-child{margin-bottom:0}.message-content h2{font-size:16px;font-weight:700;margin:0 0 8px 0}.message-content h3{font-size:15px;font-weight:600;margin:0 0 6px 0}.message-content strong{font-weight:700}.message-content em{font-style:italic}.message-content code{background:var(--ai-bg-surface);border-radius:4px;padding:1px 5px;font-family:var(--ai-font-family-mono);font-size:13px;color:var(--ai-text-primary)}.message-content pre{background:var(--ai-bg-surface);border-radius:8px;padding:10px 12px;overflow-x:auto;margin:8px 0}.message-content pre code{background:none;padding:0;font-size:13px}.message-content ul,.message-content ol{padding-inline-start:20px;margin:4px 0 8px 0}.message-content li{margin-bottom:3px}.actions-bar{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:6px;height:0;overflow:hidden;opacity:0;pointer-events:none;transition:height 0.15s ease, opacity 0.15s ease}.agent-bubble:hover .actions-bar{height:32px;opacity:1;pointer-events:auto}.action-btn{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:8px;background:var(--ai-bg-card);border:1px solid var(--ai-border-default);cursor:pointer;color:var(--ai-text-primary);transition:background 0.15s, color 0.15s;padding:0;flex-shrink:0}.action-btn:hover{background:var(--ai-bg-surface)}.action-btn.copy-success{background:var(--ai-msg-action-active-bg);color:var(--ai-accent-text);border-color:var(--ai-accent)}.feedback-group{display:flex;align-items:center;border:1px solid var(--ai-border-default);border-radius:8px;overflow:hidden;background:var(--ai-bg-card)}.feedback-btn{display:flex;align-items:center;justify-content:center;height:32px;padding:0 8px;background:var(--ai-bg-card);border:none;border-inline-start:1px solid var(--ai-border-default);cursor:pointer;color:var(--ai-text-primary);transition:background 0.15s, color 0.15s}.feedback-btn:first-child{border-inline-start:none}.feedback-btn:hover{background:var(--ai-bg-surface)}.feedback-btn.active{background:var(--ai-msg-action-active-bg);color:var(--ai-accent-text)}.icon-wrap{display:flex;align-items:center;justify-content:center;line-height:0}.agent-info{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:6px;color:var(--ai-text-muted)}.agent-info-name,.agent-info-time{font-size:12px;color:inherit;line-height:16px;white-space:nowrap}.agent-info .icon-wrap{display:flex;align-items:center;color:inherit;opacity:0.6;flex-shrink:0}.typing-indicator{display:flex;align-items:center;gap:5px;padding:4px 2px}.typing-dot{width:8px;height:8px;border-radius:50%;background:var(--ai-text-muted);animation:typingBounce 1.2s ease-in-out infinite}.typing-dot:nth-child(2){animation-delay:0.2s}.typing-dot:nth-child(3){animation-delay:0.4s}@keyframes typingBounce{0%,60%,100%{transform:translateY(0)}30%{transform:translateY(-6px)}}.streaming-cursor{display:inline-block;width:2px;height:1em;background:currentColor;vertical-align:text-bottom;margin-inline-start:2px;animation:cursorBlink 0.8s step-start infinite}@keyframes cursorBlink{0%,100%{opacity:1}50%{opacity:0}}`;
1392
+ const aiChatMessageCss = () => `:host{--ai-msg-user-bg:var(--ai-user-bubble-bg);--ai-msg-user-border:1px solid var(--ai-border-default);--ai-msg-agent-bg:var(--ai-agent-bubble-bg);--ai-msg-agent-border:1px solid var(--ai-border-default);--ai-msg-border-radius:16px;--ai-msg-padding:16px;--ai-msg-font-size:14px;--ai-msg-action-active-bg:var(--ai-accent);--ai-user-msg-max-width:80%;--ai-agent-msg-max-width:80%;display:block}.message-row{display:flex}.user-row{flex-direction:column;align-items:flex-end}.user-bubble{background:var(--ai-msg-user-bg);color:var(--ai-text-primary);border:var(--ai-msg-user-border);border-radius:var(--ai-msg-border-radius);padding:var(--ai-msg-padding);font-size:var(--ai-msg-font-size);max-width:var(--ai-user-msg-max-width);line-height:1.5;word-break:break-word;box-shadow:var(--ai-shadow-sm)}.user-row .timestamp{font-size:12px;color:var(--ai-text-secondary);margin-top:4px}.agent-row{flex-direction:row;justify-content:flex-start}.agent-bubble-wrapper{display:flex;flex-direction:column;gap:6px;width:100%;max-width:var(--ai-msg-agent-max-width);min-width:0}.agent-bubble{background:var(--ai-msg-agent-bg);color:var(--ai-text-primary);border:var(--ai-msg-agent-border);border-radius:var(--ai-msg-border-radius);padding:var(--ai-msg-padding);font-size:var(--ai-msg-font-size);line-height:1.6;word-break:break-word;box-shadow:var(--ai-shadow-sm);display:flex;flex-direction:column;gap:12px}.message-content{white-space:pre-wrap}.message-content p{margin:0 0 8px 0}.message-content p:last-child{margin-bottom:0}.message-content h2{font-size:16px;font-weight:700;margin:0 0 8px 0}.message-content h3{font-size:15px;font-weight:600;margin:0 0 6px 0}.message-content strong{font-weight:700}.message-content em{font-style:italic}.message-content code{background:var(--ai-bg-surface);border-radius:4px;padding:1px 5px;font-family:var(--ai-font-family-mono);font-size:13px;color:var(--ai-text-primary)}.message-content pre{background:var(--ai-bg-surface);border-radius:8px;padding:10px 12px;overflow-x:auto;margin:8px 0}.message-content pre code{background:none;padding:0;font-size:13px}.message-content ul,.message-content ol{padding-inline-start:20px;margin:4px 0 8px 0}.message-content li{margin-bottom:3px}.actions-bar{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:6px;height:32px}.action-btn{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:8px;background:var(--ai-bg-card);border:1px solid var(--ai-border-default);cursor:pointer;color:var(--ai-text-primary);transition:background 0.15s, color 0.15s;padding:0;flex-shrink:0}.action-btn:hover{background:var(--ai-bg-surface)}.action-btn.copy-success{background:var(--ai-msg-action-active-bg);color:var(--ai-accent-text);border-color:var(--ai-accent)}.feedback-group{display:flex;align-items:center;border:1px solid var(--ai-border-default);border-radius:8px;overflow:hidden;background:var(--ai-bg-card)}.feedback-btn{display:flex;align-items:center;justify-content:center;height:32px;padding:0 8px;background:var(--ai-bg-card);border:none;border-inline-start:1px solid var(--ai-border-default);cursor:pointer;color:var(--ai-text-primary);transition:background 0.15s, color 0.15s}.feedback-btn:first-child{border-inline-start:none}.feedback-btn:hover{background:var(--ai-bg-surface)}.feedback-btn.active{background:var(--ai-msg-action-active-bg);color:var(--ai-accent-text)}.icon-wrap{display:flex;align-items:center;justify-content:center;line-height:0}.agent-info{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:6px;color:var(--ai-text-muted)}.agent-info-name,.agent-info-time{font-size:12px;color:inherit;line-height:16px;white-space:nowrap}.agent-info .icon-wrap{display:flex;align-items:center;color:inherit;opacity:0.6;flex-shrink:0}.typing-indicator{display:flex;align-items:center;gap:5px;padding:4px 2px}.typing-dot{width:8px;height:8px;border-radius:50%;background:var(--ai-text-muted);animation:typingBounce 1.2s ease-in-out infinite}.typing-dot:nth-child(2){animation-delay:0.2s}.typing-dot:nth-child(3){animation-delay:0.4s}@keyframes typingBounce{0%,60%,100%{transform:translateY(0)}30%{transform:translateY(-6px)}}.streaming-cursor{display:inline-block;width:2px;height:1em;background:currentColor;vertical-align:text-bottom;margin-inline-start:2px;animation:cursorBlink 0.8s step-start infinite}@keyframes cursorBlink{0%,100%{opacity:1}50%{opacity:0}}`;
1393
1393
 
1394
1394
  const SANITIZE_CONFIG = {
1395
1395
  ALLOWED_TAGS: ['p', 'br', 'strong', 'em', 'del', 'code', 'pre', 'ul', 'ol', 'li', 'h2', 'h3', 'a', 'blockquote', 'table', 'thead', 'tbody', 'tr', 'th', 'td'],
@@ -3,7 +3,7 @@
3
3
  var index = require('./index-Cc05u4ND.js');
4
4
  var iconRegistry = require('./icon-registry-D-m8GW4D.js');
5
5
 
6
- const aiRatingCss = () => `:host{--ai-rating-question-size:16px;--ai-rating-subtitle-size:14px;--ai-rating-gap:8px;--ai-rating-emoji-size:24px;--ai-rating-btn-padding:6px;--ai-rating-btn-border:1px solid var(--ai-border-light);--ai-rating-btn-radius:9999px;--ai-rating-btn-bg-hover:var(--ai-bg-surface);--ai-rating-btn-border-hover:1px solid var(--ai-border-default);--ai-rating-btn-bg-active:var(--ai-warning-bg);--ai-rating-btn-border-active:1px solid var(--ai-warning-border);--ai-rating-btn-shadow-active:var(--ai-shadow-active);--ai-rating-label-size:16px;display:block}.rating{display:flex;flex-direction:column;align-items:center;gap:var(--ai-rating-gap);width:100%}.rating__text{display:flex;flex-direction:column;align-items:center;gap:2px;width:100%;text-align:center}.rating__question{margin:0;font-size:var(--ai-rating-question-size);font-weight:500;line-height:24px;color:var(--ai-text-primary)}.rating__subtitle{margin:0;font-size:var(--ai-rating-subtitle-size);font-weight:400;line-height:20px;color:var(--ai-text-secondary)}.rating__icons{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;flex-wrap:wrap}.emoji-btn{display:inline-flex;align-items:center;justify-content:center;padding:var(--ai-rating-btn-padding);border:var(--ai-rating-btn-border);border-radius:var(--ai-rating-btn-radius);background:transparent;cursor:pointer;transition:background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;outline:none}.emoji-btn:focus-visible{outline:2px solid var(--ai-warning-border);outline-offset:2px}.emoji-btn:hover:not(:disabled),.emoji-btn--hovered{background:var(--ai-rating-btn-bg-hover);border:var(--ai-rating-btn-border-hover);transform:scale(1.1)}.emoji-btn--active{background:var(--ai-rating-btn-bg-active) !important;border:var(--ai-rating-btn-border-active) !important;box-shadow:var(--ai-rating-btn-shadow-active);transform:scale(1.18) !important}.emoji-btn--disabled{opacity:0.45;cursor:not-allowed;pointer-events:none}.emoji-btn__icon{font-size:var(--ai-rating-emoji-size);line-height:1;display:inline-flex;align-items:center;justify-content:center;width:var(--ai-rating-emoji-size);height:var(--ai-rating-emoji-size);pointer-events:none}.rating__hover-label{margin:0;font-size:var(--ai-rating-label-size);font-weight:500;line-height:24px;color:var(--ai-text-primary);text-align:center;width:100%;animation:fadeIn 0.15s ease}.rating--success{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:16px 0;animation:fadeIn 0.2s ease}.rating__success-message{margin:0;font-size:var(--ai-rating-question-size);font-weight:500;line-height:24px;color:var(--ai-text-primary);text-align:center}@keyframes fadeIn{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}`;
6
+ const aiRatingCss = () => `:host{--ai-rating-question-size:16px;--ai-rating-subtitle-size:14px;--ai-rating-gap:8px;--ai-rating-emoji-size:24px;--ai-rating-btn-padding:6px;--ai-rating-btn-border:1px solid var(--ai-border-light);--ai-rating-btn-radius:9999px;--ai-rating-btn-bg-hover:var(--ai-bg-surface);--ai-rating-btn-border-hover:1px solid var(--ai-border-default);--ai-rating-btn-bg-active:var(--ai-warning-bg);--ai-rating-btn-border-active:1px solid var(--ai-warning-border);--ai-rating-btn-shadow-active:var(--ai-shadow-active);--ai-rating-label-size:16px;display:block}.rating{display:flex;flex-direction:column;align-items:center;gap:var(--ai-rating-gap);width:100%}.rating__text{display:flex;flex-direction:column;align-items:center;gap:2px;width:100%;text-align:center}.rating__question{margin:0;font-size:var(--ai-rating-question-size);font-weight:500;line-height:24px;color:var(--ai-text-primary)}.rating__subtitle{margin:0;font-size:var(--ai-rating-subtitle-size);font-weight:400;line-height:20px;color:var(--ai-text-secondary)}.rating__icons{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;flex-wrap:wrap}.emoji-btn{display:inline-flex;align-items:center;justify-content:center;padding:var(--ai-rating-btn-padding);border:var(--ai-rating-btn-border);border-radius:var(--ai-rating-btn-radius);background:transparent;cursor:pointer;transition:background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;outline:none}.emoji-btn:focus-visible{outline:2px solid var(--ai-warning-border);outline-offset:2px}.emoji-btn:hover:not(:disabled),.emoji-btn--hovered{background:var(--ai-rating-btn-bg-hover);border:var(--ai-rating-btn-border-hover);transform:scale(1.1)}.emoji-btn--active{background:var(--ai-rating-btn-bg-active) !important;border:var(--ai-rating-btn-border-active) !important;box-shadow:var(--ai-rating-btn-shadow-active);transform:scale(1.18) !important}.emoji-btn--disabled{opacity:0.45;cursor:not-allowed;pointer-events:none}.emoji-btn__icon{font-size:var(--ai-rating-emoji-size);line-height:1;display:inline-flex;align-items:center;justify-content:center;width:var(--ai-rating-emoji-size);height:var(--ai-rating-emoji-size);pointer-events:none}.rating__hover-label{margin:0;font-size:var(--ai-rating-label-size);font-weight:500;line-height:24px;color:var(--ai-text-primary);text-align:center;width:100%;min-height:24px;opacity:0;visibility:hidden;transition:opacity 0.15s ease, visibility 0.15s ease}.rating__hover-label--visible{opacity:1;visibility:visible}.rating--success{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:16px 0;animation:fadeIn 0.2s ease}.rating__success-message{margin:0;font-size:var(--ai-rating-question-size);font-weight:500;line-height:24px;color:var(--ai-text-primary);text-align:center}@keyframes fadeIn{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}`;
7
7
 
8
8
  const EMOJI_OPTIONS = [
9
9
  { value: 1, icon: 'emoji-angry', label: 'سيئ جداً' },
@@ -47,7 +47,7 @@ const AiRating = class {
47
47
  if (this.submitted) {
48
48
  return (index.h(index.Host, null, index.h("ai-card", null, index.h("div", { class: "rating rating--success" }, index.h("ai-icon", { name: "check-circle", size: 32 }), index.h("p", { class: "rating__success-message" }, this.successMessage)))));
49
49
  }
50
- return (index.h(index.Host, null, index.h("ai-card", null, index.h("div", { class: "rating" }, index.h("div", { class: "rating__text" }, index.h("p", { class: "rating__question" }, this.question), index.h("p", { class: "rating__subtitle" }, this.subtitle)), index.h("div", { class: "rating__icons", role: "group", "aria-label": this.question }, EMOJI_OPTIONS.map(opt => {
50
+ return (index.h(index.Host, null, index.h("ai-card", null, index.h("div", { class: "rating" }, index.h("div", { class: "rating__text" }, index.h("p", { class: "rating__question" }, this.question), index.h("p", { class: "rating__subtitle" }, this.subtitle)), index.h("div", { class: "rating__icons", role: "group", "aria-label": this.question, onMouseLeave: () => (this.hovered = null) }, EMOJI_OPTIONS.map(opt => {
51
51
  const isActive = this.value === opt.value;
52
52
  const isHovered = this.hovered === opt.value;
53
53
  const icon = iconRegistry.iconRegistry[opt.icon];
@@ -56,8 +56,8 @@ const AiRating = class {
56
56
  'emoji-btn--active': isActive,
57
57
  'emoji-btn--hovered': isHovered && !isActive,
58
58
  'emoji-btn--disabled': this.disabled,
59
- }, "aria-label": opt.label, "aria-pressed": isActive ? 'true' : 'false', disabled: this.disabled, onClick: () => this.select(opt.value), onMouseEnter: () => (this.hovered = opt.value), onMouseLeave: () => (this.hovered = null) }, index.h("span", { class: "emoji-btn__icon", "aria-hidden": "true" }, index.h("svg", { width: 24, height: 24, viewBox: icon.viewBox, xmlns: "http://www.w3.org/2000/svg", ref: (el) => el && (el.innerHTML = icon.content) }))));
60
- })), label && index.h("p", { class: "rating__hover-label" }, label)))));
59
+ }, "aria-label": opt.label, "aria-pressed": isActive ? 'true' : 'false', disabled: this.disabled, onClick: () => this.select(opt.value), onMouseEnter: () => (this.hovered = opt.value) }, index.h("span", { class: "emoji-btn__icon", "aria-hidden": "true" }, index.h("svg", { width: 24, height: 24, viewBox: icon.viewBox, xmlns: "http://www.w3.org/2000/svg", ref: (el) => el && (el.innerHTML = icon.content) }))));
60
+ })), index.h("p", { class: { 'rating__hover-label': true, 'rating__hover-label--visible': label !== null } }, label ?? '\u00A0')))));
61
61
  }
62
62
  };
63
63
  AiRating.style = aiRatingCss();
@@ -149,17 +149,7 @@
149
149
  align-items: center;
150
150
  justify-content: flex-start;
151
151
  gap: 6px;
152
- height: 0;
153
- overflow: hidden;
154
- opacity: 0;
155
- pointer-events: none;
156
- transition: height 0.15s ease, opacity 0.15s ease;
157
- }
158
-
159
- .agent-bubble:hover .actions-bar {
160
152
  height: 32px;
161
- opacity: 1;
162
- pointer-events: auto;
163
153
  }
164
154
 
165
155
  .action-btn {
@@ -130,7 +130,15 @@
130
130
  color: var(--ai-text-primary);
131
131
  text-align: center;
132
132
  width: 100%;
133
- animation: fadeIn 0.15s ease;
133
+ min-height: 24px;
134
+ opacity: 0;
135
+ visibility: hidden;
136
+ transition: opacity 0.15s ease, visibility 0.15s ease;
137
+ }
138
+
139
+ .rating__hover-label--visible {
140
+ opacity: 1;
141
+ visibility: visible;
134
142
  }
135
143
 
136
144
  /* ─── Success state ──────────────────────────────────────────────────────── */
@@ -38,7 +38,7 @@ export class AiRating {
38
38
  if (this.submitted) {
39
39
  return (h(Host, null, h("ai-card", null, h("div", { class: "rating rating--success" }, h("ai-icon", { name: "check-circle", size: 32 }), h("p", { class: "rating__success-message" }, this.successMessage)))));
40
40
  }
41
- return (h(Host, null, h("ai-card", null, h("div", { class: "rating" }, h("div", { class: "rating__text" }, h("p", { class: "rating__question" }, this.question), h("p", { class: "rating__subtitle" }, this.subtitle)), h("div", { class: "rating__icons", role: "group", "aria-label": this.question }, EMOJI_OPTIONS.map(opt => {
41
+ return (h(Host, null, h("ai-card", null, h("div", { class: "rating" }, h("div", { class: "rating__text" }, h("p", { class: "rating__question" }, this.question), h("p", { class: "rating__subtitle" }, this.subtitle)), h("div", { class: "rating__icons", role: "group", "aria-label": this.question, onMouseLeave: () => (this.hovered = null) }, EMOJI_OPTIONS.map(opt => {
42
42
  const isActive = this.value === opt.value;
43
43
  const isHovered = this.hovered === opt.value;
44
44
  const icon = iconRegistry[opt.icon];
@@ -47,8 +47,8 @@ export class AiRating {
47
47
  'emoji-btn--active': isActive,
48
48
  'emoji-btn--hovered': isHovered && !isActive,
49
49
  'emoji-btn--disabled': this.disabled,
50
- }, "aria-label": opt.label, "aria-pressed": isActive ? 'true' : 'false', disabled: this.disabled, onClick: () => this.select(opt.value), onMouseEnter: () => (this.hovered = opt.value), onMouseLeave: () => (this.hovered = null) }, h("span", { class: "emoji-btn__icon", "aria-hidden": "true" }, h("svg", { width: 24, height: 24, viewBox: icon.viewBox, xmlns: "http://www.w3.org/2000/svg", ref: (el) => el && (el.innerHTML = icon.content) }))));
51
- })), label && h("p", { class: "rating__hover-label" }, label)))));
50
+ }, "aria-label": opt.label, "aria-pressed": isActive ? 'true' : 'false', disabled: this.disabled, onClick: () => this.select(opt.value), onMouseEnter: () => (this.hovered = opt.value) }, h("span", { class: "emoji-btn__icon", "aria-hidden": "true" }, h("svg", { width: 24, height: 24, viewBox: icon.viewBox, xmlns: "http://www.w3.org/2000/svg", ref: (el) => el && (el.innerHTML = icon.content) }))));
51
+ })), h("p", { class: { 'rating__hover-label': true, 'rating__hover-label--visible': label !== null } }, label ?? '\u00A0')))));
52
52
  }
53
53
  static get is() { return "ai-rating"; }
54
54
  static get encapsulation() { return "shadow"; }
@@ -1,2 +1,2 @@
1
1
  import{p as e,H as t,c as n,h as i,d as r,t as a}from"./p-BPkf7wZg.js";import{i as o}from"./p-DlD8m3rf.js";
2
- /*! @license DOMPurify 3.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.3/LICENSE */const{entries:s,setPrototypeOf:l,isFrozen:c,getPrototypeOf:u,getOwnPropertyDescriptor:d}=Object;let{freeze:p,seal:f,create:m}=Object,{apply:g,construct:h}="undefined"!=typeof Reflect&&Reflect;p||(p=function(e){return e}),f||(f=function(e){return e}),g||(g=function(e,t){for(var n=arguments.length,i=Array(n>2?n-2:0),r=2;r<n;r++)i[r-2]=arguments[r];return e.apply(t,i)}),h||(h=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return new e(...n)});const b=L(Array.prototype.forEach),y=L(Array.prototype.lastIndexOf),x=L(Array.prototype.pop),v=L(Array.prototype.push),w=L(Array.prototype.splice),k=L(String.prototype.toLowerCase),T=L(String.prototype.toString),A=L(String.prototype.match),S=L(String.prototype.replace),E=L(String.prototype.indexOf),R=L(String.prototype.trim),_=L(Object.prototype.hasOwnProperty),z=L(RegExp.prototype.test),D=function(e){return function(){for(var t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];return h(e,n)}}(TypeError);function L(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return g(e,t,i)}}function O(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:k;l&&l(e,null);let i=t.length;for(;i--;){let r=t[i];if("string"==typeof r){const e=n(r);e!==r&&(c(t)||(t[i]=e),r=e)}e[r]=!0}return e}function C(e){for(let t=0;t<e.length;t++)_(e,t)||(e[t]=null);return e}function $(e){const t=m(null);for(const[n,i]of s(e))_(e,n)&&(t[n]=Array.isArray(i)?C(i):i&&"object"==typeof i&&i.constructor===Object?$(i):i);return t}function M(e,t){for(;null!==e;){const n=d(e,t);if(n){if(n.get)return L(n.get);if("function"==typeof n.value)return L(n.value)}e=u(e)}return function(){return null}}const F=p(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),I=p(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),N=p(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),B=p(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),P=p(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),j=p(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),U=p(["#text"]),W=p(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),q=p(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),H=p(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Y=p(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),K=f(/\{\{[\w\W]*|[\w\W]*\}\}/gm),G=f(/<%[\w\W]*|[\w\W]*%>/gm),X=f(/\$\{[\w\W]*/gm),V=f(/^data-[\-\w.\u00B7-\uFFFF]+$/),Z=f(/^aria-[\-\w]+$/),J=f(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Q=f(/^(?:\w+script|data):/i),ee=f(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),te=f(/^html$/i),ne=f(/^[a-z][.\w]*(-[.\w]+)+$/i);var ie=Object.freeze({__proto__:null,ARIA_ATTR:Z,ATTR_WHITESPACE:ee,CUSTOM_ELEMENT:ne,DATA_ATTR:V,DOCTYPE_NAME:te,ERB_EXPR:G,IS_ALLOWED_URI:J,IS_SCRIPT_OR_DATA:Q,MUSTACHE_EXPR:K,TMPLIT_EXPR:X});const re=function(){return"undefined"==typeof window?null:window};var ae=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:re();const n=t=>e(t);if(n.version="3.3.3",n.removed=[],!t||!t.document||9!==t.document.nodeType||!t.Element)return n.isSupported=!1,n;let{document:i}=t;const r=i,a=r.currentScript,{DocumentFragment:o,HTMLTemplateElement:l,Node:c,Element:u,NodeFilter:d,NamedNodeMap:f=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:g,DOMParser:h,trustedTypes:L}=t,C=u.prototype,K=M(C,"cloneNode"),G=M(C,"remove"),X=M(C,"nextSibling"),V=M(C,"childNodes"),Z=M(C,"parentNode");if("function"==typeof l){const e=i.createElement("template");e.content&&e.content.ownerDocument&&(i=e.content.ownerDocument)}let Q,ee="";const{implementation:ne,createNodeIterator:ae,createDocumentFragment:oe,getElementsByTagName:se}=i,{importNode:le}=r;let ce={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof s&&"function"==typeof Z&&ne&&void 0!==ne.createHTMLDocument;const{MUSTACHE_EXPR:ue,ERB_EXPR:de,TMPLIT_EXPR:pe,DATA_ATTR:fe,ARIA_ATTR:me,IS_SCRIPT_OR_DATA:ge,ATTR_WHITESPACE:he,CUSTOM_ELEMENT:be}=ie;let{IS_ALLOWED_URI:ye}=ie,xe=null;const ve=O({},[...F,...I,...N,...P,...U]);let we=null;const ke=O({},[...W,...q,...H,...Y]);let Te=Object.seal(m(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ae=null,Se=null;const Ee=Object.seal(m(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Re=!0,_e=!0,ze=!1,De=!0,Le=!1,Oe=!0,Ce=!1,$e=!1,Me=!1,Fe=!1,Ie=!1,Ne=!1,Be=!0,Pe=!1,je=!0,Ue=!1,We={},qe=null;const He=O({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ye=null;const Ke=O({},["audio","video","img","source","image","track"]);let Ge=null;const Xe=O({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ve="http://www.w3.org/1998/Math/MathML",Ze="http://www.w3.org/2000/svg",Je="http://www.w3.org/1999/xhtml";let Qe=Je,et=!1,tt=null;const nt=O({},[Ve,Ze,Je],T);let it=O({},["mi","mo","mn","ms","mtext"]),rt=O({},["annotation-xml"]);const at=O({},["title","style","font","a","script"]);let ot=null;const st=["application/xhtml+xml","text/html"];let lt=null,ct=null;const ut=i.createElement("form"),dt=function(e){return e instanceof RegExp||e instanceof Function},pt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!ct||ct!==e){if(e&&"object"==typeof e||(e={}),e=$(e),ot=-1===st.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,lt="application/xhtml+xml"===ot?T:k,xe=_(e,"ALLOWED_TAGS")?O({},e.ALLOWED_TAGS,lt):ve,we=_(e,"ALLOWED_ATTR")?O({},e.ALLOWED_ATTR,lt):ke,tt=_(e,"ALLOWED_NAMESPACES")?O({},e.ALLOWED_NAMESPACES,T):nt,Ge=_(e,"ADD_URI_SAFE_ATTR")?O($(Xe),e.ADD_URI_SAFE_ATTR,lt):Xe,Ye=_(e,"ADD_DATA_URI_TAGS")?O($(Ke),e.ADD_DATA_URI_TAGS,lt):Ke,qe=_(e,"FORBID_CONTENTS")?O({},e.FORBID_CONTENTS,lt):He,Ae=_(e,"FORBID_TAGS")?O({},e.FORBID_TAGS,lt):$({}),Se=_(e,"FORBID_ATTR")?O({},e.FORBID_ATTR,lt):$({}),We=!!_(e,"USE_PROFILES")&&e.USE_PROFILES,Re=!1!==e.ALLOW_ARIA_ATTR,_e=!1!==e.ALLOW_DATA_ATTR,ze=e.ALLOW_UNKNOWN_PROTOCOLS||!1,De=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Le=e.SAFE_FOR_TEMPLATES||!1,Oe=!1!==e.SAFE_FOR_XML,Ce=e.WHOLE_DOCUMENT||!1,Fe=e.RETURN_DOM||!1,Ie=e.RETURN_DOM_FRAGMENT||!1,Ne=e.RETURN_TRUSTED_TYPE||!1,Me=e.FORCE_BODY||!1,Be=!1!==e.SANITIZE_DOM,Pe=e.SANITIZE_NAMED_PROPS||!1,je=!1!==e.KEEP_CONTENT,Ue=e.IN_PLACE||!1,ye=e.ALLOWED_URI_REGEXP||J,Qe=e.NAMESPACE||Je,it=e.MATHML_TEXT_INTEGRATION_POINTS||it,rt=e.HTML_INTEGRATION_POINTS||rt,Te=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&dt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Te.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&dt(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Te.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Te.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Le&&(_e=!1),Ie&&(Fe=!0),We&&(xe=O({},U),we=m(null),!0===We.html&&(O(xe,F),O(we,W)),!0===We.svg&&(O(xe,I),O(we,q),O(we,Y)),!0===We.svgFilters&&(O(xe,N),O(we,q),O(we,Y)),!0===We.mathMl&&(O(xe,P),O(we,H),O(we,Y))),_(e,"ADD_TAGS")||(Ee.tagCheck=null),_(e,"ADD_ATTR")||(Ee.attributeCheck=null),e.ADD_TAGS&&("function"==typeof e.ADD_TAGS?Ee.tagCheck=e.ADD_TAGS:(xe===ve&&(xe=$(xe)),O(xe,e.ADD_TAGS,lt))),e.ADD_ATTR&&("function"==typeof e.ADD_ATTR?Ee.attributeCheck=e.ADD_ATTR:(we===ke&&(we=$(we)),O(we,e.ADD_ATTR,lt))),e.ADD_URI_SAFE_ATTR&&O(Ge,e.ADD_URI_SAFE_ATTR,lt),e.FORBID_CONTENTS&&(qe===He&&(qe=$(qe)),O(qe,e.FORBID_CONTENTS,lt)),e.ADD_FORBID_CONTENTS&&(qe===He&&(qe=$(qe)),O(qe,e.ADD_FORBID_CONTENTS,lt)),je&&(xe["#text"]=!0),Ce&&O(xe,["html","head","body"]),xe.table&&(O(xe,["tbody"]),delete Ae.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw D('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw D('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');Q=e.TRUSTED_TYPES_POLICY,ee=Q.createHTML("")}else void 0===Q&&(Q=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(L,a)),null!==Q&&"string"==typeof ee&&(ee=Q.createHTML(""));p&&p(e),ct=e}},ft=O({},[...I,...N,...B]),mt=O({},[...P,...j]),gt=function(e){v(n.removed,{element:e});try{Z(e).removeChild(e)}catch(t){G(e)}},ht=function(e,t){try{v(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){v(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(Fe||Ie)try{gt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},bt=function(e){let t=null,n=null;if(Me)e="<remove></remove>"+e;else{const t=A(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===ot&&Qe===Je&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const r=Q?Q.createHTML(e):e;if(Qe===Je)try{t=(new h).parseFromString(r,ot)}catch(e){}if(!t||!t.documentElement){t=ne.createDocument(Qe,"template",null);try{t.documentElement.innerHTML=et?ee:r}catch(e){}}const a=t.body||t.documentElement;return e&&n&&a.insertBefore(i.createTextNode(n),a.childNodes[0]||null),Qe===Je?se.call(t,Ce?"html":"body")[0]:Ce?t.documentElement:a},yt=function(e){return ae.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},xt=function(e){return e instanceof g&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof f)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},vt=function(e){return"function"==typeof c&&e instanceof c};function wt(e,t,i){b(e,(e=>{e.call(n,t,i,ct)}))}const kt=function(e){let t=null;if(wt(ce.beforeSanitizeElements,e,null),xt(e))return gt(e),!0;const i=lt(e.nodeName);if(wt(ce.uponSanitizeElement,e,{tagName:i,allowedTags:xe}),Oe&&e.hasChildNodes()&&!vt(e.firstElementChild)&&z(/<[/\w!]/g,e.innerHTML)&&z(/<[/\w!]/g,e.textContent))return gt(e),!0;if(7===e.nodeType)return gt(e),!0;if(Oe&&8===e.nodeType&&z(/<[/\w]/g,e.data))return gt(e),!0;if(!(Ee.tagCheck instanceof Function&&Ee.tagCheck(i))&&(!xe[i]||Ae[i])){if(!Ae[i]&&At(i)){if(Te.tagNameCheck instanceof RegExp&&z(Te.tagNameCheck,i))return!1;if(Te.tagNameCheck instanceof Function&&Te.tagNameCheck(i))return!1}if(je&&!qe[i]){const t=Z(e)||e.parentNode,n=V(e)||e.childNodes;if(n&&t)for(let i=n.length-1;i>=0;--i){const r=K(n[i],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,X(e))}}return gt(e),!0}return e instanceof u&&!function(e){let t=Z(e);t&&t.tagName||(t={namespaceURI:Qe,tagName:"template"});const n=k(e.tagName),i=k(t.tagName);return!!tt[e.namespaceURI]&&(e.namespaceURI===Ze?t.namespaceURI===Je?"svg"===n:t.namespaceURI===Ve?"svg"===n&&("annotation-xml"===i||it[i]):!!ft[n]:e.namespaceURI===Ve?t.namespaceURI===Je?"math"===n:t.namespaceURI===Ze?"math"===n&&rt[i]:!!mt[n]:e.namespaceURI===Je?!(t.namespaceURI===Ze&&!rt[i])&&!(t.namespaceURI===Ve&&!it[i])&&!mt[n]&&(at[n]||!ft[n]):!("application/xhtml+xml"!==ot||!tt[e.namespaceURI]))}(e)?(gt(e),!0):"noscript"!==i&&"noembed"!==i&&"noframes"!==i||!z(/<\/no(script|embed|frames)/i,e.innerHTML)?(Le&&3===e.nodeType&&(t=e.textContent,b([ue,de,pe],(e=>{t=S(t,e," ")})),e.textContent!==t&&(v(n.removed,{element:e.cloneNode()}),e.textContent=t)),wt(ce.afterSanitizeElements,e,null),!1):(gt(e),!0)},Tt=function(e,t,n){if(Se[t])return!1;if(Be&&("id"===t||"name"===t)&&(n in i||n in ut))return!1;if(_e&&!Se[t]&&z(fe,t));else if(Re&&z(me,t));else if(Ee.attributeCheck instanceof Function&&Ee.attributeCheck(t,e));else if(!we[t]||Se[t]){if(!(At(e)&&(Te.tagNameCheck instanceof RegExp&&z(Te.tagNameCheck,e)||Te.tagNameCheck instanceof Function&&Te.tagNameCheck(e))&&(Te.attributeNameCheck instanceof RegExp&&z(Te.attributeNameCheck,t)||Te.attributeNameCheck instanceof Function&&Te.attributeNameCheck(t,e))||"is"===t&&Te.allowCustomizedBuiltInElements&&(Te.tagNameCheck instanceof RegExp&&z(Te.tagNameCheck,n)||Te.tagNameCheck instanceof Function&&Te.tagNameCheck(n))))return!1}else if(Ge[t]);else if(z(ye,S(n,he,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==E(n,"data:")||!Ye[e])if(ze&&!z(ge,S(n,he,"")));else if(n)return!1;return!0},At=function(e){return"annotation-xml"!==e&&A(e,be)},St=function(e){wt(ce.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||xt(e))return;const i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:we,forceKeepAttr:void 0};let r=t.length;for(;r--;){const a=t[r],{name:o,namespaceURI:s,value:l}=a,c=lt(o),u=l;let d="value"===o?u:R(u);if(i.attrName=c,i.attrValue=d,i.keepAttr=!0,i.forceKeepAttr=void 0,wt(ce.uponSanitizeAttribute,e,i),d=i.attrValue,!Pe||"id"!==c&&"name"!==c||(ht(o,e),d="user-content-"+d),Oe&&z(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){ht(o,e);continue}if("attributename"===c&&A(d,"href")){ht(o,e);continue}if(i.forceKeepAttr)continue;if(!i.keepAttr){ht(o,e);continue}if(!De&&z(/\/>/i,d)){ht(o,e);continue}Le&&b([ue,de,pe],(e=>{d=S(d,e," ")}));const p=lt(e.nodeName);if(Tt(p,c,d)){if(Q&&"object"==typeof L&&"function"==typeof L.getAttributeType)if(s);else switch(L.getAttributeType(p,c)){case"TrustedHTML":d=Q.createHTML(d);break;case"TrustedScriptURL":d=Q.createScriptURL(d)}if(d!==u)try{s?e.setAttributeNS(s,o,d):e.setAttribute(o,d),xt(e)?gt(e):x(n.removed)}catch(t){ht(o,e)}}else ht(o,e)}wt(ce.afterSanitizeAttributes,e,null)},Et=function e(t){let n=null;const i=yt(t);for(wt(ce.beforeSanitizeShadowDOM,t,null);n=i.nextNode();)wt(ce.uponSanitizeShadowNode,n,null),kt(n),St(n),n.content instanceof o&&e(n.content);wt(ce.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null,a=null,s=null,l=null;if(et=!e,et&&(e="\x3c!--\x3e"),"string"!=typeof e&&!vt(e)){if("function"!=typeof e.toString)throw D("toString is not a function");if("string"!=typeof(e=""+e))throw D("dirty is not a string, aborting")}if(!n.isSupported)return e;if($e||pt(t),n.removed=[],"string"==typeof e&&(Ue=!1),Ue){if(e.nodeName){const t=lt(e.nodeName);if(!xe[t]||Ae[t])throw D("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof c)i=bt("\x3c!----\x3e"),a=i.ownerDocument.importNode(e,!0),1===a.nodeType&&"BODY"===a.nodeName||"HTML"===a.nodeName?i=a:i.appendChild(a);else{if(!Fe&&!Le&&!Ce&&-1===e.indexOf("<"))return Q&&Ne?Q.createHTML(e):e;if(i=bt(e),!i)return Fe?null:Ne?ee:""}i&&Me&&gt(i.firstChild);const u=yt(Ue?e:i);for(;s=u.nextNode();)kt(s),St(s),s.content instanceof o&&Et(s.content);if(Ue)return e;if(Fe){if(Ie)for(l=oe.call(i.ownerDocument);i.firstChild;)l.appendChild(i.firstChild);else l=i;return(we.shadowroot||we.shadowrootmode)&&(l=le.call(r,l,!0)),l}let d=Ce?i.outerHTML:i.innerHTML;return Ce&&xe["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&z(te,i.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+i.ownerDocument.doctype.name+">\n"+d),Le&&b([ue,de,pe],(e=>{d=S(d,e," ")})),Q&&Ne?Q.createHTML(d):d},n.setConfig=function(){pt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),$e=!0},n.clearConfig=function(){ct=null,$e=!1},n.isValidAttribute=function(e,t,n){ct||pt({});const i=lt(e),r=lt(t);return Tt(i,r,n)},n.addHook=function(e,t){"function"==typeof t&&v(ce[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=y(ce[e],t);return-1===n?void 0:w(ce[e],n,1)[0]}return x(ce[e])},n.removeHooks=function(e){ce[e]=[]},n.removeAllHooks=function(){ce={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();const oe={ALLOWED_TAGS:["p","br","strong","em","del","code","pre","ul","ol","li","h2","h3","a","blockquote","table","thead","tbody","tr","th","td"],ALLOWED_ATTR:["href","target","rel"]},se=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.messageCopy=n(this,"messageCopy"),this.messageFeedback=n(this,"messageFeedback"),this.messageRegenerate=n(this,"messageRegenerate")}role="user";content="";format="text";agentName="";timestamp="";showActions=!0;enableRegenerate=!1;feedbackValue=null;messageCopy;messageFeedback;messageRegenerate;copySuccess=!1;copyTimeout;disconnectedCallback(){this.copyTimeout&&clearTimeout(this.copyTimeout)}renderIcon(e,t=16){const n=o[e];return n?i("span",{class:"icon-wrap",innerHTML:`<svg width="${t}" height="${t}" viewBox="${n.viewBox}" fill="none" xmlns="http://www.w3.org/2000/svg">${n.content}</svg>`}):null}parseMarkdown(e){let t=e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");const n=[];return t=t.replace(/```(?:\w+)?\n?([\s\S]*?)```/g,((e,t)=>{const i=n.length;return n.push(`<pre><code>${t}</code></pre>`),`\0BLOCK${i}\0`})),t=t.replace(/((?:^[ \t]*\|.+\|\n?)+)/gm,(e=>{const t=e.trim().split("\n").filter((e=>e.trim()));if(t.length<2)return e;let i="<table>",r=!1;t.forEach(((e,t)=>{if((e=>/^[\s|:-]+$/.test(e))(e))return r=!0,void(i+="<tbody>");const n=e.split("|").filter(((e,t,n)=>t>0&&t<n.length-1));i+=r||0!==t?`<tr>${n.map((e=>`<td>${e.trim()}</td>`)).join("")}</tr>`:`<thead><tr>${n.map((e=>`<th>${e.trim()}</th>`)).join("")}</tr></thead>`})),r&&(i+="</tbody>"),i+="</table>";const a=n.length;return n.push(i),`\0BLOCK${a}\0`})),t=t.replace(/((?:^&gt; .+\n?)+)/gm,(e=>{const t=e.replace(/^&gt; /gm,"").trim(),i=n.length;return n.push(`<blockquote>${t}</blockquote>`),`\0BLOCK${i}\0`})),t=t.replace(/`([^`]+)`/g,"<code>$1</code>"),t=t.replace(/^## (.+)$/gm,"<h2>$1</h2>"),t=t.replace(/^### (.+)$/gm,"<h3>$1</h3>"),t=t.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),t=t.replace(/\*([^*\n]+)\*/g,"<em>$1</em>"),t=t.replace(/~~(.+?)~~/g,"<del>$1</del>"),t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>'),t=t.replace(/((?:^[ \t]*[-*] .+\n?)+)/gm,(e=>{const t=e.trim().split("\n").filter((e=>e.trim())).map((e=>`<li>${e.replace(/^[ \t]*[-*] /,"")}</li>`)).join(""),i=n.length;return n.push(`<ul>${t}</ul>`),`\0BLOCK${i}\0`})),t=t.replace(/((?:^[ \t]*\d+\. .+\n?)+)/gm,(e=>{const t=e.trim().split("\n").filter((e=>e.trim())).map((e=>`<li>${e.replace(/^[ \t]*\d+\. /,"")}</li>`)).join(""),i=n.length;return n.push(`<ol>${t}</ol>`),`\0BLOCK${i}\0`})),t=t.split(/\n{2,}/).map((e=>{const t=e.trim();return t?/^\x00BLOCK\d+\x00$/.test(t)?t:`<p>${t.replace(/\n/g,"<br>")}</p>`:""})).join(""),t=t.replace(/\x00BLOCK(\d+)\x00/g,((e,t)=>n[parseInt(t,10)]||"")),t}getRenderedContent(){if(!this.content)return"";try{return ae.sanitize(this.parseMarkdown(this.content),oe)}catch{return ae.sanitize(`<p>${this.content.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"<br>")}</p>`,oe)}}getRelativeTime(){if(!this.timestamp)return"";try{const e=new Date(this.timestamp);if(isNaN(e.getTime()))return this.timestamp;const t=Date.now()-e.getTime(),n=Math.floor(t/6e4),i=Math.floor(n/60),r=Math.floor(i/24),a="undefined"!=typeof document&&document.documentElement.lang||"ar",o=new Intl.RelativeTimeFormat(a,{numeric:"auto"});return n<1?o.format(0,"second"):n<60?o.format(-n,"minute"):i<24?o.format(-i,"hour"):o.format(-r,"day")}catch{return this.timestamp}}async handleCopy(){try{await navigator.clipboard.writeText(this.content)}catch(e){}this.copySuccess=!0,this.messageCopy.emit(),this.copyTimeout=setTimeout((()=>this.copySuccess=!1),1500)}handleFeedback(e){this.feedbackValue=this.feedbackValue===e?null:e,this.messageFeedback.emit(e)}renderActionsBar(){return i("div",{class:"actions-bar"},this.enableRegenerate&&i("button",{class:"action-btn",onClick:()=>this.messageRegenerate.emit(),title:"إعادة تحميل"},this.renderIcon("reload",16)),i("button",{class:"action-btn copy-btn"+(this.copySuccess?" copy-success":""),onClick:()=>this.handleCopy(),title:"نسخ"},this.renderIcon("copy",16)),i("div",{class:"feedback-group"},i("button",{class:"feedback-btn thumbs-down-btn"+("down"===this.feedbackValue?" active":""),onClick:()=>this.handleFeedback("down"),title:"غير مفيد"},this.renderIcon("thumbs-down",16)),i("button",{class:"feedback-btn thumbs-up-btn"+("up"===this.feedbackValue?" active":""),onClick:()=>this.handleFeedback("up"),title:"مفيد"},this.renderIcon("thumbs-up",16))))}renderUserMessage(){return i("div",{class:"message-row user-row"},i("div",{class:"bubble user-bubble"},i("div",{class:"message-content",ref:e=>{e&&("markdown"===this.format?e.innerHTML=this.getRenderedContent():e.textContent=this.content)}})))}renderAgentMessage(){const e=this.showActions;return i("div",{class:"message-row agent-row"},i("div",{class:"agent-bubble-wrapper"},i("div",{class:"bubble agent-bubble"},this.content&&i("div",{class:"message-content",ref:e=>{e&&("markdown"===this.format?e.innerHTML=this.getRenderedContent():e.textContent=this.content)}}),i("slot",null),e&&this.renderActionsBar()),(this.agentName||this.timestamp)&&i("div",{class:"agent-info"},this.agentName&&i("span",{class:"agent-info-name"},this.agentName),this.agentName&&this.timestamp&&this.renderIcon("eclipse",10),this.timestamp&&i("span",{class:"agent-info-time"},this.getRelativeTime()))))}render(){return i(r,{key:"f8a49971896742ae952d84efb1527ed0db440876"},"user"===this.role?this.renderUserMessage():this.renderAgentMessage())}static get style(){return":host{--ai-msg-user-bg:var(--ai-user-bubble-bg);--ai-msg-user-border:1px solid var(--ai-border-default);--ai-msg-agent-bg:var(--ai-agent-bubble-bg);--ai-msg-agent-border:1px solid var(--ai-border-default);--ai-msg-border-radius:16px;--ai-msg-padding:16px;--ai-msg-font-size:14px;--ai-msg-action-active-bg:var(--ai-accent);--ai-user-msg-max-width:80%;--ai-agent-msg-max-width:80%;display:block}.message-row{display:flex}.user-row{flex-direction:column;align-items:flex-end}.user-bubble{background:var(--ai-msg-user-bg);color:var(--ai-text-primary);border:var(--ai-msg-user-border);border-radius:var(--ai-msg-border-radius);padding:var(--ai-msg-padding);font-size:var(--ai-msg-font-size);max-width:var(--ai-user-msg-max-width);line-height:1.5;word-break:break-word;box-shadow:var(--ai-shadow-sm)}.user-row .timestamp{font-size:12px;color:var(--ai-text-secondary);margin-top:4px}.agent-row{flex-direction:row;justify-content:flex-start}.agent-bubble-wrapper{display:flex;flex-direction:column;gap:6px;width:100%;max-width:var(--ai-msg-agent-max-width);min-width:0}.agent-bubble{background:var(--ai-msg-agent-bg);color:var(--ai-text-primary);border:var(--ai-msg-agent-border);border-radius:var(--ai-msg-border-radius);padding:var(--ai-msg-padding);font-size:var(--ai-msg-font-size);line-height:1.6;word-break:break-word;box-shadow:var(--ai-shadow-sm);display:flex;flex-direction:column;gap:12px}.message-content{white-space:pre-wrap}.message-content p{margin:0 0 8px 0}.message-content p:last-child{margin-bottom:0}.message-content h2{font-size:16px;font-weight:700;margin:0 0 8px 0}.message-content h3{font-size:15px;font-weight:600;margin:0 0 6px 0}.message-content strong{font-weight:700}.message-content em{font-style:italic}.message-content code{background:var(--ai-bg-surface);border-radius:4px;padding:1px 5px;font-family:var(--ai-font-family-mono);font-size:13px;color:var(--ai-text-primary)}.message-content pre{background:var(--ai-bg-surface);border-radius:8px;padding:10px 12px;overflow-x:auto;margin:8px 0}.message-content pre code{background:none;padding:0;font-size:13px}.message-content ul,.message-content ol{padding-inline-start:20px;margin:4px 0 8px 0}.message-content li{margin-bottom:3px}.actions-bar{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:6px;height:0;overflow:hidden;opacity:0;pointer-events:none;transition:height 0.15s ease, opacity 0.15s ease}.agent-bubble:hover .actions-bar{height:32px;opacity:1;pointer-events:auto}.action-btn{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:8px;background:var(--ai-bg-card);border:1px solid var(--ai-border-default);cursor:pointer;color:var(--ai-text-primary);transition:background 0.15s, color 0.15s;padding:0;flex-shrink:0}.action-btn:hover{background:var(--ai-bg-surface)}.action-btn.copy-success{background:var(--ai-msg-action-active-bg);color:var(--ai-accent-text);border-color:var(--ai-accent)}.feedback-group{display:flex;align-items:center;border:1px solid var(--ai-border-default);border-radius:8px;overflow:hidden;background:var(--ai-bg-card)}.feedback-btn{display:flex;align-items:center;justify-content:center;height:32px;padding:0 8px;background:var(--ai-bg-card);border:none;border-inline-start:1px solid var(--ai-border-default);cursor:pointer;color:var(--ai-text-primary);transition:background 0.15s, color 0.15s}.feedback-btn:first-child{border-inline-start:none}.feedback-btn:hover{background:var(--ai-bg-surface)}.feedback-btn.active{background:var(--ai-msg-action-active-bg);color:var(--ai-accent-text)}.icon-wrap{display:flex;align-items:center;justify-content:center;line-height:0}.agent-info{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:6px;color:var(--ai-text-muted)}.agent-info-name,.agent-info-time{font-size:12px;color:inherit;line-height:16px;white-space:nowrap}.agent-info .icon-wrap{display:flex;align-items:center;color:inherit;opacity:0.6;flex-shrink:0}.typing-indicator{display:flex;align-items:center;gap:5px;padding:4px 2px}.typing-dot{width:8px;height:8px;border-radius:50%;background:var(--ai-text-muted);animation:typingBounce 1.2s ease-in-out infinite}.typing-dot:nth-child(2){animation-delay:0.2s}.typing-dot:nth-child(3){animation-delay:0.4s}@keyframes typingBounce{0%,60%,100%{transform:translateY(0)}30%{transform:translateY(-6px)}}.streaming-cursor{display:inline-block;width:2px;height:1em;background:currentColor;vertical-align:text-bottom;margin-inline-start:2px;animation:cursorBlink 0.8s step-start infinite}@keyframes cursorBlink{0%,100%{opacity:1}50%{opacity:0}}"}},[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]}]),le=se,ce=function(){"undefined"!=typeof customElements&&["ai-chat-message"].forEach((e=>{"ai-chat-message"===e&&(customElements.get(a(e))||customElements.define(a(e),se))}))};export{le as AiChatMessage,ce as defineCustomElement}
2
+ /*! @license DOMPurify 3.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.3/LICENSE */const{entries:s,setPrototypeOf:l,isFrozen:c,getPrototypeOf:u,getOwnPropertyDescriptor:d}=Object;let{freeze:f,seal:p,create:m}=Object,{apply:g,construct:h}="undefined"!=typeof Reflect&&Reflect;f||(f=function(e){return e}),p||(p=function(e){return e}),g||(g=function(e,t){for(var n=arguments.length,i=Array(n>2?n-2:0),r=2;r<n;r++)i[r-2]=arguments[r];return e.apply(t,i)}),h||(h=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return new e(...n)});const b=L(Array.prototype.forEach),y=L(Array.prototype.lastIndexOf),x=L(Array.prototype.pop),v=L(Array.prototype.push),w=L(Array.prototype.splice),k=L(String.prototype.toLowerCase),T=L(String.prototype.toString),A=L(String.prototype.match),S=L(String.prototype.replace),E=L(String.prototype.indexOf),R=L(String.prototype.trim),_=L(Object.prototype.hasOwnProperty),z=L(RegExp.prototype.test),D=function(e){return function(){for(var t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];return h(e,n)}}(TypeError);function L(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return g(e,t,i)}}function O(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:k;l&&l(e,null);let i=t.length;for(;i--;){let r=t[i];if("string"==typeof r){const e=n(r);e!==r&&(c(t)||(t[i]=e),r=e)}e[r]=!0}return e}function C(e){for(let t=0;t<e.length;t++)_(e,t)||(e[t]=null);return e}function $(e){const t=m(null);for(const[n,i]of s(e))_(e,n)&&(t[n]=Array.isArray(i)?C(i):i&&"object"==typeof i&&i.constructor===Object?$(i):i);return t}function M(e,t){for(;null!==e;){const n=d(e,t);if(n){if(n.get)return L(n.get);if("function"==typeof n.value)return L(n.value)}e=u(e)}return function(){return null}}const F=f(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),I=f(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),N=f(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),B=f(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),P=f(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),j=f(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),U=f(["#text"]),W=f(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),q=f(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),H=f(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Y=f(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),K=p(/\{\{[\w\W]*|[\w\W]*\}\}/gm),G=p(/<%[\w\W]*|[\w\W]*%>/gm),X=p(/\$\{[\w\W]*/gm),V=p(/^data-[\-\w.\u00B7-\uFFFF]+$/),Z=p(/^aria-[\-\w]+$/),J=p(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Q=p(/^(?:\w+script|data):/i),ee=p(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),te=p(/^html$/i),ne=p(/^[a-z][.\w]*(-[.\w]+)+$/i);var ie=Object.freeze({__proto__:null,ARIA_ATTR:Z,ATTR_WHITESPACE:ee,CUSTOM_ELEMENT:ne,DATA_ATTR:V,DOCTYPE_NAME:te,ERB_EXPR:G,IS_ALLOWED_URI:J,IS_SCRIPT_OR_DATA:Q,MUSTACHE_EXPR:K,TMPLIT_EXPR:X});const re=function(){return"undefined"==typeof window?null:window};var ae=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:re();const n=t=>e(t);if(n.version="3.3.3",n.removed=[],!t||!t.document||9!==t.document.nodeType||!t.Element)return n.isSupported=!1,n;let{document:i}=t;const r=i,a=r.currentScript,{DocumentFragment:o,HTMLTemplateElement:l,Node:c,Element:u,NodeFilter:d,NamedNodeMap:p=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:g,DOMParser:h,trustedTypes:L}=t,C=u.prototype,K=M(C,"cloneNode"),G=M(C,"remove"),X=M(C,"nextSibling"),V=M(C,"childNodes"),Z=M(C,"parentNode");if("function"==typeof l){const e=i.createElement("template");e.content&&e.content.ownerDocument&&(i=e.content.ownerDocument)}let Q,ee="";const{implementation:ne,createNodeIterator:ae,createDocumentFragment:oe,getElementsByTagName:se}=i,{importNode:le}=r;let ce={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof s&&"function"==typeof Z&&ne&&void 0!==ne.createHTMLDocument;const{MUSTACHE_EXPR:ue,ERB_EXPR:de,TMPLIT_EXPR:fe,DATA_ATTR:pe,ARIA_ATTR:me,IS_SCRIPT_OR_DATA:ge,ATTR_WHITESPACE:he,CUSTOM_ELEMENT:be}=ie;let{IS_ALLOWED_URI:ye}=ie,xe=null;const ve=O({},[...F,...I,...N,...P,...U]);let we=null;const ke=O({},[...W,...q,...H,...Y]);let Te=Object.seal(m(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ae=null,Se=null;const Ee=Object.seal(m(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Re=!0,_e=!0,ze=!1,De=!0,Le=!1,Oe=!0,Ce=!1,$e=!1,Me=!1,Fe=!1,Ie=!1,Ne=!1,Be=!0,Pe=!1,je=!0,Ue=!1,We={},qe=null;const He=O({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ye=null;const Ke=O({},["audio","video","img","source","image","track"]);let Ge=null;const Xe=O({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ve="http://www.w3.org/1998/Math/MathML",Ze="http://www.w3.org/2000/svg",Je="http://www.w3.org/1999/xhtml";let Qe=Je,et=!1,tt=null;const nt=O({},[Ve,Ze,Je],T);let it=O({},["mi","mo","mn","ms","mtext"]),rt=O({},["annotation-xml"]);const at=O({},["title","style","font","a","script"]);let ot=null;const st=["application/xhtml+xml","text/html"];let lt=null,ct=null;const ut=i.createElement("form"),dt=function(e){return e instanceof RegExp||e instanceof Function},ft=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!ct||ct!==e){if(e&&"object"==typeof e||(e={}),e=$(e),ot=-1===st.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,lt="application/xhtml+xml"===ot?T:k,xe=_(e,"ALLOWED_TAGS")?O({},e.ALLOWED_TAGS,lt):ve,we=_(e,"ALLOWED_ATTR")?O({},e.ALLOWED_ATTR,lt):ke,tt=_(e,"ALLOWED_NAMESPACES")?O({},e.ALLOWED_NAMESPACES,T):nt,Ge=_(e,"ADD_URI_SAFE_ATTR")?O($(Xe),e.ADD_URI_SAFE_ATTR,lt):Xe,Ye=_(e,"ADD_DATA_URI_TAGS")?O($(Ke),e.ADD_DATA_URI_TAGS,lt):Ke,qe=_(e,"FORBID_CONTENTS")?O({},e.FORBID_CONTENTS,lt):He,Ae=_(e,"FORBID_TAGS")?O({},e.FORBID_TAGS,lt):$({}),Se=_(e,"FORBID_ATTR")?O({},e.FORBID_ATTR,lt):$({}),We=!!_(e,"USE_PROFILES")&&e.USE_PROFILES,Re=!1!==e.ALLOW_ARIA_ATTR,_e=!1!==e.ALLOW_DATA_ATTR,ze=e.ALLOW_UNKNOWN_PROTOCOLS||!1,De=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Le=e.SAFE_FOR_TEMPLATES||!1,Oe=!1!==e.SAFE_FOR_XML,Ce=e.WHOLE_DOCUMENT||!1,Fe=e.RETURN_DOM||!1,Ie=e.RETURN_DOM_FRAGMENT||!1,Ne=e.RETURN_TRUSTED_TYPE||!1,Me=e.FORCE_BODY||!1,Be=!1!==e.SANITIZE_DOM,Pe=e.SANITIZE_NAMED_PROPS||!1,je=!1!==e.KEEP_CONTENT,Ue=e.IN_PLACE||!1,ye=e.ALLOWED_URI_REGEXP||J,Qe=e.NAMESPACE||Je,it=e.MATHML_TEXT_INTEGRATION_POINTS||it,rt=e.HTML_INTEGRATION_POINTS||rt,Te=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&dt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Te.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&dt(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Te.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Te.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Le&&(_e=!1),Ie&&(Fe=!0),We&&(xe=O({},U),we=m(null),!0===We.html&&(O(xe,F),O(we,W)),!0===We.svg&&(O(xe,I),O(we,q),O(we,Y)),!0===We.svgFilters&&(O(xe,N),O(we,q),O(we,Y)),!0===We.mathMl&&(O(xe,P),O(we,H),O(we,Y))),_(e,"ADD_TAGS")||(Ee.tagCheck=null),_(e,"ADD_ATTR")||(Ee.attributeCheck=null),e.ADD_TAGS&&("function"==typeof e.ADD_TAGS?Ee.tagCheck=e.ADD_TAGS:(xe===ve&&(xe=$(xe)),O(xe,e.ADD_TAGS,lt))),e.ADD_ATTR&&("function"==typeof e.ADD_ATTR?Ee.attributeCheck=e.ADD_ATTR:(we===ke&&(we=$(we)),O(we,e.ADD_ATTR,lt))),e.ADD_URI_SAFE_ATTR&&O(Ge,e.ADD_URI_SAFE_ATTR,lt),e.FORBID_CONTENTS&&(qe===He&&(qe=$(qe)),O(qe,e.FORBID_CONTENTS,lt)),e.ADD_FORBID_CONTENTS&&(qe===He&&(qe=$(qe)),O(qe,e.ADD_FORBID_CONTENTS,lt)),je&&(xe["#text"]=!0),Ce&&O(xe,["html","head","body"]),xe.table&&(O(xe,["tbody"]),delete Ae.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw D('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw D('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');Q=e.TRUSTED_TYPES_POLICY,ee=Q.createHTML("")}else void 0===Q&&(Q=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(L,a)),null!==Q&&"string"==typeof ee&&(ee=Q.createHTML(""));f&&f(e),ct=e}},pt=O({},[...I,...N,...B]),mt=O({},[...P,...j]),gt=function(e){v(n.removed,{element:e});try{Z(e).removeChild(e)}catch(t){G(e)}},ht=function(e,t){try{v(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){v(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(Fe||Ie)try{gt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},bt=function(e){let t=null,n=null;if(Me)e="<remove></remove>"+e;else{const t=A(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===ot&&Qe===Je&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const r=Q?Q.createHTML(e):e;if(Qe===Je)try{t=(new h).parseFromString(r,ot)}catch(e){}if(!t||!t.documentElement){t=ne.createDocument(Qe,"template",null);try{t.documentElement.innerHTML=et?ee:r}catch(e){}}const a=t.body||t.documentElement;return e&&n&&a.insertBefore(i.createTextNode(n),a.childNodes[0]||null),Qe===Je?se.call(t,Ce?"html":"body")[0]:Ce?t.documentElement:a},yt=function(e){return ae.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},xt=function(e){return e instanceof g&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof p)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},vt=function(e){return"function"==typeof c&&e instanceof c};function wt(e,t,i){b(e,(e=>{e.call(n,t,i,ct)}))}const kt=function(e){let t=null;if(wt(ce.beforeSanitizeElements,e,null),xt(e))return gt(e),!0;const i=lt(e.nodeName);if(wt(ce.uponSanitizeElement,e,{tagName:i,allowedTags:xe}),Oe&&e.hasChildNodes()&&!vt(e.firstElementChild)&&z(/<[/\w!]/g,e.innerHTML)&&z(/<[/\w!]/g,e.textContent))return gt(e),!0;if(7===e.nodeType)return gt(e),!0;if(Oe&&8===e.nodeType&&z(/<[/\w]/g,e.data))return gt(e),!0;if(!(Ee.tagCheck instanceof Function&&Ee.tagCheck(i))&&(!xe[i]||Ae[i])){if(!Ae[i]&&At(i)){if(Te.tagNameCheck instanceof RegExp&&z(Te.tagNameCheck,i))return!1;if(Te.tagNameCheck instanceof Function&&Te.tagNameCheck(i))return!1}if(je&&!qe[i]){const t=Z(e)||e.parentNode,n=V(e)||e.childNodes;if(n&&t)for(let i=n.length-1;i>=0;--i){const r=K(n[i],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,X(e))}}return gt(e),!0}return e instanceof u&&!function(e){let t=Z(e);t&&t.tagName||(t={namespaceURI:Qe,tagName:"template"});const n=k(e.tagName),i=k(t.tagName);return!!tt[e.namespaceURI]&&(e.namespaceURI===Ze?t.namespaceURI===Je?"svg"===n:t.namespaceURI===Ve?"svg"===n&&("annotation-xml"===i||it[i]):!!pt[n]:e.namespaceURI===Ve?t.namespaceURI===Je?"math"===n:t.namespaceURI===Ze?"math"===n&&rt[i]:!!mt[n]:e.namespaceURI===Je?!(t.namespaceURI===Ze&&!rt[i])&&!(t.namespaceURI===Ve&&!it[i])&&!mt[n]&&(at[n]||!pt[n]):!("application/xhtml+xml"!==ot||!tt[e.namespaceURI]))}(e)?(gt(e),!0):"noscript"!==i&&"noembed"!==i&&"noframes"!==i||!z(/<\/no(script|embed|frames)/i,e.innerHTML)?(Le&&3===e.nodeType&&(t=e.textContent,b([ue,de,fe],(e=>{t=S(t,e," ")})),e.textContent!==t&&(v(n.removed,{element:e.cloneNode()}),e.textContent=t)),wt(ce.afterSanitizeElements,e,null),!1):(gt(e),!0)},Tt=function(e,t,n){if(Se[t])return!1;if(Be&&("id"===t||"name"===t)&&(n in i||n in ut))return!1;if(_e&&!Se[t]&&z(pe,t));else if(Re&&z(me,t));else if(Ee.attributeCheck instanceof Function&&Ee.attributeCheck(t,e));else if(!we[t]||Se[t]){if(!(At(e)&&(Te.tagNameCheck instanceof RegExp&&z(Te.tagNameCheck,e)||Te.tagNameCheck instanceof Function&&Te.tagNameCheck(e))&&(Te.attributeNameCheck instanceof RegExp&&z(Te.attributeNameCheck,t)||Te.attributeNameCheck instanceof Function&&Te.attributeNameCheck(t,e))||"is"===t&&Te.allowCustomizedBuiltInElements&&(Te.tagNameCheck instanceof RegExp&&z(Te.tagNameCheck,n)||Te.tagNameCheck instanceof Function&&Te.tagNameCheck(n))))return!1}else if(Ge[t]);else if(z(ye,S(n,he,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==E(n,"data:")||!Ye[e])if(ze&&!z(ge,S(n,he,"")));else if(n)return!1;return!0},At=function(e){return"annotation-xml"!==e&&A(e,be)},St=function(e){wt(ce.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||xt(e))return;const i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:we,forceKeepAttr:void 0};let r=t.length;for(;r--;){const a=t[r],{name:o,namespaceURI:s,value:l}=a,c=lt(o),u=l;let d="value"===o?u:R(u);if(i.attrName=c,i.attrValue=d,i.keepAttr=!0,i.forceKeepAttr=void 0,wt(ce.uponSanitizeAttribute,e,i),d=i.attrValue,!Pe||"id"!==c&&"name"!==c||(ht(o,e),d="user-content-"+d),Oe&&z(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){ht(o,e);continue}if("attributename"===c&&A(d,"href")){ht(o,e);continue}if(i.forceKeepAttr)continue;if(!i.keepAttr){ht(o,e);continue}if(!De&&z(/\/>/i,d)){ht(o,e);continue}Le&&b([ue,de,fe],(e=>{d=S(d,e," ")}));const f=lt(e.nodeName);if(Tt(f,c,d)){if(Q&&"object"==typeof L&&"function"==typeof L.getAttributeType)if(s);else switch(L.getAttributeType(f,c)){case"TrustedHTML":d=Q.createHTML(d);break;case"TrustedScriptURL":d=Q.createScriptURL(d)}if(d!==u)try{s?e.setAttributeNS(s,o,d):e.setAttribute(o,d),xt(e)?gt(e):x(n.removed)}catch(t){ht(o,e)}}else ht(o,e)}wt(ce.afterSanitizeAttributes,e,null)},Et=function e(t){let n=null;const i=yt(t);for(wt(ce.beforeSanitizeShadowDOM,t,null);n=i.nextNode();)wt(ce.uponSanitizeShadowNode,n,null),kt(n),St(n),n.content instanceof o&&e(n.content);wt(ce.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null,a=null,s=null,l=null;if(et=!e,et&&(e="\x3c!--\x3e"),"string"!=typeof e&&!vt(e)){if("function"!=typeof e.toString)throw D("toString is not a function");if("string"!=typeof(e=""+e))throw D("dirty is not a string, aborting")}if(!n.isSupported)return e;if($e||ft(t),n.removed=[],"string"==typeof e&&(Ue=!1),Ue){if(e.nodeName){const t=lt(e.nodeName);if(!xe[t]||Ae[t])throw D("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof c)i=bt("\x3c!----\x3e"),a=i.ownerDocument.importNode(e,!0),1===a.nodeType&&"BODY"===a.nodeName||"HTML"===a.nodeName?i=a:i.appendChild(a);else{if(!Fe&&!Le&&!Ce&&-1===e.indexOf("<"))return Q&&Ne?Q.createHTML(e):e;if(i=bt(e),!i)return Fe?null:Ne?ee:""}i&&Me&&gt(i.firstChild);const u=yt(Ue?e:i);for(;s=u.nextNode();)kt(s),St(s),s.content instanceof o&&Et(s.content);if(Ue)return e;if(Fe){if(Ie)for(l=oe.call(i.ownerDocument);i.firstChild;)l.appendChild(i.firstChild);else l=i;return(we.shadowroot||we.shadowrootmode)&&(l=le.call(r,l,!0)),l}let d=Ce?i.outerHTML:i.innerHTML;return Ce&&xe["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&z(te,i.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+i.ownerDocument.doctype.name+">\n"+d),Le&&b([ue,de,fe],(e=>{d=S(d,e," ")})),Q&&Ne?Q.createHTML(d):d},n.setConfig=function(){ft(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),$e=!0},n.clearConfig=function(){ct=null,$e=!1},n.isValidAttribute=function(e,t,n){ct||ft({});const i=lt(e),r=lt(t);return Tt(i,r,n)},n.addHook=function(e,t){"function"==typeof t&&v(ce[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=y(ce[e],t);return-1===n?void 0:w(ce[e],n,1)[0]}return x(ce[e])},n.removeHooks=function(e){ce[e]=[]},n.removeAllHooks=function(){ce={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();const oe={ALLOWED_TAGS:["p","br","strong","em","del","code","pre","ul","ol","li","h2","h3","a","blockquote","table","thead","tbody","tr","th","td"],ALLOWED_ATTR:["href","target","rel"]},se=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.messageCopy=n(this,"messageCopy"),this.messageFeedback=n(this,"messageFeedback"),this.messageRegenerate=n(this,"messageRegenerate")}role="user";content="";format="text";agentName="";timestamp="";showActions=!0;enableRegenerate=!1;feedbackValue=null;messageCopy;messageFeedback;messageRegenerate;copySuccess=!1;copyTimeout;disconnectedCallback(){this.copyTimeout&&clearTimeout(this.copyTimeout)}renderIcon(e,t=16){const n=o[e];return n?i("span",{class:"icon-wrap",innerHTML:`<svg width="${t}" height="${t}" viewBox="${n.viewBox}" fill="none" xmlns="http://www.w3.org/2000/svg">${n.content}</svg>`}):null}parseMarkdown(e){let t=e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");const n=[];return t=t.replace(/```(?:\w+)?\n?([\s\S]*?)```/g,((e,t)=>{const i=n.length;return n.push(`<pre><code>${t}</code></pre>`),`\0BLOCK${i}\0`})),t=t.replace(/((?:^[ \t]*\|.+\|\n?)+)/gm,(e=>{const t=e.trim().split("\n").filter((e=>e.trim()));if(t.length<2)return e;let i="<table>",r=!1;t.forEach(((e,t)=>{if((e=>/^[\s|:-]+$/.test(e))(e))return r=!0,void(i+="<tbody>");const n=e.split("|").filter(((e,t,n)=>t>0&&t<n.length-1));i+=r||0!==t?`<tr>${n.map((e=>`<td>${e.trim()}</td>`)).join("")}</tr>`:`<thead><tr>${n.map((e=>`<th>${e.trim()}</th>`)).join("")}</tr></thead>`})),r&&(i+="</tbody>"),i+="</table>";const a=n.length;return n.push(i),`\0BLOCK${a}\0`})),t=t.replace(/((?:^&gt; .+\n?)+)/gm,(e=>{const t=e.replace(/^&gt; /gm,"").trim(),i=n.length;return n.push(`<blockquote>${t}</blockquote>`),`\0BLOCK${i}\0`})),t=t.replace(/`([^`]+)`/g,"<code>$1</code>"),t=t.replace(/^## (.+)$/gm,"<h2>$1</h2>"),t=t.replace(/^### (.+)$/gm,"<h3>$1</h3>"),t=t.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),t=t.replace(/\*([^*\n]+)\*/g,"<em>$1</em>"),t=t.replace(/~~(.+?)~~/g,"<del>$1</del>"),t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>'),t=t.replace(/((?:^[ \t]*[-*] .+\n?)+)/gm,(e=>{const t=e.trim().split("\n").filter((e=>e.trim())).map((e=>`<li>${e.replace(/^[ \t]*[-*] /,"")}</li>`)).join(""),i=n.length;return n.push(`<ul>${t}</ul>`),`\0BLOCK${i}\0`})),t=t.replace(/((?:^[ \t]*\d+\. .+\n?)+)/gm,(e=>{const t=e.trim().split("\n").filter((e=>e.trim())).map((e=>`<li>${e.replace(/^[ \t]*\d+\. /,"")}</li>`)).join(""),i=n.length;return n.push(`<ol>${t}</ol>`),`\0BLOCK${i}\0`})),t=t.split(/\n{2,}/).map((e=>{const t=e.trim();return t?/^\x00BLOCK\d+\x00$/.test(t)?t:`<p>${t.replace(/\n/g,"<br>")}</p>`:""})).join(""),t=t.replace(/\x00BLOCK(\d+)\x00/g,((e,t)=>n[parseInt(t,10)]||"")),t}getRenderedContent(){if(!this.content)return"";try{return ae.sanitize(this.parseMarkdown(this.content),oe)}catch{return ae.sanitize(`<p>${this.content.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"<br>")}</p>`,oe)}}getRelativeTime(){if(!this.timestamp)return"";try{const e=new Date(this.timestamp);if(isNaN(e.getTime()))return this.timestamp;const t=Date.now()-e.getTime(),n=Math.floor(t/6e4),i=Math.floor(n/60),r=Math.floor(i/24),a="undefined"!=typeof document&&document.documentElement.lang||"ar",o=new Intl.RelativeTimeFormat(a,{numeric:"auto"});return n<1?o.format(0,"second"):n<60?o.format(-n,"minute"):i<24?o.format(-i,"hour"):o.format(-r,"day")}catch{return this.timestamp}}async handleCopy(){try{await navigator.clipboard.writeText(this.content)}catch(e){}this.copySuccess=!0,this.messageCopy.emit(),this.copyTimeout=setTimeout((()=>this.copySuccess=!1),1500)}handleFeedback(e){this.feedbackValue=this.feedbackValue===e?null:e,this.messageFeedback.emit(e)}renderActionsBar(){return i("div",{class:"actions-bar"},this.enableRegenerate&&i("button",{class:"action-btn",onClick:()=>this.messageRegenerate.emit(),title:"إعادة تحميل"},this.renderIcon("reload",16)),i("button",{class:"action-btn copy-btn"+(this.copySuccess?" copy-success":""),onClick:()=>this.handleCopy(),title:"نسخ"},this.renderIcon("copy",16)),i("div",{class:"feedback-group"},i("button",{class:"feedback-btn thumbs-down-btn"+("down"===this.feedbackValue?" active":""),onClick:()=>this.handleFeedback("down"),title:"غير مفيد"},this.renderIcon("thumbs-down",16)),i("button",{class:"feedback-btn thumbs-up-btn"+("up"===this.feedbackValue?" active":""),onClick:()=>this.handleFeedback("up"),title:"مفيد"},this.renderIcon("thumbs-up",16))))}renderUserMessage(){return i("div",{class:"message-row user-row"},i("div",{class:"bubble user-bubble"},i("div",{class:"message-content",ref:e=>{e&&("markdown"===this.format?e.innerHTML=this.getRenderedContent():e.textContent=this.content)}})))}renderAgentMessage(){const e=this.showActions;return i("div",{class:"message-row agent-row"},i("div",{class:"agent-bubble-wrapper"},i("div",{class:"bubble agent-bubble"},this.content&&i("div",{class:"message-content",ref:e=>{e&&("markdown"===this.format?e.innerHTML=this.getRenderedContent():e.textContent=this.content)}}),i("slot",null),e&&this.renderActionsBar()),(this.agentName||this.timestamp)&&i("div",{class:"agent-info"},this.agentName&&i("span",{class:"agent-info-name"},this.agentName),this.agentName&&this.timestamp&&this.renderIcon("eclipse",10),this.timestamp&&i("span",{class:"agent-info-time"},this.getRelativeTime()))))}render(){return i(r,{key:"f8a49971896742ae952d84efb1527ed0db440876"},"user"===this.role?this.renderUserMessage():this.renderAgentMessage())}static get style(){return":host{--ai-msg-user-bg:var(--ai-user-bubble-bg);--ai-msg-user-border:1px solid var(--ai-border-default);--ai-msg-agent-bg:var(--ai-agent-bubble-bg);--ai-msg-agent-border:1px solid var(--ai-border-default);--ai-msg-border-radius:16px;--ai-msg-padding:16px;--ai-msg-font-size:14px;--ai-msg-action-active-bg:var(--ai-accent);--ai-user-msg-max-width:80%;--ai-agent-msg-max-width:80%;display:block}.message-row{display:flex}.user-row{flex-direction:column;align-items:flex-end}.user-bubble{background:var(--ai-msg-user-bg);color:var(--ai-text-primary);border:var(--ai-msg-user-border);border-radius:var(--ai-msg-border-radius);padding:var(--ai-msg-padding);font-size:var(--ai-msg-font-size);max-width:var(--ai-user-msg-max-width);line-height:1.5;word-break:break-word;box-shadow:var(--ai-shadow-sm)}.user-row .timestamp{font-size:12px;color:var(--ai-text-secondary);margin-top:4px}.agent-row{flex-direction:row;justify-content:flex-start}.agent-bubble-wrapper{display:flex;flex-direction:column;gap:6px;width:100%;max-width:var(--ai-msg-agent-max-width);min-width:0}.agent-bubble{background:var(--ai-msg-agent-bg);color:var(--ai-text-primary);border:var(--ai-msg-agent-border);border-radius:var(--ai-msg-border-radius);padding:var(--ai-msg-padding);font-size:var(--ai-msg-font-size);line-height:1.6;word-break:break-word;box-shadow:var(--ai-shadow-sm);display:flex;flex-direction:column;gap:12px}.message-content{white-space:pre-wrap}.message-content p{margin:0 0 8px 0}.message-content p:last-child{margin-bottom:0}.message-content h2{font-size:16px;font-weight:700;margin:0 0 8px 0}.message-content h3{font-size:15px;font-weight:600;margin:0 0 6px 0}.message-content strong{font-weight:700}.message-content em{font-style:italic}.message-content code{background:var(--ai-bg-surface);border-radius:4px;padding:1px 5px;font-family:var(--ai-font-family-mono);font-size:13px;color:var(--ai-text-primary)}.message-content pre{background:var(--ai-bg-surface);border-radius:8px;padding:10px 12px;overflow-x:auto;margin:8px 0}.message-content pre code{background:none;padding:0;font-size:13px}.message-content ul,.message-content ol{padding-inline-start:20px;margin:4px 0 8px 0}.message-content li{margin-bottom:3px}.actions-bar{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:6px;height:32px}.action-btn{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:8px;background:var(--ai-bg-card);border:1px solid var(--ai-border-default);cursor:pointer;color:var(--ai-text-primary);transition:background 0.15s, color 0.15s;padding:0;flex-shrink:0}.action-btn:hover{background:var(--ai-bg-surface)}.action-btn.copy-success{background:var(--ai-msg-action-active-bg);color:var(--ai-accent-text);border-color:var(--ai-accent)}.feedback-group{display:flex;align-items:center;border:1px solid var(--ai-border-default);border-radius:8px;overflow:hidden;background:var(--ai-bg-card)}.feedback-btn{display:flex;align-items:center;justify-content:center;height:32px;padding:0 8px;background:var(--ai-bg-card);border:none;border-inline-start:1px solid var(--ai-border-default);cursor:pointer;color:var(--ai-text-primary);transition:background 0.15s, color 0.15s}.feedback-btn:first-child{border-inline-start:none}.feedback-btn:hover{background:var(--ai-bg-surface)}.feedback-btn.active{background:var(--ai-msg-action-active-bg);color:var(--ai-accent-text)}.icon-wrap{display:flex;align-items:center;justify-content:center;line-height:0}.agent-info{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:6px;color:var(--ai-text-muted)}.agent-info-name,.agent-info-time{font-size:12px;color:inherit;line-height:16px;white-space:nowrap}.agent-info .icon-wrap{display:flex;align-items:center;color:inherit;opacity:0.6;flex-shrink:0}.typing-indicator{display:flex;align-items:center;gap:5px;padding:4px 2px}.typing-dot{width:8px;height:8px;border-radius:50%;background:var(--ai-text-muted);animation:typingBounce 1.2s ease-in-out infinite}.typing-dot:nth-child(2){animation-delay:0.2s}.typing-dot:nth-child(3){animation-delay:0.4s}@keyframes typingBounce{0%,60%,100%{transform:translateY(0)}30%{transform:translateY(-6px)}}.streaming-cursor{display:inline-block;width:2px;height:1em;background:currentColor;vertical-align:text-bottom;margin-inline-start:2px;animation:cursorBlink 0.8s step-start infinite}@keyframes cursorBlink{0%,100%{opacity:1}50%{opacity:0}}"}},[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]}]),le=se,ce=function(){"undefined"!=typeof customElements&&["ai-chat-message"].forEach((e=>{"ai-chat-message"===e&&(customElements.get(a(e))||customElements.define(a(e),se))}))};export{le as AiChatMessage,ce as defineCustomElement}
@@ -1 +1 @@
1
- import{p as i,H as e,c as a,h as t,d as n,t as r}from"./p-BPkf7wZg.js";import{i as s}from"./p-DlD8m3rf.js";import{d as o}from"./p-DCJWSYj-.js";import{d as l}from"./p-DZuBxUde.js";const g=[{value:1,icon:"emoji-angry",label:"سيئ جداً"},{value:2,icon:"emoji-frowning",label:"سيئ"},{value:3,icon:"emoji-neutral",label:"مقبول"},{value:4,icon:"emoji-slightly-smiling",label:"جيد"},{value:5,icon:"emoji-heart-eyes",label:"ممتاز"}],c=i(class extends e{constructor(i){super(),!1!==i&&this.__registerHost(),this.__attachShadow(),this.ratingChange=a(this,"ratingChange")}question="كيف كانت تجربتك؟";subtitle="رأيك يساعدنا نحسن الخدمة";successMessage="شكراً لتقييمك!";value=null;disabled=!1;hovered=null;submitted=!1;ratingChange;select(i){this.disabled||this.submitted||(this.value=i,this.submitted=!0,this.ratingChange.emit(this.value))}get hoveredLabel(){return null===this.hovered?null:g.find((i=>i.value===this.hovered))?.label??null}render(){const i=this.hoveredLabel;return t(n,null,t("ai-card",null,this.submitted?t("div",{class:"rating rating--success"},t("ai-icon",{name:"check-circle",size:32}),t("p",{class:"rating__success-message"},this.successMessage)):t("div",{class:"rating"},t("div",{class:"rating__text"},t("p",{class:"rating__question"},this.question),t("p",{class:"rating__subtitle"},this.subtitle)),t("div",{class:"rating__icons",role:"group","aria-label":this.question},g.map((i=>{const e=this.value===i.value,a=s[i.icon];return t("button",{key:i.value,class:{"emoji-btn":!0,"emoji-btn--active":e,"emoji-btn--hovered":this.hovered===i.value&&!e,"emoji-btn--disabled":this.disabled},"aria-label":i.label,"aria-pressed":e?"true":"false",disabled:this.disabled,onClick:()=>this.select(i.value),onMouseEnter:()=>this.hovered=i.value,onMouseLeave:()=>this.hovered=null},t("span",{class:"emoji-btn__icon","aria-hidden":"true"},t("svg",{width:24,height:24,viewBox:a.viewBox,xmlns:"http://www.w3.org/2000/svg",ref:i=>i&&(i.innerHTML=a.content)})))}))),i&&t("p",{class:"rating__hover-label"},i))))}static get style(){return":host{--ai-rating-question-size:16px;--ai-rating-subtitle-size:14px;--ai-rating-gap:8px;--ai-rating-emoji-size:24px;--ai-rating-btn-padding:6px;--ai-rating-btn-border:1px solid var(--ai-border-light);--ai-rating-btn-radius:9999px;--ai-rating-btn-bg-hover:var(--ai-bg-surface);--ai-rating-btn-border-hover:1px solid var(--ai-border-default);--ai-rating-btn-bg-active:var(--ai-warning-bg);--ai-rating-btn-border-active:1px solid var(--ai-warning-border);--ai-rating-btn-shadow-active:var(--ai-shadow-active);--ai-rating-label-size:16px;display:block}.rating{display:flex;flex-direction:column;align-items:center;gap:var(--ai-rating-gap);width:100%}.rating__text{display:flex;flex-direction:column;align-items:center;gap:2px;width:100%;text-align:center}.rating__question{margin:0;font-size:var(--ai-rating-question-size);font-weight:500;line-height:24px;color:var(--ai-text-primary)}.rating__subtitle{margin:0;font-size:var(--ai-rating-subtitle-size);font-weight:400;line-height:20px;color:var(--ai-text-secondary)}.rating__icons{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;flex-wrap:wrap}.emoji-btn{display:inline-flex;align-items:center;justify-content:center;padding:var(--ai-rating-btn-padding);border:var(--ai-rating-btn-border);border-radius:var(--ai-rating-btn-radius);background:transparent;cursor:pointer;transition:background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;outline:none}.emoji-btn:focus-visible{outline:2px solid var(--ai-warning-border);outline-offset:2px}.emoji-btn:hover:not(:disabled),.emoji-btn--hovered{background:var(--ai-rating-btn-bg-hover);border:var(--ai-rating-btn-border-hover);transform:scale(1.1)}.emoji-btn--active{background:var(--ai-rating-btn-bg-active) !important;border:var(--ai-rating-btn-border-active) !important;box-shadow:var(--ai-rating-btn-shadow-active);transform:scale(1.18) !important}.emoji-btn--disabled{opacity:0.45;cursor:not-allowed;pointer-events:none}.emoji-btn__icon{font-size:var(--ai-rating-emoji-size);line-height:1;display:inline-flex;align-items:center;justify-content:center;width:var(--ai-rating-emoji-size);height:var(--ai-rating-emoji-size);pointer-events:none}.rating__hover-label{margin:0;font-size:var(--ai-rating-label-size);font-weight:500;line-height:24px;color:var(--ai-text-primary);text-align:center;width:100%;animation:fadeIn 0.15s ease}.rating--success{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:16px 0;animation:fadeIn 0.2s ease}.rating__success-message{margin:0;font-size:var(--ai-rating-question-size);font-weight:500;line-height:24px;color:var(--ai-text-primary);text-align:center}@keyframes fadeIn{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}"}},[513,"ai-rating",{question:[1],subtitle:[1],successMessage:[1,"success-message"],value:[1026],disabled:[4],hovered:[32],submitted:[32]}]),d=c,b=function(){"undefined"!=typeof customElements&&["ai-rating","ai-card","ai-icon"].forEach((i=>{switch(i){case"ai-rating":customElements.get(r(i))||customElements.define(r(i),c);break;case"ai-card":customElements.get(r(i))||o();break;case"ai-icon":customElements.get(r(i))||l()}}))};export{d as AiRating,b as defineCustomElement}
1
+ import{p as i,H as e,c as t,h as a,d as n,t as r}from"./p-BPkf7wZg.js";import{i as s}from"./p-DlD8m3rf.js";import{d as o}from"./p-DCJWSYj-.js";import{d as l}from"./p-DZuBxUde.js";const g=[{value:1,icon:"emoji-angry",label:"سيئ جداً"},{value:2,icon:"emoji-frowning",label:"سيئ"},{value:3,icon:"emoji-neutral",label:"مقبول"},{value:4,icon:"emoji-slightly-smiling",label:"جيد"},{value:5,icon:"emoji-heart-eyes",label:"ممتاز"}],c=i(class extends e{constructor(i){super(),!1!==i&&this.__registerHost(),this.__attachShadow(),this.ratingChange=t(this,"ratingChange")}question="كيف كانت تجربتك؟";subtitle="رأيك يساعدنا نحسن الخدمة";successMessage="شكراً لتقييمك!";value=null;disabled=!1;hovered=null;submitted=!1;ratingChange;select(i){this.disabled||this.submitted||(this.value=i,this.submitted=!0,this.ratingChange.emit(this.value))}get hoveredLabel(){return null===this.hovered?null:g.find((i=>i.value===this.hovered))?.label??null}render(){const i=this.hoveredLabel;return a(n,null,a("ai-card",null,this.submitted?a("div",{class:"rating rating--success"},a("ai-icon",{name:"check-circle",size:32}),a("p",{class:"rating__success-message"},this.successMessage)):a("div",{class:"rating"},a("div",{class:"rating__text"},a("p",{class:"rating__question"},this.question),a("p",{class:"rating__subtitle"},this.subtitle)),a("div",{class:"rating__icons",role:"group","aria-label":this.question,onMouseLeave:()=>this.hovered=null},g.map((i=>{const e=this.value===i.value,t=s[i.icon];return a("button",{key:i.value,class:{"emoji-btn":!0,"emoji-btn--active":e,"emoji-btn--hovered":this.hovered===i.value&&!e,"emoji-btn--disabled":this.disabled},"aria-label":i.label,"aria-pressed":e?"true":"false",disabled:this.disabled,onClick:()=>this.select(i.value),onMouseEnter:()=>this.hovered=i.value},a("span",{class:"emoji-btn__icon","aria-hidden":"true"},a("svg",{width:24,height:24,viewBox:t.viewBox,xmlns:"http://www.w3.org/2000/svg",ref:i=>i&&(i.innerHTML=t.content)})))}))),a("p",{class:{"rating__hover-label":!0,"rating__hover-label--visible":null!==i}},i??" "))))}static get style(){return":host{--ai-rating-question-size:16px;--ai-rating-subtitle-size:14px;--ai-rating-gap:8px;--ai-rating-emoji-size:24px;--ai-rating-btn-padding:6px;--ai-rating-btn-border:1px solid var(--ai-border-light);--ai-rating-btn-radius:9999px;--ai-rating-btn-bg-hover:var(--ai-bg-surface);--ai-rating-btn-border-hover:1px solid var(--ai-border-default);--ai-rating-btn-bg-active:var(--ai-warning-bg);--ai-rating-btn-border-active:1px solid var(--ai-warning-border);--ai-rating-btn-shadow-active:var(--ai-shadow-active);--ai-rating-label-size:16px;display:block}.rating{display:flex;flex-direction:column;align-items:center;gap:var(--ai-rating-gap);width:100%}.rating__text{display:flex;flex-direction:column;align-items:center;gap:2px;width:100%;text-align:center}.rating__question{margin:0;font-size:var(--ai-rating-question-size);font-weight:500;line-height:24px;color:var(--ai-text-primary)}.rating__subtitle{margin:0;font-size:var(--ai-rating-subtitle-size);font-weight:400;line-height:20px;color:var(--ai-text-secondary)}.rating__icons{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;flex-wrap:wrap}.emoji-btn{display:inline-flex;align-items:center;justify-content:center;padding:var(--ai-rating-btn-padding);border:var(--ai-rating-btn-border);border-radius:var(--ai-rating-btn-radius);background:transparent;cursor:pointer;transition:background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;outline:none}.emoji-btn:focus-visible{outline:2px solid var(--ai-warning-border);outline-offset:2px}.emoji-btn:hover:not(:disabled),.emoji-btn--hovered{background:var(--ai-rating-btn-bg-hover);border:var(--ai-rating-btn-border-hover);transform:scale(1.1)}.emoji-btn--active{background:var(--ai-rating-btn-bg-active) !important;border:var(--ai-rating-btn-border-active) !important;box-shadow:var(--ai-rating-btn-shadow-active);transform:scale(1.18) !important}.emoji-btn--disabled{opacity:0.45;cursor:not-allowed;pointer-events:none}.emoji-btn__icon{font-size:var(--ai-rating-emoji-size);line-height:1;display:inline-flex;align-items:center;justify-content:center;width:var(--ai-rating-emoji-size);height:var(--ai-rating-emoji-size);pointer-events:none}.rating__hover-label{margin:0;font-size:var(--ai-rating-label-size);font-weight:500;line-height:24px;color:var(--ai-text-primary);text-align:center;width:100%;min-height:24px;opacity:0;visibility:hidden;transition:opacity 0.15s ease, visibility 0.15s ease}.rating__hover-label--visible{opacity:1;visibility:visible}.rating--success{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:16px 0;animation:fadeIn 0.2s ease}.rating__success-message{margin:0;font-size:var(--ai-rating-question-size);font-weight:500;line-height:24px;color:var(--ai-text-primary);text-align:center}@keyframes fadeIn{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}"}},[513,"ai-rating",{question:[1],subtitle:[1],successMessage:[1,"success-message"],value:[1026],disabled:[4],hovered:[32],submitted:[32]}]),d=c,b=function(){"undefined"!=typeof customElements&&["ai-rating","ai-card","ai-icon"].forEach((i=>{switch(i){case"ai-rating":customElements.get(r(i))||customElements.define(r(i),c);break;case"ai-card":customElements.get(r(i))||o();break;case"ai-icon":customElements.get(r(i))||l()}}))};export{d as AiRating,b as defineCustomElement}
@@ -1387,7 +1387,7 @@ function createDOMPurify() {
1387
1387
  }
1388
1388
  var purify = createDOMPurify();
1389
1389
 
1390
- const aiChatMessageCss = () => `:host{--ai-msg-user-bg:var(--ai-user-bubble-bg);--ai-msg-user-border:1px solid var(--ai-border-default);--ai-msg-agent-bg:var(--ai-agent-bubble-bg);--ai-msg-agent-border:1px solid var(--ai-border-default);--ai-msg-border-radius:16px;--ai-msg-padding:16px;--ai-msg-font-size:14px;--ai-msg-action-active-bg:var(--ai-accent);--ai-user-msg-max-width:80%;--ai-agent-msg-max-width:80%;display:block}.message-row{display:flex}.user-row{flex-direction:column;align-items:flex-end}.user-bubble{background:var(--ai-msg-user-bg);color:var(--ai-text-primary);border:var(--ai-msg-user-border);border-radius:var(--ai-msg-border-radius);padding:var(--ai-msg-padding);font-size:var(--ai-msg-font-size);max-width:var(--ai-user-msg-max-width);line-height:1.5;word-break:break-word;box-shadow:var(--ai-shadow-sm)}.user-row .timestamp{font-size:12px;color:var(--ai-text-secondary);margin-top:4px}.agent-row{flex-direction:row;justify-content:flex-start}.agent-bubble-wrapper{display:flex;flex-direction:column;gap:6px;width:100%;max-width:var(--ai-msg-agent-max-width);min-width:0}.agent-bubble{background:var(--ai-msg-agent-bg);color:var(--ai-text-primary);border:var(--ai-msg-agent-border);border-radius:var(--ai-msg-border-radius);padding:var(--ai-msg-padding);font-size:var(--ai-msg-font-size);line-height:1.6;word-break:break-word;box-shadow:var(--ai-shadow-sm);display:flex;flex-direction:column;gap:12px}.message-content{white-space:pre-wrap}.message-content p{margin:0 0 8px 0}.message-content p:last-child{margin-bottom:0}.message-content h2{font-size:16px;font-weight:700;margin:0 0 8px 0}.message-content h3{font-size:15px;font-weight:600;margin:0 0 6px 0}.message-content strong{font-weight:700}.message-content em{font-style:italic}.message-content code{background:var(--ai-bg-surface);border-radius:4px;padding:1px 5px;font-family:var(--ai-font-family-mono);font-size:13px;color:var(--ai-text-primary)}.message-content pre{background:var(--ai-bg-surface);border-radius:8px;padding:10px 12px;overflow-x:auto;margin:8px 0}.message-content pre code{background:none;padding:0;font-size:13px}.message-content ul,.message-content ol{padding-inline-start:20px;margin:4px 0 8px 0}.message-content li{margin-bottom:3px}.actions-bar{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:6px;height:0;overflow:hidden;opacity:0;pointer-events:none;transition:height 0.15s ease, opacity 0.15s ease}.agent-bubble:hover .actions-bar{height:32px;opacity:1;pointer-events:auto}.action-btn{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:8px;background:var(--ai-bg-card);border:1px solid var(--ai-border-default);cursor:pointer;color:var(--ai-text-primary);transition:background 0.15s, color 0.15s;padding:0;flex-shrink:0}.action-btn:hover{background:var(--ai-bg-surface)}.action-btn.copy-success{background:var(--ai-msg-action-active-bg);color:var(--ai-accent-text);border-color:var(--ai-accent)}.feedback-group{display:flex;align-items:center;border:1px solid var(--ai-border-default);border-radius:8px;overflow:hidden;background:var(--ai-bg-card)}.feedback-btn{display:flex;align-items:center;justify-content:center;height:32px;padding:0 8px;background:var(--ai-bg-card);border:none;border-inline-start:1px solid var(--ai-border-default);cursor:pointer;color:var(--ai-text-primary);transition:background 0.15s, color 0.15s}.feedback-btn:first-child{border-inline-start:none}.feedback-btn:hover{background:var(--ai-bg-surface)}.feedback-btn.active{background:var(--ai-msg-action-active-bg);color:var(--ai-accent-text)}.icon-wrap{display:flex;align-items:center;justify-content:center;line-height:0}.agent-info{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:6px;color:var(--ai-text-muted)}.agent-info-name,.agent-info-time{font-size:12px;color:inherit;line-height:16px;white-space:nowrap}.agent-info .icon-wrap{display:flex;align-items:center;color:inherit;opacity:0.6;flex-shrink:0}.typing-indicator{display:flex;align-items:center;gap:5px;padding:4px 2px}.typing-dot{width:8px;height:8px;border-radius:50%;background:var(--ai-text-muted);animation:typingBounce 1.2s ease-in-out infinite}.typing-dot:nth-child(2){animation-delay:0.2s}.typing-dot:nth-child(3){animation-delay:0.4s}@keyframes typingBounce{0%,60%,100%{transform:translateY(0)}30%{transform:translateY(-6px)}}.streaming-cursor{display:inline-block;width:2px;height:1em;background:currentColor;vertical-align:text-bottom;margin-inline-start:2px;animation:cursorBlink 0.8s step-start infinite}@keyframes cursorBlink{0%,100%{opacity:1}50%{opacity:0}}`;
1390
+ const aiChatMessageCss = () => `:host{--ai-msg-user-bg:var(--ai-user-bubble-bg);--ai-msg-user-border:1px solid var(--ai-border-default);--ai-msg-agent-bg:var(--ai-agent-bubble-bg);--ai-msg-agent-border:1px solid var(--ai-border-default);--ai-msg-border-radius:16px;--ai-msg-padding:16px;--ai-msg-font-size:14px;--ai-msg-action-active-bg:var(--ai-accent);--ai-user-msg-max-width:80%;--ai-agent-msg-max-width:80%;display:block}.message-row{display:flex}.user-row{flex-direction:column;align-items:flex-end}.user-bubble{background:var(--ai-msg-user-bg);color:var(--ai-text-primary);border:var(--ai-msg-user-border);border-radius:var(--ai-msg-border-radius);padding:var(--ai-msg-padding);font-size:var(--ai-msg-font-size);max-width:var(--ai-user-msg-max-width);line-height:1.5;word-break:break-word;box-shadow:var(--ai-shadow-sm)}.user-row .timestamp{font-size:12px;color:var(--ai-text-secondary);margin-top:4px}.agent-row{flex-direction:row;justify-content:flex-start}.agent-bubble-wrapper{display:flex;flex-direction:column;gap:6px;width:100%;max-width:var(--ai-msg-agent-max-width);min-width:0}.agent-bubble{background:var(--ai-msg-agent-bg);color:var(--ai-text-primary);border:var(--ai-msg-agent-border);border-radius:var(--ai-msg-border-radius);padding:var(--ai-msg-padding);font-size:var(--ai-msg-font-size);line-height:1.6;word-break:break-word;box-shadow:var(--ai-shadow-sm);display:flex;flex-direction:column;gap:12px}.message-content{white-space:pre-wrap}.message-content p{margin:0 0 8px 0}.message-content p:last-child{margin-bottom:0}.message-content h2{font-size:16px;font-weight:700;margin:0 0 8px 0}.message-content h3{font-size:15px;font-weight:600;margin:0 0 6px 0}.message-content strong{font-weight:700}.message-content em{font-style:italic}.message-content code{background:var(--ai-bg-surface);border-radius:4px;padding:1px 5px;font-family:var(--ai-font-family-mono);font-size:13px;color:var(--ai-text-primary)}.message-content pre{background:var(--ai-bg-surface);border-radius:8px;padding:10px 12px;overflow-x:auto;margin:8px 0}.message-content pre code{background:none;padding:0;font-size:13px}.message-content ul,.message-content ol{padding-inline-start:20px;margin:4px 0 8px 0}.message-content li{margin-bottom:3px}.actions-bar{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:6px;height:32px}.action-btn{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:8px;background:var(--ai-bg-card);border:1px solid var(--ai-border-default);cursor:pointer;color:var(--ai-text-primary);transition:background 0.15s, color 0.15s;padding:0;flex-shrink:0}.action-btn:hover{background:var(--ai-bg-surface)}.action-btn.copy-success{background:var(--ai-msg-action-active-bg);color:var(--ai-accent-text);border-color:var(--ai-accent)}.feedback-group{display:flex;align-items:center;border:1px solid var(--ai-border-default);border-radius:8px;overflow:hidden;background:var(--ai-bg-card)}.feedback-btn{display:flex;align-items:center;justify-content:center;height:32px;padding:0 8px;background:var(--ai-bg-card);border:none;border-inline-start:1px solid var(--ai-border-default);cursor:pointer;color:var(--ai-text-primary);transition:background 0.15s, color 0.15s}.feedback-btn:first-child{border-inline-start:none}.feedback-btn:hover{background:var(--ai-bg-surface)}.feedback-btn.active{background:var(--ai-msg-action-active-bg);color:var(--ai-accent-text)}.icon-wrap{display:flex;align-items:center;justify-content:center;line-height:0}.agent-info{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:6px;color:var(--ai-text-muted)}.agent-info-name,.agent-info-time{font-size:12px;color:inherit;line-height:16px;white-space:nowrap}.agent-info .icon-wrap{display:flex;align-items:center;color:inherit;opacity:0.6;flex-shrink:0}.typing-indicator{display:flex;align-items:center;gap:5px;padding:4px 2px}.typing-dot{width:8px;height:8px;border-radius:50%;background:var(--ai-text-muted);animation:typingBounce 1.2s ease-in-out infinite}.typing-dot:nth-child(2){animation-delay:0.2s}.typing-dot:nth-child(3){animation-delay:0.4s}@keyframes typingBounce{0%,60%,100%{transform:translateY(0)}30%{transform:translateY(-6px)}}.streaming-cursor{display:inline-block;width:2px;height:1em;background:currentColor;vertical-align:text-bottom;margin-inline-start:2px;animation:cursorBlink 0.8s step-start infinite}@keyframes cursorBlink{0%,100%{opacity:1}50%{opacity:0}}`;
1391
1391
 
1392
1392
  const SANITIZE_CONFIG = {
1393
1393
  ALLOWED_TAGS: ['p', 'br', 'strong', 'em', 'del', 'code', 'pre', 'ul', 'ol', 'li', 'h2', 'h3', 'a', 'blockquote', 'table', 'thead', 'tbody', 'tr', 'th', 'td'],
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host } from './index-VMEwYfaX.js';
2
2
  import { i as iconRegistry } from './icon-registry-DlD8m3rf.js';
3
3
 
4
- const aiRatingCss = () => `:host{--ai-rating-question-size:16px;--ai-rating-subtitle-size:14px;--ai-rating-gap:8px;--ai-rating-emoji-size:24px;--ai-rating-btn-padding:6px;--ai-rating-btn-border:1px solid var(--ai-border-light);--ai-rating-btn-radius:9999px;--ai-rating-btn-bg-hover:var(--ai-bg-surface);--ai-rating-btn-border-hover:1px solid var(--ai-border-default);--ai-rating-btn-bg-active:var(--ai-warning-bg);--ai-rating-btn-border-active:1px solid var(--ai-warning-border);--ai-rating-btn-shadow-active:var(--ai-shadow-active);--ai-rating-label-size:16px;display:block}.rating{display:flex;flex-direction:column;align-items:center;gap:var(--ai-rating-gap);width:100%}.rating__text{display:flex;flex-direction:column;align-items:center;gap:2px;width:100%;text-align:center}.rating__question{margin:0;font-size:var(--ai-rating-question-size);font-weight:500;line-height:24px;color:var(--ai-text-primary)}.rating__subtitle{margin:0;font-size:var(--ai-rating-subtitle-size);font-weight:400;line-height:20px;color:var(--ai-text-secondary)}.rating__icons{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;flex-wrap:wrap}.emoji-btn{display:inline-flex;align-items:center;justify-content:center;padding:var(--ai-rating-btn-padding);border:var(--ai-rating-btn-border);border-radius:var(--ai-rating-btn-radius);background:transparent;cursor:pointer;transition:background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;outline:none}.emoji-btn:focus-visible{outline:2px solid var(--ai-warning-border);outline-offset:2px}.emoji-btn:hover:not(:disabled),.emoji-btn--hovered{background:var(--ai-rating-btn-bg-hover);border:var(--ai-rating-btn-border-hover);transform:scale(1.1)}.emoji-btn--active{background:var(--ai-rating-btn-bg-active) !important;border:var(--ai-rating-btn-border-active) !important;box-shadow:var(--ai-rating-btn-shadow-active);transform:scale(1.18) !important}.emoji-btn--disabled{opacity:0.45;cursor:not-allowed;pointer-events:none}.emoji-btn__icon{font-size:var(--ai-rating-emoji-size);line-height:1;display:inline-flex;align-items:center;justify-content:center;width:var(--ai-rating-emoji-size);height:var(--ai-rating-emoji-size);pointer-events:none}.rating__hover-label{margin:0;font-size:var(--ai-rating-label-size);font-weight:500;line-height:24px;color:var(--ai-text-primary);text-align:center;width:100%;animation:fadeIn 0.15s ease}.rating--success{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:16px 0;animation:fadeIn 0.2s ease}.rating__success-message{margin:0;font-size:var(--ai-rating-question-size);font-weight:500;line-height:24px;color:var(--ai-text-primary);text-align:center}@keyframes fadeIn{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}`;
4
+ const aiRatingCss = () => `:host{--ai-rating-question-size:16px;--ai-rating-subtitle-size:14px;--ai-rating-gap:8px;--ai-rating-emoji-size:24px;--ai-rating-btn-padding:6px;--ai-rating-btn-border:1px solid var(--ai-border-light);--ai-rating-btn-radius:9999px;--ai-rating-btn-bg-hover:var(--ai-bg-surface);--ai-rating-btn-border-hover:1px solid var(--ai-border-default);--ai-rating-btn-bg-active:var(--ai-warning-bg);--ai-rating-btn-border-active:1px solid var(--ai-warning-border);--ai-rating-btn-shadow-active:var(--ai-shadow-active);--ai-rating-label-size:16px;display:block}.rating{display:flex;flex-direction:column;align-items:center;gap:var(--ai-rating-gap);width:100%}.rating__text{display:flex;flex-direction:column;align-items:center;gap:2px;width:100%;text-align:center}.rating__question{margin:0;font-size:var(--ai-rating-question-size);font-weight:500;line-height:24px;color:var(--ai-text-primary)}.rating__subtitle{margin:0;font-size:var(--ai-rating-subtitle-size);font-weight:400;line-height:20px;color:var(--ai-text-secondary)}.rating__icons{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;flex-wrap:wrap}.emoji-btn{display:inline-flex;align-items:center;justify-content:center;padding:var(--ai-rating-btn-padding);border:var(--ai-rating-btn-border);border-radius:var(--ai-rating-btn-radius);background:transparent;cursor:pointer;transition:background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;outline:none}.emoji-btn:focus-visible{outline:2px solid var(--ai-warning-border);outline-offset:2px}.emoji-btn:hover:not(:disabled),.emoji-btn--hovered{background:var(--ai-rating-btn-bg-hover);border:var(--ai-rating-btn-border-hover);transform:scale(1.1)}.emoji-btn--active{background:var(--ai-rating-btn-bg-active) !important;border:var(--ai-rating-btn-border-active) !important;box-shadow:var(--ai-rating-btn-shadow-active);transform:scale(1.18) !important}.emoji-btn--disabled{opacity:0.45;cursor:not-allowed;pointer-events:none}.emoji-btn__icon{font-size:var(--ai-rating-emoji-size);line-height:1;display:inline-flex;align-items:center;justify-content:center;width:var(--ai-rating-emoji-size);height:var(--ai-rating-emoji-size);pointer-events:none}.rating__hover-label{margin:0;font-size:var(--ai-rating-label-size);font-weight:500;line-height:24px;color:var(--ai-text-primary);text-align:center;width:100%;min-height:24px;opacity:0;visibility:hidden;transition:opacity 0.15s ease, visibility 0.15s ease}.rating__hover-label--visible{opacity:1;visibility:visible}.rating--success{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:16px 0;animation:fadeIn 0.2s ease}.rating__success-message{margin:0;font-size:var(--ai-rating-question-size);font-weight:500;line-height:24px;color:var(--ai-text-primary);text-align:center}@keyframes fadeIn{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}`;
5
5
 
6
6
  const EMOJI_OPTIONS = [
7
7
  { value: 1, icon: 'emoji-angry', label: 'سيئ جداً' },
@@ -45,7 +45,7 @@ const AiRating = class {
45
45
  if (this.submitted) {
46
46
  return (h(Host, null, h("ai-card", null, h("div", { class: "rating rating--success" }, h("ai-icon", { name: "check-circle", size: 32 }), h("p", { class: "rating__success-message" }, this.successMessage)))));
47
47
  }
48
- return (h(Host, null, h("ai-card", null, h("div", { class: "rating" }, h("div", { class: "rating__text" }, h("p", { class: "rating__question" }, this.question), h("p", { class: "rating__subtitle" }, this.subtitle)), h("div", { class: "rating__icons", role: "group", "aria-label": this.question }, EMOJI_OPTIONS.map(opt => {
48
+ return (h(Host, null, h("ai-card", null, h("div", { class: "rating" }, h("div", { class: "rating__text" }, h("p", { class: "rating__question" }, this.question), h("p", { class: "rating__subtitle" }, this.subtitle)), h("div", { class: "rating__icons", role: "group", "aria-label": this.question, onMouseLeave: () => (this.hovered = null) }, EMOJI_OPTIONS.map(opt => {
49
49
  const isActive = this.value === opt.value;
50
50
  const isHovered = this.hovered === opt.value;
51
51
  const icon = iconRegistry[opt.icon];
@@ -54,8 +54,8 @@ const AiRating = class {
54
54
  'emoji-btn--active': isActive,
55
55
  'emoji-btn--hovered': isHovered && !isActive,
56
56
  'emoji-btn--disabled': this.disabled,
57
- }, "aria-label": opt.label, "aria-pressed": isActive ? 'true' : 'false', disabled: this.disabled, onClick: () => this.select(opt.value), onMouseEnter: () => (this.hovered = opt.value), onMouseLeave: () => (this.hovered = null) }, h("span", { class: "emoji-btn__icon", "aria-hidden": "true" }, h("svg", { width: 24, height: 24, viewBox: icon.viewBox, xmlns: "http://www.w3.org/2000/svg", ref: (el) => el && (el.innerHTML = icon.content) }))));
58
- })), label && h("p", { class: "rating__hover-label" }, label)))));
57
+ }, "aria-label": opt.label, "aria-pressed": isActive ? 'true' : 'false', disabled: this.disabled, onClick: () => this.select(opt.value), onMouseEnter: () => (this.hovered = opt.value) }, h("span", { class: "emoji-btn__icon", "aria-hidden": "true" }, h("svg", { width: 24, height: 24, viewBox: icon.viewBox, xmlns: "http://www.w3.org/2000/svg", ref: (el) => el && (el.innerHTML = icon.content) }))));
58
+ })), h("p", { class: { 'rating__hover-label': true, 'rating__hover-label--visible': label !== null } }, label ?? '\u00A0')))));
59
59
  }
60
60
  };
61
61
  AiRating.style = aiRatingCss();
@@ -1,2 +1,2 @@
1
1
  import{r as e,c as t,h as n,H as i}from"./p-VMEwYfaX.js";import{i as r}from"./p-DlD8m3rf.js";
2
- /*! @license DOMPurify 3.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.3/LICENSE */const{entries:a,setPrototypeOf:o,isFrozen:s,getPrototypeOf:l,getOwnPropertyDescriptor:c}=Object;let{freeze:u,seal:d,create:p}=Object,{apply:f,construct:m}="undefined"!=typeof Reflect&&Reflect;u||(u=function(e){return e}),d||(d=function(e){return e}),f||(f=function(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),r=2;r<n;r++)i[r-2]=arguments[r];return e.apply(t,i)}),m||(m=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return new e(...n)});const g=D(Array.prototype.forEach),h=D(Array.prototype.lastIndexOf),b=D(Array.prototype.pop),y=D(Array.prototype.push),x=D(Array.prototype.splice),v=D(String.prototype.toLowerCase),w=D(String.prototype.toString),k=D(String.prototype.match),T=D(String.prototype.replace),A=D(String.prototype.indexOf),S=D(String.prototype.trim),E=D(Object.prototype.hasOwnProperty),R=D(RegExp.prototype.test),_=(z=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m(z,t)});var z;function D(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return f(e,t,i)}}function L(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:v;o&&o(e,null);let i=t.length;for(;i--;){let r=t[i];if("string"==typeof r){const e=n(r);e!==r&&(s(t)||(t[i]=e),r=e)}e[r]=!0}return e}function O(e){for(let t=0;t<e.length;t++)E(e,t)||(e[t]=null);return e}function C(e){const t=p(null);for(const[n,i]of a(e))E(e,n)&&(t[n]=Array.isArray(i)?O(i):i&&"object"==typeof i&&i.constructor===Object?C(i):i);return t}function M(e,t){for(;null!==e;){const n=c(e,t);if(n){if(n.get)return D(n.get);if("function"==typeof n.value)return D(n.value)}e=l(e)}return function(){return null}}const $=u(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),F=u(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),I=u(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),B=u(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),N=u(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),P=u(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),j=u(["#text"]),U=u(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),W=u(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),q=u(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),H=u(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Y=d(/\{\{[\w\W]*|[\w\W]*\}\}/gm),K=d(/<%[\w\W]*|[\w\W]*%>/gm),G=d(/\$\{[\w\W]*/gm),X=d(/^data-[\-\w.\u00B7-\uFFFF]+$/),V=d(/^aria-[\-\w]+$/),J=d(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Q=d(/^(?:\w+script|data):/i),Z=d(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ee=d(/^html$/i),te=d(/^[a-z][.\w]*(-[.\w]+)+$/i);var ne=Object.freeze({__proto__:null,ARIA_ATTR:V,ATTR_WHITESPACE:Z,CUSTOM_ELEMENT:te,DATA_ATTR:X,DOCTYPE_NAME:ee,ERB_EXPR:K,IS_ALLOWED_URI:J,IS_SCRIPT_OR_DATA:Q,MUSTACHE_EXPR:Y,TMPLIT_EXPR:G});const ie=function(){return"undefined"==typeof window?null:window};var re=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ie();const n=t=>e(t);if(n.version="3.3.3",n.removed=[],!t||!t.document||9!==t.document.nodeType||!t.Element)return n.isSupported=!1,n;let{document:i}=t;const r=i,o=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:l,Node:c,Element:d,NodeFilter:f,NamedNodeMap:m=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:z,DOMParser:D,trustedTypes:O}=t,Y=d.prototype,K=M(Y,"cloneNode"),G=M(Y,"remove"),X=M(Y,"nextSibling"),V=M(Y,"childNodes"),Q=M(Y,"parentNode");if("function"==typeof l){const e=i.createElement("template");e.content&&e.content.ownerDocument&&(i=e.content.ownerDocument)}let Z,te="";const{implementation:re,createNodeIterator:ae,createDocumentFragment:oe,getElementsByTagName:se}=i,{importNode:le}=r;let ce={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof a&&"function"==typeof Q&&re&&void 0!==re.createHTMLDocument;const{MUSTACHE_EXPR:ue,ERB_EXPR:de,TMPLIT_EXPR:pe,DATA_ATTR:fe,ARIA_ATTR:me,IS_SCRIPT_OR_DATA:ge,ATTR_WHITESPACE:he,CUSTOM_ELEMENT:be}=ne;let{IS_ALLOWED_URI:ye}=ne,xe=null;const ve=L({},[...$,...F,...I,...N,...j]);let we=null;const ke=L({},[...U,...W,...q,...H]);let Te=Object.seal(p(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ae=null,Se=null;const Ee=Object.seal(p(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Re=!0,_e=!0,ze=!1,De=!0,Le=!1,Oe=!0,Ce=!1,Me=!1,$e=!1,Fe=!1,Ie=!1,Be=!1,Ne=!0,Pe=!1,je=!0,Ue=!1,We={},qe=null;const He=L({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ye=null;const Ke=L({},["audio","video","img","source","image","track"]);let Ge=null;const Xe=L({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ve="http://www.w3.org/1998/Math/MathML",Je="http://www.w3.org/2000/svg",Qe="http://www.w3.org/1999/xhtml";let Ze=Qe,et=!1,tt=null;const nt=L({},[Ve,Je,Qe],w);let it=L({},["mi","mo","mn","ms","mtext"]),rt=L({},["annotation-xml"]);const at=L({},["title","style","font","a","script"]);let ot=null;const st=["application/xhtml+xml","text/html"];let lt=null,ct=null;const ut=i.createElement("form"),dt=function(e){return e instanceof RegExp||e instanceof Function},pt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!ct||ct!==e){if(e&&"object"==typeof e||(e={}),e=C(e),ot=-1===st.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,lt="application/xhtml+xml"===ot?w:v,xe=E(e,"ALLOWED_TAGS")?L({},e.ALLOWED_TAGS,lt):ve,we=E(e,"ALLOWED_ATTR")?L({},e.ALLOWED_ATTR,lt):ke,tt=E(e,"ALLOWED_NAMESPACES")?L({},e.ALLOWED_NAMESPACES,w):nt,Ge=E(e,"ADD_URI_SAFE_ATTR")?L(C(Xe),e.ADD_URI_SAFE_ATTR,lt):Xe,Ye=E(e,"ADD_DATA_URI_TAGS")?L(C(Ke),e.ADD_DATA_URI_TAGS,lt):Ke,qe=E(e,"FORBID_CONTENTS")?L({},e.FORBID_CONTENTS,lt):He,Ae=E(e,"FORBID_TAGS")?L({},e.FORBID_TAGS,lt):C({}),Se=E(e,"FORBID_ATTR")?L({},e.FORBID_ATTR,lt):C({}),We=!!E(e,"USE_PROFILES")&&e.USE_PROFILES,Re=!1!==e.ALLOW_ARIA_ATTR,_e=!1!==e.ALLOW_DATA_ATTR,ze=e.ALLOW_UNKNOWN_PROTOCOLS||!1,De=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Le=e.SAFE_FOR_TEMPLATES||!1,Oe=!1!==e.SAFE_FOR_XML,Ce=e.WHOLE_DOCUMENT||!1,Fe=e.RETURN_DOM||!1,Ie=e.RETURN_DOM_FRAGMENT||!1,Be=e.RETURN_TRUSTED_TYPE||!1,$e=e.FORCE_BODY||!1,Ne=!1!==e.SANITIZE_DOM,Pe=e.SANITIZE_NAMED_PROPS||!1,je=!1!==e.KEEP_CONTENT,Ue=e.IN_PLACE||!1,ye=e.ALLOWED_URI_REGEXP||J,Ze=e.NAMESPACE||Qe,it=e.MATHML_TEXT_INTEGRATION_POINTS||it,rt=e.HTML_INTEGRATION_POINTS||rt,Te=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&dt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Te.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&dt(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Te.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Te.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Le&&(_e=!1),Ie&&(Fe=!0),We&&(xe=L({},j),we=p(null),!0===We.html&&(L(xe,$),L(we,U)),!0===We.svg&&(L(xe,F),L(we,W),L(we,H)),!0===We.svgFilters&&(L(xe,I),L(we,W),L(we,H)),!0===We.mathMl&&(L(xe,N),L(we,q),L(we,H))),E(e,"ADD_TAGS")||(Ee.tagCheck=null),E(e,"ADD_ATTR")||(Ee.attributeCheck=null),e.ADD_TAGS&&("function"==typeof e.ADD_TAGS?Ee.tagCheck=e.ADD_TAGS:(xe===ve&&(xe=C(xe)),L(xe,e.ADD_TAGS,lt))),e.ADD_ATTR&&("function"==typeof e.ADD_ATTR?Ee.attributeCheck=e.ADD_ATTR:(we===ke&&(we=C(we)),L(we,e.ADD_ATTR,lt))),e.ADD_URI_SAFE_ATTR&&L(Ge,e.ADD_URI_SAFE_ATTR,lt),e.FORBID_CONTENTS&&(qe===He&&(qe=C(qe)),L(qe,e.FORBID_CONTENTS,lt)),e.ADD_FORBID_CONTENTS&&(qe===He&&(qe=C(qe)),L(qe,e.ADD_FORBID_CONTENTS,lt)),je&&(xe["#text"]=!0),Ce&&L(xe,["html","head","body"]),xe.table&&(L(xe,["tbody"]),delete Ae.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw _('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw _('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');Z=e.TRUSTED_TYPES_POLICY,te=Z.createHTML("")}else void 0===Z&&(Z=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(O,o)),null!==Z&&"string"==typeof te&&(te=Z.createHTML(""));u&&u(e),ct=e}},ft=L({},[...F,...I,...B]),mt=L({},[...N,...P]),gt=function(e){y(n.removed,{element:e});try{Q(e).removeChild(e)}catch(t){G(e)}},ht=function(e,t){try{y(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){y(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(Fe||Ie)try{gt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},bt=function(e){let t=null,n=null;if($e)e="<remove></remove>"+e;else{const t=k(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===ot&&Ze===Qe&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const r=Z?Z.createHTML(e):e;if(Ze===Qe)try{t=(new D).parseFromString(r,ot)}catch(e){}if(!t||!t.documentElement){t=re.createDocument(Ze,"template",null);try{t.documentElement.innerHTML=et?te:r}catch(e){}}const a=t.body||t.documentElement;return e&&n&&a.insertBefore(i.createTextNode(n),a.childNodes[0]||null),Ze===Qe?se.call(t,Ce?"html":"body")[0]:Ce?t.documentElement:a},yt=function(e){return ae.call(e.ownerDocument||e,e,f.SHOW_ELEMENT|f.SHOW_COMMENT|f.SHOW_TEXT|f.SHOW_PROCESSING_INSTRUCTION|f.SHOW_CDATA_SECTION,null)},xt=function(e){return e instanceof z&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof m)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},vt=function(e){return"function"==typeof c&&e instanceof c};function wt(e,t,i){g(e,(e=>{e.call(n,t,i,ct)}))}const kt=function(e){let t=null;if(wt(ce.beforeSanitizeElements,e,null),xt(e))return gt(e),!0;const i=lt(e.nodeName);if(wt(ce.uponSanitizeElement,e,{tagName:i,allowedTags:xe}),Oe&&e.hasChildNodes()&&!vt(e.firstElementChild)&&R(/<[/\w!]/g,e.innerHTML)&&R(/<[/\w!]/g,e.textContent))return gt(e),!0;if(7===e.nodeType)return gt(e),!0;if(Oe&&8===e.nodeType&&R(/<[/\w]/g,e.data))return gt(e),!0;if(!(Ee.tagCheck instanceof Function&&Ee.tagCheck(i))&&(!xe[i]||Ae[i])){if(!Ae[i]&&At(i)){if(Te.tagNameCheck instanceof RegExp&&R(Te.tagNameCheck,i))return!1;if(Te.tagNameCheck instanceof Function&&Te.tagNameCheck(i))return!1}if(je&&!qe[i]){const t=Q(e)||e.parentNode,n=V(e)||e.childNodes;if(n&&t)for(let i=n.length-1;i>=0;--i){const r=K(n[i],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,X(e))}}return gt(e),!0}return e instanceof d&&!function(e){let t=Q(e);t&&t.tagName||(t={namespaceURI:Ze,tagName:"template"});const n=v(e.tagName),i=v(t.tagName);return!!tt[e.namespaceURI]&&(e.namespaceURI===Je?t.namespaceURI===Qe?"svg"===n:t.namespaceURI===Ve?"svg"===n&&("annotation-xml"===i||it[i]):Boolean(ft[n]):e.namespaceURI===Ve?t.namespaceURI===Qe?"math"===n:t.namespaceURI===Je?"math"===n&&rt[i]:Boolean(mt[n]):e.namespaceURI===Qe?!(t.namespaceURI===Je&&!rt[i])&&!(t.namespaceURI===Ve&&!it[i])&&!mt[n]&&(at[n]||!ft[n]):!("application/xhtml+xml"!==ot||!tt[e.namespaceURI]))}(e)?(gt(e),!0):"noscript"!==i&&"noembed"!==i&&"noframes"!==i||!R(/<\/no(script|embed|frames)/i,e.innerHTML)?(Le&&3===e.nodeType&&(t=e.textContent,g([ue,de,pe],(e=>{t=T(t,e," ")})),e.textContent!==t&&(y(n.removed,{element:e.cloneNode()}),e.textContent=t)),wt(ce.afterSanitizeElements,e,null),!1):(gt(e),!0)},Tt=function(e,t,n){if(Se[t])return!1;if(Ne&&("id"===t||"name"===t)&&(n in i||n in ut))return!1;if(_e&&!Se[t]&&R(fe,t));else if(Re&&R(me,t));else if(Ee.attributeCheck instanceof Function&&Ee.attributeCheck(t,e));else if(!we[t]||Se[t]){if(!(At(e)&&(Te.tagNameCheck instanceof RegExp&&R(Te.tagNameCheck,e)||Te.tagNameCheck instanceof Function&&Te.tagNameCheck(e))&&(Te.attributeNameCheck instanceof RegExp&&R(Te.attributeNameCheck,t)||Te.attributeNameCheck instanceof Function&&Te.attributeNameCheck(t,e))||"is"===t&&Te.allowCustomizedBuiltInElements&&(Te.tagNameCheck instanceof RegExp&&R(Te.tagNameCheck,n)||Te.tagNameCheck instanceof Function&&Te.tagNameCheck(n))))return!1}else if(Ge[t]);else if(R(ye,T(n,he,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==A(n,"data:")||!Ye[e])if(ze&&!R(ge,T(n,he,"")));else if(n)return!1;return!0},At=function(e){return"annotation-xml"!==e&&k(e,be)},St=function(e){wt(ce.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||xt(e))return;const i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:we,forceKeepAttr:void 0};let r=t.length;for(;r--;){const a=t[r],{name:o,namespaceURI:s,value:l}=a,c=lt(o),u=l;let d="value"===o?u:S(u);if(i.attrName=c,i.attrValue=d,i.keepAttr=!0,i.forceKeepAttr=void 0,wt(ce.uponSanitizeAttribute,e,i),d=i.attrValue,!Pe||"id"!==c&&"name"!==c||(ht(o,e),d="user-content-"+d),Oe&&R(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){ht(o,e);continue}if("attributename"===c&&k(d,"href")){ht(o,e);continue}if(i.forceKeepAttr)continue;if(!i.keepAttr){ht(o,e);continue}if(!De&&R(/\/>/i,d)){ht(o,e);continue}Le&&g([ue,de,pe],(e=>{d=T(d,e," ")}));const p=lt(e.nodeName);if(Tt(p,c,d)){if(Z&&"object"==typeof O&&"function"==typeof O.getAttributeType)if(s);else switch(O.getAttributeType(p,c)){case"TrustedHTML":d=Z.createHTML(d);break;case"TrustedScriptURL":d=Z.createScriptURL(d)}if(d!==u)try{s?e.setAttributeNS(s,o,d):e.setAttribute(o,d),xt(e)?gt(e):b(n.removed)}catch(t){ht(o,e)}}else ht(o,e)}wt(ce.afterSanitizeAttributes,e,null)},Et=function e(t){let n=null;const i=yt(t);for(wt(ce.beforeSanitizeShadowDOM,t,null);n=i.nextNode();)wt(ce.uponSanitizeShadowNode,n,null),kt(n),St(n),n.content instanceof s&&e(n.content);wt(ce.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null,a=null,o=null,l=null;if(et=!e,et&&(e="\x3c!--\x3e"),"string"!=typeof e&&!vt(e)){if("function"!=typeof e.toString)throw _("toString is not a function");if("string"!=typeof(e=e.toString()))throw _("dirty is not a string, aborting")}if(!n.isSupported)return e;if(Me||pt(t),n.removed=[],"string"==typeof e&&(Ue=!1),Ue){if(e.nodeName){const t=lt(e.nodeName);if(!xe[t]||Ae[t])throw _("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof c)i=bt("\x3c!----\x3e"),a=i.ownerDocument.importNode(e,!0),1===a.nodeType&&"BODY"===a.nodeName||"HTML"===a.nodeName?i=a:i.appendChild(a);else{if(!Fe&&!Le&&!Ce&&-1===e.indexOf("<"))return Z&&Be?Z.createHTML(e):e;if(i=bt(e),!i)return Fe?null:Be?te:""}i&&$e&&gt(i.firstChild);const u=yt(Ue?e:i);for(;o=u.nextNode();)kt(o),St(o),o.content instanceof s&&Et(o.content);if(Ue)return e;if(Fe){if(Ie)for(l=oe.call(i.ownerDocument);i.firstChild;)l.appendChild(i.firstChild);else l=i;return(we.shadowroot||we.shadowrootmode)&&(l=le.call(r,l,!0)),l}let d=Ce?i.outerHTML:i.innerHTML;return Ce&&xe["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&R(ee,i.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+i.ownerDocument.doctype.name+">\n"+d),Le&&g([ue,de,pe],(e=>{d=T(d,e," ")})),Z&&Be?Z.createHTML(d):d},n.setConfig=function(){pt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Me=!0},n.clearConfig=function(){ct=null,Me=!1},n.isValidAttribute=function(e,t,n){ct||pt({});const i=lt(e),r=lt(t);return Tt(i,r,n)},n.addHook=function(e,t){"function"==typeof t&&y(ce[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=h(ce[e],t);return-1===n?void 0:x(ce[e],n,1)[0]}return b(ce[e])},n.removeHooks=function(e){ce[e]=[]},n.removeAllHooks=function(){ce={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();const ae={ALLOWED_TAGS:["p","br","strong","em","del","code","pre","ul","ol","li","h2","h3","a","blockquote","table","thead","tbody","tr","th","td"],ALLOWED_ATTR:["href","target","rel"]},oe=class{constructor(n){e(this,n),this.messageCopy=t(this,"messageCopy"),this.messageFeedback=t(this,"messageFeedback"),this.messageRegenerate=t(this,"messageRegenerate")}role="user";content="";format="text";agentName="";timestamp="";showActions=!0;enableRegenerate=!1;feedbackValue=null;messageCopy;messageFeedback;messageRegenerate;copySuccess=!1;copyTimeout;disconnectedCallback(){this.copyTimeout&&clearTimeout(this.copyTimeout)}renderIcon(e,t=16){const i=r[e];return i?n("span",{class:"icon-wrap",innerHTML:`<svg width="${t}" height="${t}" viewBox="${i.viewBox}" fill="none" xmlns="http://www.w3.org/2000/svg">${i.content}</svg>`}):null}parseMarkdown(e){let t=e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");const n=[];return t=t.replace(/```(?:\w+)?\n?([\s\S]*?)```/g,((e,t)=>{const i=n.length;return n.push(`<pre><code>${t}</code></pre>`),`\0BLOCK${i}\0`})),t=t.replace(/((?:^[ \t]*\|.+\|\n?)+)/gm,(e=>{const t=e.trim().split("\n").filter((e=>e.trim()));if(t.length<2)return e;let i="<table>",r=!1;t.forEach(((e,t)=>{if(/^[\s|:-]+$/.test(e))return r=!0,void(i+="<tbody>");const n=e.split("|").filter(((e,t,n)=>t>0&&t<n.length-1));i+=r||0!==t?`<tr>${n.map((e=>`<td>${e.trim()}</td>`)).join("")}</tr>`:`<thead><tr>${n.map((e=>`<th>${e.trim()}</th>`)).join("")}</tr></thead>`})),r&&(i+="</tbody>"),i+="</table>";const a=n.length;return n.push(i),`\0BLOCK${a}\0`})),t=t.replace(/((?:^&gt; .+\n?)+)/gm,(e=>{const t=e.replace(/^&gt; /gm,"").trim(),i=n.length;return n.push(`<blockquote>${t}</blockquote>`),`\0BLOCK${i}\0`})),t=t.replace(/`([^`]+)`/g,"<code>$1</code>"),t=t.replace(/^## (.+)$/gm,"<h2>$1</h2>"),t=t.replace(/^### (.+)$/gm,"<h3>$1</h3>"),t=t.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),t=t.replace(/\*([^*\n]+)\*/g,"<em>$1</em>"),t=t.replace(/~~(.+?)~~/g,"<del>$1</del>"),t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>'),t=t.replace(/((?:^[ \t]*[-*] .+\n?)+)/gm,(e=>{const t=e.trim().split("\n").filter((e=>e.trim())).map((e=>`<li>${e.replace(/^[ \t]*[-*] /,"")}</li>`)).join(""),i=n.length;return n.push(`<ul>${t}</ul>`),`\0BLOCK${i}\0`})),t=t.replace(/((?:^[ \t]*\d+\. .+\n?)+)/gm,(e=>{const t=e.trim().split("\n").filter((e=>e.trim())).map((e=>`<li>${e.replace(/^[ \t]*\d+\. /,"")}</li>`)).join(""),i=n.length;return n.push(`<ol>${t}</ol>`),`\0BLOCK${i}\0`})),t=t.split(/\n{2,}/).map((e=>{const t=e.trim();return t?/^\x00BLOCK\d+\x00$/.test(t)?t:`<p>${t.replace(/\n/g,"<br>")}</p>`:""})).join(""),t=t.replace(/\x00BLOCK(\d+)\x00/g,((e,t)=>n[parseInt(t,10)]||"")),t}getRenderedContent(){if(!this.content)return"";try{return re.sanitize(this.parseMarkdown(this.content),ae)}catch{return re.sanitize(`<p>${this.content.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"<br>")}</p>`,ae)}}getRelativeTime(){if(!this.timestamp)return"";try{const e=new Date(this.timestamp);if(isNaN(e.getTime()))return this.timestamp;const t=Date.now()-e.getTime(),n=Math.floor(t/6e4),i=Math.floor(n/60),r=Math.floor(i/24),a="undefined"!=typeof document&&document.documentElement.lang||"ar",o=new Intl.RelativeTimeFormat(a,{numeric:"auto"});return n<1?o.format(0,"second"):n<60?o.format(-n,"minute"):i<24?o.format(-i,"hour"):o.format(-r,"day")}catch{return this.timestamp}}async handleCopy(){try{await navigator.clipboard.writeText(this.content)}catch(e){}this.copySuccess=!0,this.messageCopy.emit(),this.copyTimeout=setTimeout((()=>this.copySuccess=!1),1500)}handleFeedback(e){this.feedbackValue=this.feedbackValue===e?null:e,this.messageFeedback.emit(e)}renderActionsBar(){return n("div",{class:"actions-bar"},this.enableRegenerate&&n("button",{class:"action-btn",onClick:()=>this.messageRegenerate.emit(),title:"إعادة تحميل"},this.renderIcon("reload",16)),n("button",{class:"action-btn copy-btn"+(this.copySuccess?" copy-success":""),onClick:()=>this.handleCopy(),title:"نسخ"},this.renderIcon("copy",16)),n("div",{class:"feedback-group"},n("button",{class:"feedback-btn thumbs-down-btn"+("down"===this.feedbackValue?" active":""),onClick:()=>this.handleFeedback("down"),title:"غير مفيد"},this.renderIcon("thumbs-down",16)),n("button",{class:"feedback-btn thumbs-up-btn"+("up"===this.feedbackValue?" active":""),onClick:()=>this.handleFeedback("up"),title:"مفيد"},this.renderIcon("thumbs-up",16))))}renderUserMessage(){return n("div",{class:"message-row user-row"},n("div",{class:"bubble user-bubble"},n("div",{class:"message-content",ref:e=>{e&&("markdown"===this.format?e.innerHTML=this.getRenderedContent():e.textContent=this.content)}})))}renderAgentMessage(){const e=this.showActions;return n("div",{class:"message-row agent-row"},n("div",{class:"agent-bubble-wrapper"},n("div",{class:"bubble agent-bubble"},this.content&&n("div",{class:"message-content",ref:e=>{e&&("markdown"===this.format?e.innerHTML=this.getRenderedContent():e.textContent=this.content)}}),n("slot",null),e&&this.renderActionsBar()),(this.agentName||this.timestamp)&&n("div",{class:"agent-info"},this.agentName&&n("span",{class:"agent-info-name"},this.agentName),this.agentName&&this.timestamp&&this.renderIcon("eclipse",10),this.timestamp&&n("span",{class:"agent-info-time"},this.getRelativeTime()))))}render(){return n(i,{key:"f8a49971896742ae952d84efb1527ed0db440876"},"user"===this.role?this.renderUserMessage():this.renderAgentMessage())}};oe.style=":host{--ai-msg-user-bg:var(--ai-user-bubble-bg);--ai-msg-user-border:1px solid var(--ai-border-default);--ai-msg-agent-bg:var(--ai-agent-bubble-bg);--ai-msg-agent-border:1px solid var(--ai-border-default);--ai-msg-border-radius:16px;--ai-msg-padding:16px;--ai-msg-font-size:14px;--ai-msg-action-active-bg:var(--ai-accent);--ai-user-msg-max-width:80%;--ai-agent-msg-max-width:80%;display:block}.message-row{display:flex}.user-row{flex-direction:column;align-items:flex-end}.user-bubble{background:var(--ai-msg-user-bg);color:var(--ai-text-primary);border:var(--ai-msg-user-border);border-radius:var(--ai-msg-border-radius);padding:var(--ai-msg-padding);font-size:var(--ai-msg-font-size);max-width:var(--ai-user-msg-max-width);line-height:1.5;word-break:break-word;box-shadow:var(--ai-shadow-sm)}.user-row .timestamp{font-size:12px;color:var(--ai-text-secondary);margin-top:4px}.agent-row{flex-direction:row;justify-content:flex-start}.agent-bubble-wrapper{display:flex;flex-direction:column;gap:6px;width:100%;max-width:var(--ai-msg-agent-max-width);min-width:0}.agent-bubble{background:var(--ai-msg-agent-bg);color:var(--ai-text-primary);border:var(--ai-msg-agent-border);border-radius:var(--ai-msg-border-radius);padding:var(--ai-msg-padding);font-size:var(--ai-msg-font-size);line-height:1.6;word-break:break-word;box-shadow:var(--ai-shadow-sm);display:flex;flex-direction:column;gap:12px}.message-content{white-space:pre-wrap}.message-content p{margin:0 0 8px 0}.message-content p:last-child{margin-bottom:0}.message-content h2{font-size:16px;font-weight:700;margin:0 0 8px 0}.message-content h3{font-size:15px;font-weight:600;margin:0 0 6px 0}.message-content strong{font-weight:700}.message-content em{font-style:italic}.message-content code{background:var(--ai-bg-surface);border-radius:4px;padding:1px 5px;font-family:var(--ai-font-family-mono);font-size:13px;color:var(--ai-text-primary)}.message-content pre{background:var(--ai-bg-surface);border-radius:8px;padding:10px 12px;overflow-x:auto;margin:8px 0}.message-content pre code{background:none;padding:0;font-size:13px}.message-content ul,.message-content ol{padding-inline-start:20px;margin:4px 0 8px 0}.message-content li{margin-bottom:3px}.actions-bar{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:6px;height:0;overflow:hidden;opacity:0;pointer-events:none;transition:height 0.15s ease, opacity 0.15s ease}.agent-bubble:hover .actions-bar{height:32px;opacity:1;pointer-events:auto}.action-btn{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:8px;background:var(--ai-bg-card);border:1px solid var(--ai-border-default);cursor:pointer;color:var(--ai-text-primary);transition:background 0.15s, color 0.15s;padding:0;flex-shrink:0}.action-btn:hover{background:var(--ai-bg-surface)}.action-btn.copy-success{background:var(--ai-msg-action-active-bg);color:var(--ai-accent-text);border-color:var(--ai-accent)}.feedback-group{display:flex;align-items:center;border:1px solid var(--ai-border-default);border-radius:8px;overflow:hidden;background:var(--ai-bg-card)}.feedback-btn{display:flex;align-items:center;justify-content:center;height:32px;padding:0 8px;background:var(--ai-bg-card);border:none;border-inline-start:1px solid var(--ai-border-default);cursor:pointer;color:var(--ai-text-primary);transition:background 0.15s, color 0.15s}.feedback-btn:first-child{border-inline-start:none}.feedback-btn:hover{background:var(--ai-bg-surface)}.feedback-btn.active{background:var(--ai-msg-action-active-bg);color:var(--ai-accent-text)}.icon-wrap{display:flex;align-items:center;justify-content:center;line-height:0}.agent-info{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:6px;color:var(--ai-text-muted)}.agent-info-name,.agent-info-time{font-size:12px;color:inherit;line-height:16px;white-space:nowrap}.agent-info .icon-wrap{display:flex;align-items:center;color:inherit;opacity:0.6;flex-shrink:0}.typing-indicator{display:flex;align-items:center;gap:5px;padding:4px 2px}.typing-dot{width:8px;height:8px;border-radius:50%;background:var(--ai-text-muted);animation:typingBounce 1.2s ease-in-out infinite}.typing-dot:nth-child(2){animation-delay:0.2s}.typing-dot:nth-child(3){animation-delay:0.4s}@keyframes typingBounce{0%,60%,100%{transform:translateY(0)}30%{transform:translateY(-6px)}}.streaming-cursor{display:inline-block;width:2px;height:1em;background:currentColor;vertical-align:text-bottom;margin-inline-start:2px;animation:cursorBlink 0.8s step-start infinite}@keyframes cursorBlink{0%,100%{opacity:1}50%{opacity:0}}";export{oe as ai_chat_message}
2
+ /*! @license DOMPurify 3.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.3/LICENSE */const{entries:a,setPrototypeOf:o,isFrozen:s,getPrototypeOf:l,getOwnPropertyDescriptor:c}=Object;let{freeze:u,seal:d,create:p}=Object,{apply:f,construct:m}="undefined"!=typeof Reflect&&Reflect;u||(u=function(e){return e}),d||(d=function(e){return e}),f||(f=function(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),r=2;r<n;r++)i[r-2]=arguments[r];return e.apply(t,i)}),m||(m=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return new e(...n)});const g=D(Array.prototype.forEach),h=D(Array.prototype.lastIndexOf),b=D(Array.prototype.pop),y=D(Array.prototype.push),x=D(Array.prototype.splice),v=D(String.prototype.toLowerCase),w=D(String.prototype.toString),k=D(String.prototype.match),T=D(String.prototype.replace),A=D(String.prototype.indexOf),S=D(String.prototype.trim),E=D(Object.prototype.hasOwnProperty),R=D(RegExp.prototype.test),_=(z=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m(z,t)});var z;function D(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return f(e,t,i)}}function L(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:v;o&&o(e,null);let i=t.length;for(;i--;){let r=t[i];if("string"==typeof r){const e=n(r);e!==r&&(s(t)||(t[i]=e),r=e)}e[r]=!0}return e}function O(e){for(let t=0;t<e.length;t++)E(e,t)||(e[t]=null);return e}function C(e){const t=p(null);for(const[n,i]of a(e))E(e,n)&&(t[n]=Array.isArray(i)?O(i):i&&"object"==typeof i&&i.constructor===Object?C(i):i);return t}function M(e,t){for(;null!==e;){const n=c(e,t);if(n){if(n.get)return D(n.get);if("function"==typeof n.value)return D(n.value)}e=l(e)}return function(){return null}}const $=u(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),F=u(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),I=u(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),B=u(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),N=u(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),P=u(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),j=u(["#text"]),U=u(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),W=u(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),q=u(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),H=u(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Y=d(/\{\{[\w\W]*|[\w\W]*\}\}/gm),K=d(/<%[\w\W]*|[\w\W]*%>/gm),G=d(/\$\{[\w\W]*/gm),X=d(/^data-[\-\w.\u00B7-\uFFFF]+$/),V=d(/^aria-[\-\w]+$/),J=d(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Q=d(/^(?:\w+script|data):/i),Z=d(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ee=d(/^html$/i),te=d(/^[a-z][.\w]*(-[.\w]+)+$/i);var ne=Object.freeze({__proto__:null,ARIA_ATTR:V,ATTR_WHITESPACE:Z,CUSTOM_ELEMENT:te,DATA_ATTR:X,DOCTYPE_NAME:ee,ERB_EXPR:K,IS_ALLOWED_URI:J,IS_SCRIPT_OR_DATA:Q,MUSTACHE_EXPR:Y,TMPLIT_EXPR:G});const ie=function(){return"undefined"==typeof window?null:window};var re=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ie();const n=t=>e(t);if(n.version="3.3.3",n.removed=[],!t||!t.document||9!==t.document.nodeType||!t.Element)return n.isSupported=!1,n;let{document:i}=t;const r=i,o=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:l,Node:c,Element:d,NodeFilter:f,NamedNodeMap:m=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:z,DOMParser:D,trustedTypes:O}=t,Y=d.prototype,K=M(Y,"cloneNode"),G=M(Y,"remove"),X=M(Y,"nextSibling"),V=M(Y,"childNodes"),Q=M(Y,"parentNode");if("function"==typeof l){const e=i.createElement("template");e.content&&e.content.ownerDocument&&(i=e.content.ownerDocument)}let Z,te="";const{implementation:re,createNodeIterator:ae,createDocumentFragment:oe,getElementsByTagName:se}=i,{importNode:le}=r;let ce={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof a&&"function"==typeof Q&&re&&void 0!==re.createHTMLDocument;const{MUSTACHE_EXPR:ue,ERB_EXPR:de,TMPLIT_EXPR:pe,DATA_ATTR:fe,ARIA_ATTR:me,IS_SCRIPT_OR_DATA:ge,ATTR_WHITESPACE:he,CUSTOM_ELEMENT:be}=ne;let{IS_ALLOWED_URI:ye}=ne,xe=null;const ve=L({},[...$,...F,...I,...N,...j]);let we=null;const ke=L({},[...U,...W,...q,...H]);let Te=Object.seal(p(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ae=null,Se=null;const Ee=Object.seal(p(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Re=!0,_e=!0,ze=!1,De=!0,Le=!1,Oe=!0,Ce=!1,Me=!1,$e=!1,Fe=!1,Ie=!1,Be=!1,Ne=!0,Pe=!1,je=!0,Ue=!1,We={},qe=null;const He=L({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ye=null;const Ke=L({},["audio","video","img","source","image","track"]);let Ge=null;const Xe=L({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ve="http://www.w3.org/1998/Math/MathML",Je="http://www.w3.org/2000/svg",Qe="http://www.w3.org/1999/xhtml";let Ze=Qe,et=!1,tt=null;const nt=L({},[Ve,Je,Qe],w);let it=L({},["mi","mo","mn","ms","mtext"]),rt=L({},["annotation-xml"]);const at=L({},["title","style","font","a","script"]);let ot=null;const st=["application/xhtml+xml","text/html"];let lt=null,ct=null;const ut=i.createElement("form"),dt=function(e){return e instanceof RegExp||e instanceof Function},pt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!ct||ct!==e){if(e&&"object"==typeof e||(e={}),e=C(e),ot=-1===st.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,lt="application/xhtml+xml"===ot?w:v,xe=E(e,"ALLOWED_TAGS")?L({},e.ALLOWED_TAGS,lt):ve,we=E(e,"ALLOWED_ATTR")?L({},e.ALLOWED_ATTR,lt):ke,tt=E(e,"ALLOWED_NAMESPACES")?L({},e.ALLOWED_NAMESPACES,w):nt,Ge=E(e,"ADD_URI_SAFE_ATTR")?L(C(Xe),e.ADD_URI_SAFE_ATTR,lt):Xe,Ye=E(e,"ADD_DATA_URI_TAGS")?L(C(Ke),e.ADD_DATA_URI_TAGS,lt):Ke,qe=E(e,"FORBID_CONTENTS")?L({},e.FORBID_CONTENTS,lt):He,Ae=E(e,"FORBID_TAGS")?L({},e.FORBID_TAGS,lt):C({}),Se=E(e,"FORBID_ATTR")?L({},e.FORBID_ATTR,lt):C({}),We=!!E(e,"USE_PROFILES")&&e.USE_PROFILES,Re=!1!==e.ALLOW_ARIA_ATTR,_e=!1!==e.ALLOW_DATA_ATTR,ze=e.ALLOW_UNKNOWN_PROTOCOLS||!1,De=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Le=e.SAFE_FOR_TEMPLATES||!1,Oe=!1!==e.SAFE_FOR_XML,Ce=e.WHOLE_DOCUMENT||!1,Fe=e.RETURN_DOM||!1,Ie=e.RETURN_DOM_FRAGMENT||!1,Be=e.RETURN_TRUSTED_TYPE||!1,$e=e.FORCE_BODY||!1,Ne=!1!==e.SANITIZE_DOM,Pe=e.SANITIZE_NAMED_PROPS||!1,je=!1!==e.KEEP_CONTENT,Ue=e.IN_PLACE||!1,ye=e.ALLOWED_URI_REGEXP||J,Ze=e.NAMESPACE||Qe,it=e.MATHML_TEXT_INTEGRATION_POINTS||it,rt=e.HTML_INTEGRATION_POINTS||rt,Te=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&dt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Te.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&dt(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Te.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Te.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Le&&(_e=!1),Ie&&(Fe=!0),We&&(xe=L({},j),we=p(null),!0===We.html&&(L(xe,$),L(we,U)),!0===We.svg&&(L(xe,F),L(we,W),L(we,H)),!0===We.svgFilters&&(L(xe,I),L(we,W),L(we,H)),!0===We.mathMl&&(L(xe,N),L(we,q),L(we,H))),E(e,"ADD_TAGS")||(Ee.tagCheck=null),E(e,"ADD_ATTR")||(Ee.attributeCheck=null),e.ADD_TAGS&&("function"==typeof e.ADD_TAGS?Ee.tagCheck=e.ADD_TAGS:(xe===ve&&(xe=C(xe)),L(xe,e.ADD_TAGS,lt))),e.ADD_ATTR&&("function"==typeof e.ADD_ATTR?Ee.attributeCheck=e.ADD_ATTR:(we===ke&&(we=C(we)),L(we,e.ADD_ATTR,lt))),e.ADD_URI_SAFE_ATTR&&L(Ge,e.ADD_URI_SAFE_ATTR,lt),e.FORBID_CONTENTS&&(qe===He&&(qe=C(qe)),L(qe,e.FORBID_CONTENTS,lt)),e.ADD_FORBID_CONTENTS&&(qe===He&&(qe=C(qe)),L(qe,e.ADD_FORBID_CONTENTS,lt)),je&&(xe["#text"]=!0),Ce&&L(xe,["html","head","body"]),xe.table&&(L(xe,["tbody"]),delete Ae.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw _('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw _('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');Z=e.TRUSTED_TYPES_POLICY,te=Z.createHTML("")}else void 0===Z&&(Z=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(O,o)),null!==Z&&"string"==typeof te&&(te=Z.createHTML(""));u&&u(e),ct=e}},ft=L({},[...F,...I,...B]),mt=L({},[...N,...P]),gt=function(e){y(n.removed,{element:e});try{Q(e).removeChild(e)}catch(t){G(e)}},ht=function(e,t){try{y(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){y(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(Fe||Ie)try{gt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},bt=function(e){let t=null,n=null;if($e)e="<remove></remove>"+e;else{const t=k(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===ot&&Ze===Qe&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const r=Z?Z.createHTML(e):e;if(Ze===Qe)try{t=(new D).parseFromString(r,ot)}catch(e){}if(!t||!t.documentElement){t=re.createDocument(Ze,"template",null);try{t.documentElement.innerHTML=et?te:r}catch(e){}}const a=t.body||t.documentElement;return e&&n&&a.insertBefore(i.createTextNode(n),a.childNodes[0]||null),Ze===Qe?se.call(t,Ce?"html":"body")[0]:Ce?t.documentElement:a},yt=function(e){return ae.call(e.ownerDocument||e,e,f.SHOW_ELEMENT|f.SHOW_COMMENT|f.SHOW_TEXT|f.SHOW_PROCESSING_INSTRUCTION|f.SHOW_CDATA_SECTION,null)},xt=function(e){return e instanceof z&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof m)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},vt=function(e){return"function"==typeof c&&e instanceof c};function wt(e,t,i){g(e,(e=>{e.call(n,t,i,ct)}))}const kt=function(e){let t=null;if(wt(ce.beforeSanitizeElements,e,null),xt(e))return gt(e),!0;const i=lt(e.nodeName);if(wt(ce.uponSanitizeElement,e,{tagName:i,allowedTags:xe}),Oe&&e.hasChildNodes()&&!vt(e.firstElementChild)&&R(/<[/\w!]/g,e.innerHTML)&&R(/<[/\w!]/g,e.textContent))return gt(e),!0;if(7===e.nodeType)return gt(e),!0;if(Oe&&8===e.nodeType&&R(/<[/\w]/g,e.data))return gt(e),!0;if(!(Ee.tagCheck instanceof Function&&Ee.tagCheck(i))&&(!xe[i]||Ae[i])){if(!Ae[i]&&At(i)){if(Te.tagNameCheck instanceof RegExp&&R(Te.tagNameCheck,i))return!1;if(Te.tagNameCheck instanceof Function&&Te.tagNameCheck(i))return!1}if(je&&!qe[i]){const t=Q(e)||e.parentNode,n=V(e)||e.childNodes;if(n&&t)for(let i=n.length-1;i>=0;--i){const r=K(n[i],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,X(e))}}return gt(e),!0}return e instanceof d&&!function(e){let t=Q(e);t&&t.tagName||(t={namespaceURI:Ze,tagName:"template"});const n=v(e.tagName),i=v(t.tagName);return!!tt[e.namespaceURI]&&(e.namespaceURI===Je?t.namespaceURI===Qe?"svg"===n:t.namespaceURI===Ve?"svg"===n&&("annotation-xml"===i||it[i]):Boolean(ft[n]):e.namespaceURI===Ve?t.namespaceURI===Qe?"math"===n:t.namespaceURI===Je?"math"===n&&rt[i]:Boolean(mt[n]):e.namespaceURI===Qe?!(t.namespaceURI===Je&&!rt[i])&&!(t.namespaceURI===Ve&&!it[i])&&!mt[n]&&(at[n]||!ft[n]):!("application/xhtml+xml"!==ot||!tt[e.namespaceURI]))}(e)?(gt(e),!0):"noscript"!==i&&"noembed"!==i&&"noframes"!==i||!R(/<\/no(script|embed|frames)/i,e.innerHTML)?(Le&&3===e.nodeType&&(t=e.textContent,g([ue,de,pe],(e=>{t=T(t,e," ")})),e.textContent!==t&&(y(n.removed,{element:e.cloneNode()}),e.textContent=t)),wt(ce.afterSanitizeElements,e,null),!1):(gt(e),!0)},Tt=function(e,t,n){if(Se[t])return!1;if(Ne&&("id"===t||"name"===t)&&(n in i||n in ut))return!1;if(_e&&!Se[t]&&R(fe,t));else if(Re&&R(me,t));else if(Ee.attributeCheck instanceof Function&&Ee.attributeCheck(t,e));else if(!we[t]||Se[t]){if(!(At(e)&&(Te.tagNameCheck instanceof RegExp&&R(Te.tagNameCheck,e)||Te.tagNameCheck instanceof Function&&Te.tagNameCheck(e))&&(Te.attributeNameCheck instanceof RegExp&&R(Te.attributeNameCheck,t)||Te.attributeNameCheck instanceof Function&&Te.attributeNameCheck(t,e))||"is"===t&&Te.allowCustomizedBuiltInElements&&(Te.tagNameCheck instanceof RegExp&&R(Te.tagNameCheck,n)||Te.tagNameCheck instanceof Function&&Te.tagNameCheck(n))))return!1}else if(Ge[t]);else if(R(ye,T(n,he,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==A(n,"data:")||!Ye[e])if(ze&&!R(ge,T(n,he,"")));else if(n)return!1;return!0},At=function(e){return"annotation-xml"!==e&&k(e,be)},St=function(e){wt(ce.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||xt(e))return;const i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:we,forceKeepAttr:void 0};let r=t.length;for(;r--;){const a=t[r],{name:o,namespaceURI:s,value:l}=a,c=lt(o),u=l;let d="value"===o?u:S(u);if(i.attrName=c,i.attrValue=d,i.keepAttr=!0,i.forceKeepAttr=void 0,wt(ce.uponSanitizeAttribute,e,i),d=i.attrValue,!Pe||"id"!==c&&"name"!==c||(ht(o,e),d="user-content-"+d),Oe&&R(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){ht(o,e);continue}if("attributename"===c&&k(d,"href")){ht(o,e);continue}if(i.forceKeepAttr)continue;if(!i.keepAttr){ht(o,e);continue}if(!De&&R(/\/>/i,d)){ht(o,e);continue}Le&&g([ue,de,pe],(e=>{d=T(d,e," ")}));const p=lt(e.nodeName);if(Tt(p,c,d)){if(Z&&"object"==typeof O&&"function"==typeof O.getAttributeType)if(s);else switch(O.getAttributeType(p,c)){case"TrustedHTML":d=Z.createHTML(d);break;case"TrustedScriptURL":d=Z.createScriptURL(d)}if(d!==u)try{s?e.setAttributeNS(s,o,d):e.setAttribute(o,d),xt(e)?gt(e):b(n.removed)}catch(t){ht(o,e)}}else ht(o,e)}wt(ce.afterSanitizeAttributes,e,null)},Et=function e(t){let n=null;const i=yt(t);for(wt(ce.beforeSanitizeShadowDOM,t,null);n=i.nextNode();)wt(ce.uponSanitizeShadowNode,n,null),kt(n),St(n),n.content instanceof s&&e(n.content);wt(ce.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null,a=null,o=null,l=null;if(et=!e,et&&(e="\x3c!--\x3e"),"string"!=typeof e&&!vt(e)){if("function"!=typeof e.toString)throw _("toString is not a function");if("string"!=typeof(e=e.toString()))throw _("dirty is not a string, aborting")}if(!n.isSupported)return e;if(Me||pt(t),n.removed=[],"string"==typeof e&&(Ue=!1),Ue){if(e.nodeName){const t=lt(e.nodeName);if(!xe[t]||Ae[t])throw _("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof c)i=bt("\x3c!----\x3e"),a=i.ownerDocument.importNode(e,!0),1===a.nodeType&&"BODY"===a.nodeName||"HTML"===a.nodeName?i=a:i.appendChild(a);else{if(!Fe&&!Le&&!Ce&&-1===e.indexOf("<"))return Z&&Be?Z.createHTML(e):e;if(i=bt(e),!i)return Fe?null:Be?te:""}i&&$e&&gt(i.firstChild);const u=yt(Ue?e:i);for(;o=u.nextNode();)kt(o),St(o),o.content instanceof s&&Et(o.content);if(Ue)return e;if(Fe){if(Ie)for(l=oe.call(i.ownerDocument);i.firstChild;)l.appendChild(i.firstChild);else l=i;return(we.shadowroot||we.shadowrootmode)&&(l=le.call(r,l,!0)),l}let d=Ce?i.outerHTML:i.innerHTML;return Ce&&xe["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&R(ee,i.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+i.ownerDocument.doctype.name+">\n"+d),Le&&g([ue,de,pe],(e=>{d=T(d,e," ")})),Z&&Be?Z.createHTML(d):d},n.setConfig=function(){pt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Me=!0},n.clearConfig=function(){ct=null,Me=!1},n.isValidAttribute=function(e,t,n){ct||pt({});const i=lt(e),r=lt(t);return Tt(i,r,n)},n.addHook=function(e,t){"function"==typeof t&&y(ce[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=h(ce[e],t);return-1===n?void 0:x(ce[e],n,1)[0]}return b(ce[e])},n.removeHooks=function(e){ce[e]=[]},n.removeAllHooks=function(){ce={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();const ae={ALLOWED_TAGS:["p","br","strong","em","del","code","pre","ul","ol","li","h2","h3","a","blockquote","table","thead","tbody","tr","th","td"],ALLOWED_ATTR:["href","target","rel"]},oe=class{constructor(n){e(this,n),this.messageCopy=t(this,"messageCopy"),this.messageFeedback=t(this,"messageFeedback"),this.messageRegenerate=t(this,"messageRegenerate")}role="user";content="";format="text";agentName="";timestamp="";showActions=!0;enableRegenerate=!1;feedbackValue=null;messageCopy;messageFeedback;messageRegenerate;copySuccess=!1;copyTimeout;disconnectedCallback(){this.copyTimeout&&clearTimeout(this.copyTimeout)}renderIcon(e,t=16){const i=r[e];return i?n("span",{class:"icon-wrap",innerHTML:`<svg width="${t}" height="${t}" viewBox="${i.viewBox}" fill="none" xmlns="http://www.w3.org/2000/svg">${i.content}</svg>`}):null}parseMarkdown(e){let t=e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");const n=[];return t=t.replace(/```(?:\w+)?\n?([\s\S]*?)```/g,((e,t)=>{const i=n.length;return n.push(`<pre><code>${t}</code></pre>`),`\0BLOCK${i}\0`})),t=t.replace(/((?:^[ \t]*\|.+\|\n?)+)/gm,(e=>{const t=e.trim().split("\n").filter((e=>e.trim()));if(t.length<2)return e;let i="<table>",r=!1;t.forEach(((e,t)=>{if(/^[\s|:-]+$/.test(e))return r=!0,void(i+="<tbody>");const n=e.split("|").filter(((e,t,n)=>t>0&&t<n.length-1));i+=r||0!==t?`<tr>${n.map((e=>`<td>${e.trim()}</td>`)).join("")}</tr>`:`<thead><tr>${n.map((e=>`<th>${e.trim()}</th>`)).join("")}</tr></thead>`})),r&&(i+="</tbody>"),i+="</table>";const a=n.length;return n.push(i),`\0BLOCK${a}\0`})),t=t.replace(/((?:^&gt; .+\n?)+)/gm,(e=>{const t=e.replace(/^&gt; /gm,"").trim(),i=n.length;return n.push(`<blockquote>${t}</blockquote>`),`\0BLOCK${i}\0`})),t=t.replace(/`([^`]+)`/g,"<code>$1</code>"),t=t.replace(/^## (.+)$/gm,"<h2>$1</h2>"),t=t.replace(/^### (.+)$/gm,"<h3>$1</h3>"),t=t.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),t=t.replace(/\*([^*\n]+)\*/g,"<em>$1</em>"),t=t.replace(/~~(.+?)~~/g,"<del>$1</del>"),t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>'),t=t.replace(/((?:^[ \t]*[-*] .+\n?)+)/gm,(e=>{const t=e.trim().split("\n").filter((e=>e.trim())).map((e=>`<li>${e.replace(/^[ \t]*[-*] /,"")}</li>`)).join(""),i=n.length;return n.push(`<ul>${t}</ul>`),`\0BLOCK${i}\0`})),t=t.replace(/((?:^[ \t]*\d+\. .+\n?)+)/gm,(e=>{const t=e.trim().split("\n").filter((e=>e.trim())).map((e=>`<li>${e.replace(/^[ \t]*\d+\. /,"")}</li>`)).join(""),i=n.length;return n.push(`<ol>${t}</ol>`),`\0BLOCK${i}\0`})),t=t.split(/\n{2,}/).map((e=>{const t=e.trim();return t?/^\x00BLOCK\d+\x00$/.test(t)?t:`<p>${t.replace(/\n/g,"<br>")}</p>`:""})).join(""),t=t.replace(/\x00BLOCK(\d+)\x00/g,((e,t)=>n[parseInt(t,10)]||"")),t}getRenderedContent(){if(!this.content)return"";try{return re.sanitize(this.parseMarkdown(this.content),ae)}catch{return re.sanitize(`<p>${this.content.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"<br>")}</p>`,ae)}}getRelativeTime(){if(!this.timestamp)return"";try{const e=new Date(this.timestamp);if(isNaN(e.getTime()))return this.timestamp;const t=Date.now()-e.getTime(),n=Math.floor(t/6e4),i=Math.floor(n/60),r=Math.floor(i/24),a="undefined"!=typeof document&&document.documentElement.lang||"ar",o=new Intl.RelativeTimeFormat(a,{numeric:"auto"});return n<1?o.format(0,"second"):n<60?o.format(-n,"minute"):i<24?o.format(-i,"hour"):o.format(-r,"day")}catch{return this.timestamp}}async handleCopy(){try{await navigator.clipboard.writeText(this.content)}catch(e){}this.copySuccess=!0,this.messageCopy.emit(),this.copyTimeout=setTimeout((()=>this.copySuccess=!1),1500)}handleFeedback(e){this.feedbackValue=this.feedbackValue===e?null:e,this.messageFeedback.emit(e)}renderActionsBar(){return n("div",{class:"actions-bar"},this.enableRegenerate&&n("button",{class:"action-btn",onClick:()=>this.messageRegenerate.emit(),title:"إعادة تحميل"},this.renderIcon("reload",16)),n("button",{class:"action-btn copy-btn"+(this.copySuccess?" copy-success":""),onClick:()=>this.handleCopy(),title:"نسخ"},this.renderIcon("copy",16)),n("div",{class:"feedback-group"},n("button",{class:"feedback-btn thumbs-down-btn"+("down"===this.feedbackValue?" active":""),onClick:()=>this.handleFeedback("down"),title:"غير مفيد"},this.renderIcon("thumbs-down",16)),n("button",{class:"feedback-btn thumbs-up-btn"+("up"===this.feedbackValue?" active":""),onClick:()=>this.handleFeedback("up"),title:"مفيد"},this.renderIcon("thumbs-up",16))))}renderUserMessage(){return n("div",{class:"message-row user-row"},n("div",{class:"bubble user-bubble"},n("div",{class:"message-content",ref:e=>{e&&("markdown"===this.format?e.innerHTML=this.getRenderedContent():e.textContent=this.content)}})))}renderAgentMessage(){const e=this.showActions;return n("div",{class:"message-row agent-row"},n("div",{class:"agent-bubble-wrapper"},n("div",{class:"bubble agent-bubble"},this.content&&n("div",{class:"message-content",ref:e=>{e&&("markdown"===this.format?e.innerHTML=this.getRenderedContent():e.textContent=this.content)}}),n("slot",null),e&&this.renderActionsBar()),(this.agentName||this.timestamp)&&n("div",{class:"agent-info"},this.agentName&&n("span",{class:"agent-info-name"},this.agentName),this.agentName&&this.timestamp&&this.renderIcon("eclipse",10),this.timestamp&&n("span",{class:"agent-info-time"},this.getRelativeTime()))))}render(){return n(i,{key:"f8a49971896742ae952d84efb1527ed0db440876"},"user"===this.role?this.renderUserMessage():this.renderAgentMessage())}};oe.style=":host{--ai-msg-user-bg:var(--ai-user-bubble-bg);--ai-msg-user-border:1px solid var(--ai-border-default);--ai-msg-agent-bg:var(--ai-agent-bubble-bg);--ai-msg-agent-border:1px solid var(--ai-border-default);--ai-msg-border-radius:16px;--ai-msg-padding:16px;--ai-msg-font-size:14px;--ai-msg-action-active-bg:var(--ai-accent);--ai-user-msg-max-width:80%;--ai-agent-msg-max-width:80%;display:block}.message-row{display:flex}.user-row{flex-direction:column;align-items:flex-end}.user-bubble{background:var(--ai-msg-user-bg);color:var(--ai-text-primary);border:var(--ai-msg-user-border);border-radius:var(--ai-msg-border-radius);padding:var(--ai-msg-padding);font-size:var(--ai-msg-font-size);max-width:var(--ai-user-msg-max-width);line-height:1.5;word-break:break-word;box-shadow:var(--ai-shadow-sm)}.user-row .timestamp{font-size:12px;color:var(--ai-text-secondary);margin-top:4px}.agent-row{flex-direction:row;justify-content:flex-start}.agent-bubble-wrapper{display:flex;flex-direction:column;gap:6px;width:100%;max-width:var(--ai-msg-agent-max-width);min-width:0}.agent-bubble{background:var(--ai-msg-agent-bg);color:var(--ai-text-primary);border:var(--ai-msg-agent-border);border-radius:var(--ai-msg-border-radius);padding:var(--ai-msg-padding);font-size:var(--ai-msg-font-size);line-height:1.6;word-break:break-word;box-shadow:var(--ai-shadow-sm);display:flex;flex-direction:column;gap:12px}.message-content{white-space:pre-wrap}.message-content p{margin:0 0 8px 0}.message-content p:last-child{margin-bottom:0}.message-content h2{font-size:16px;font-weight:700;margin:0 0 8px 0}.message-content h3{font-size:15px;font-weight:600;margin:0 0 6px 0}.message-content strong{font-weight:700}.message-content em{font-style:italic}.message-content code{background:var(--ai-bg-surface);border-radius:4px;padding:1px 5px;font-family:var(--ai-font-family-mono);font-size:13px;color:var(--ai-text-primary)}.message-content pre{background:var(--ai-bg-surface);border-radius:8px;padding:10px 12px;overflow-x:auto;margin:8px 0}.message-content pre code{background:none;padding:0;font-size:13px}.message-content ul,.message-content ol{padding-inline-start:20px;margin:4px 0 8px 0}.message-content li{margin-bottom:3px}.actions-bar{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:6px;height:32px}.action-btn{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:8px;background:var(--ai-bg-card);border:1px solid var(--ai-border-default);cursor:pointer;color:var(--ai-text-primary);transition:background 0.15s, color 0.15s;padding:0;flex-shrink:0}.action-btn:hover{background:var(--ai-bg-surface)}.action-btn.copy-success{background:var(--ai-msg-action-active-bg);color:var(--ai-accent-text);border-color:var(--ai-accent)}.feedback-group{display:flex;align-items:center;border:1px solid var(--ai-border-default);border-radius:8px;overflow:hidden;background:var(--ai-bg-card)}.feedback-btn{display:flex;align-items:center;justify-content:center;height:32px;padding:0 8px;background:var(--ai-bg-card);border:none;border-inline-start:1px solid var(--ai-border-default);cursor:pointer;color:var(--ai-text-primary);transition:background 0.15s, color 0.15s}.feedback-btn:first-child{border-inline-start:none}.feedback-btn:hover{background:var(--ai-bg-surface)}.feedback-btn.active{background:var(--ai-msg-action-active-bg);color:var(--ai-accent-text)}.icon-wrap{display:flex;align-items:center;justify-content:center;line-height:0}.agent-info{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:6px;color:var(--ai-text-muted)}.agent-info-name,.agent-info-time{font-size:12px;color:inherit;line-height:16px;white-space:nowrap}.agent-info .icon-wrap{display:flex;align-items:center;color:inherit;opacity:0.6;flex-shrink:0}.typing-indicator{display:flex;align-items:center;gap:5px;padding:4px 2px}.typing-dot{width:8px;height:8px;border-radius:50%;background:var(--ai-text-muted);animation:typingBounce 1.2s ease-in-out infinite}.typing-dot:nth-child(2){animation-delay:0.2s}.typing-dot:nth-child(3){animation-delay:0.4s}@keyframes typingBounce{0%,60%,100%{transform:translateY(0)}30%{transform:translateY(-6px)}}.streaming-cursor{display:inline-block;width:2px;height:1em;background:currentColor;vertical-align:text-bottom;margin-inline-start:2px;animation:cursorBlink 0.8s step-start infinite}@keyframes cursorBlink{0%,100%{opacity:1}50%{opacity:0}}";export{oe as ai_chat_message}
@@ -0,0 +1 @@
1
+ import{r as i,c as a,h as e,H as t}from"./p-VMEwYfaX.js";import{i as n}from"./p-DlD8m3rf.js";const r=[{value:1,icon:"emoji-angry",label:"سيئ جداً"},{value:2,icon:"emoji-frowning",label:"سيئ"},{value:3,icon:"emoji-neutral",label:"مقبول"},{value:4,icon:"emoji-slightly-smiling",label:"جيد"},{value:5,icon:"emoji-heart-eyes",label:"ممتاز"}],s=class{constructor(e){i(this,e),this.ratingChange=a(this,"ratingChange")}question="كيف كانت تجربتك؟";subtitle="رأيك يساعدنا نحسن الخدمة";successMessage="شكراً لتقييمك!";value=null;disabled=!1;hovered=null;submitted=!1;ratingChange;select(i){this.disabled||this.submitted||(this.value=i,this.submitted=!0,this.ratingChange.emit(this.value))}get hoveredLabel(){return null===this.hovered?null:r.find((i=>i.value===this.hovered))?.label??null}render(){const i=this.hoveredLabel;return e(t,null,e("ai-card",null,this.submitted?e("div",{class:"rating rating--success"},e("ai-icon",{name:"check-circle",size:32}),e("p",{class:"rating__success-message"},this.successMessage)):e("div",{class:"rating"},e("div",{class:"rating__text"},e("p",{class:"rating__question"},this.question),e("p",{class:"rating__subtitle"},this.subtitle)),e("div",{class:"rating__icons",role:"group","aria-label":this.question,onMouseLeave:()=>this.hovered=null},r.map((i=>{const a=this.value===i.value,t=n[i.icon];return e("button",{key:i.value,class:{"emoji-btn":!0,"emoji-btn--active":a,"emoji-btn--hovered":this.hovered===i.value&&!a,"emoji-btn--disabled":this.disabled},"aria-label":i.label,"aria-pressed":a?"true":"false",disabled:this.disabled,onClick:()=>this.select(i.value),onMouseEnter:()=>this.hovered=i.value},e("span",{class:"emoji-btn__icon","aria-hidden":"true"},e("svg",{width:24,height:24,viewBox:t.viewBox,xmlns:"http://www.w3.org/2000/svg",ref:i=>i&&(i.innerHTML=t.content)})))}))),e("p",{class:{"rating__hover-label":!0,"rating__hover-label--visible":null!==i}},i??" "))))}};s.style=":host{--ai-rating-question-size:16px;--ai-rating-subtitle-size:14px;--ai-rating-gap:8px;--ai-rating-emoji-size:24px;--ai-rating-btn-padding:6px;--ai-rating-btn-border:1px solid var(--ai-border-light);--ai-rating-btn-radius:9999px;--ai-rating-btn-bg-hover:var(--ai-bg-surface);--ai-rating-btn-border-hover:1px solid var(--ai-border-default);--ai-rating-btn-bg-active:var(--ai-warning-bg);--ai-rating-btn-border-active:1px solid var(--ai-warning-border);--ai-rating-btn-shadow-active:var(--ai-shadow-active);--ai-rating-label-size:16px;display:block}.rating{display:flex;flex-direction:column;align-items:center;gap:var(--ai-rating-gap);width:100%}.rating__text{display:flex;flex-direction:column;align-items:center;gap:2px;width:100%;text-align:center}.rating__question{margin:0;font-size:var(--ai-rating-question-size);font-weight:500;line-height:24px;color:var(--ai-text-primary)}.rating__subtitle{margin:0;font-size:var(--ai-rating-subtitle-size);font-weight:400;line-height:20px;color:var(--ai-text-secondary)}.rating__icons{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;flex-wrap:wrap}.emoji-btn{display:inline-flex;align-items:center;justify-content:center;padding:var(--ai-rating-btn-padding);border:var(--ai-rating-btn-border);border-radius:var(--ai-rating-btn-radius);background:transparent;cursor:pointer;transition:background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;outline:none}.emoji-btn:focus-visible{outline:2px solid var(--ai-warning-border);outline-offset:2px}.emoji-btn:hover:not(:disabled),.emoji-btn--hovered{background:var(--ai-rating-btn-bg-hover);border:var(--ai-rating-btn-border-hover);transform:scale(1.1)}.emoji-btn--active{background:var(--ai-rating-btn-bg-active) !important;border:var(--ai-rating-btn-border-active) !important;box-shadow:var(--ai-rating-btn-shadow-active);transform:scale(1.18) !important}.emoji-btn--disabled{opacity:0.45;cursor:not-allowed;pointer-events:none}.emoji-btn__icon{font-size:var(--ai-rating-emoji-size);line-height:1;display:inline-flex;align-items:center;justify-content:center;width:var(--ai-rating-emoji-size);height:var(--ai-rating-emoji-size);pointer-events:none}.rating__hover-label{margin:0;font-size:var(--ai-rating-label-size);font-weight:500;line-height:24px;color:var(--ai-text-primary);text-align:center;width:100%;min-height:24px;opacity:0;visibility:hidden;transition:opacity 0.15s ease, visibility 0.15s ease}.rating__hover-label--visible{opacity:1;visibility:visible}.rating--success{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:16px 0;animation:fadeIn 0.2s ease}.rating__success-message{margin:0;font-size:var(--ai-rating-question-size);font-weight:500;line-height:24px;color:var(--ai-text-primary);text-align:center}@keyframes fadeIn{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}";export{s as ai_rating}
@@ -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-338d55d3",[[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-a1ee6005",[[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-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))));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salla.sa/ui-ai-kit-core",
3
- "version": "2.2.3",
3
+ "version": "2.2.4",
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 i,c as a,h as e,H as t}from"./p-VMEwYfaX.js";import{i as n}from"./p-DlD8m3rf.js";const r=[{value:1,icon:"emoji-angry",label:"سيئ جداً"},{value:2,icon:"emoji-frowning",label:"سيئ"},{value:3,icon:"emoji-neutral",label:"مقبول"},{value:4,icon:"emoji-slightly-smiling",label:"جيد"},{value:5,icon:"emoji-heart-eyes",label:"ممتاز"}],s=class{constructor(e){i(this,e),this.ratingChange=a(this,"ratingChange")}question="كيف كانت تجربتك؟";subtitle="رأيك يساعدنا نحسن الخدمة";successMessage="شكراً لتقييمك!";value=null;disabled=!1;hovered=null;submitted=!1;ratingChange;select(i){this.disabled||this.submitted||(this.value=i,this.submitted=!0,this.ratingChange.emit(this.value))}get hoveredLabel(){return null===this.hovered?null:r.find((i=>i.value===this.hovered))?.label??null}render(){const i=this.hoveredLabel;return e(t,null,e("ai-card",null,this.submitted?e("div",{class:"rating rating--success"},e("ai-icon",{name:"check-circle",size:32}),e("p",{class:"rating__success-message"},this.successMessage)):e("div",{class:"rating"},e("div",{class:"rating__text"},e("p",{class:"rating__question"},this.question),e("p",{class:"rating__subtitle"},this.subtitle)),e("div",{class:"rating__icons",role:"group","aria-label":this.question},r.map((i=>{const a=this.value===i.value,t=n[i.icon];return e("button",{key:i.value,class:{"emoji-btn":!0,"emoji-btn--active":a,"emoji-btn--hovered":this.hovered===i.value&&!a,"emoji-btn--disabled":this.disabled},"aria-label":i.label,"aria-pressed":a?"true":"false",disabled:this.disabled,onClick:()=>this.select(i.value),onMouseEnter:()=>this.hovered=i.value,onMouseLeave:()=>this.hovered=null},e("span",{class:"emoji-btn__icon","aria-hidden":"true"},e("svg",{width:24,height:24,viewBox:t.viewBox,xmlns:"http://www.w3.org/2000/svg",ref:i=>i&&(i.innerHTML=t.content)})))}))),i&&e("p",{class:"rating__hover-label"},i))))}};s.style=":host{--ai-rating-question-size:16px;--ai-rating-subtitle-size:14px;--ai-rating-gap:8px;--ai-rating-emoji-size:24px;--ai-rating-btn-padding:6px;--ai-rating-btn-border:1px solid var(--ai-border-light);--ai-rating-btn-radius:9999px;--ai-rating-btn-bg-hover:var(--ai-bg-surface);--ai-rating-btn-border-hover:1px solid var(--ai-border-default);--ai-rating-btn-bg-active:var(--ai-warning-bg);--ai-rating-btn-border-active:1px solid var(--ai-warning-border);--ai-rating-btn-shadow-active:var(--ai-shadow-active);--ai-rating-label-size:16px;display:block}.rating{display:flex;flex-direction:column;align-items:center;gap:var(--ai-rating-gap);width:100%}.rating__text{display:flex;flex-direction:column;align-items:center;gap:2px;width:100%;text-align:center}.rating__question{margin:0;font-size:var(--ai-rating-question-size);font-weight:500;line-height:24px;color:var(--ai-text-primary)}.rating__subtitle{margin:0;font-size:var(--ai-rating-subtitle-size);font-weight:400;line-height:20px;color:var(--ai-text-secondary)}.rating__icons{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;flex-wrap:wrap}.emoji-btn{display:inline-flex;align-items:center;justify-content:center;padding:var(--ai-rating-btn-padding);border:var(--ai-rating-btn-border);border-radius:var(--ai-rating-btn-radius);background:transparent;cursor:pointer;transition:background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;outline:none}.emoji-btn:focus-visible{outline:2px solid var(--ai-warning-border);outline-offset:2px}.emoji-btn:hover:not(:disabled),.emoji-btn--hovered{background:var(--ai-rating-btn-bg-hover);border:var(--ai-rating-btn-border-hover);transform:scale(1.1)}.emoji-btn--active{background:var(--ai-rating-btn-bg-active) !important;border:var(--ai-rating-btn-border-active) !important;box-shadow:var(--ai-rating-btn-shadow-active);transform:scale(1.18) !important}.emoji-btn--disabled{opacity:0.45;cursor:not-allowed;pointer-events:none}.emoji-btn__icon{font-size:var(--ai-rating-emoji-size);line-height:1;display:inline-flex;align-items:center;justify-content:center;width:var(--ai-rating-emoji-size);height:var(--ai-rating-emoji-size);pointer-events:none}.rating__hover-label{margin:0;font-size:var(--ai-rating-label-size);font-weight:500;line-height:24px;color:var(--ai-text-primary);text-align:center;width:100%;animation:fadeIn 0.15s ease}.rating--success{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:16px 0;animation:fadeIn 0.2s ease}.rating__success-message{margin:0;font-size:var(--ai-rating-question-size);font-weight:500;line-height:24px;color:var(--ai-text-primary);text-align:center}@keyframes fadeIn{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}";export{s as ai_rating}