@muibook/components 11.0.0 → 12.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,8 +20,8 @@ class k extends HTMLElement {
20
20
  constructor() {
21
21
  super(), this.triggerEl = null, this.previewShellEl = null, this.previewRowEl = null, this.previewSlotEl = null, this.previewResizeObserver = null, this.fanAnimations = /* @__PURE__ */ new Map(), this.pendingColorFade = !1, this.lastDebugPayload = '{"event":"idle"}', this.enforceActionVariants = () => {
22
22
  if (!this.shadowRoot) return;
23
- const e = Array.from(this.shadowRoot.querySelectorAll('slot[name="actions"], slot[name="actions-trigger"], slot[name="actions-right"]')), o = (r, a) => {
24
- if (!a || r.tagName.toLowerCase() !== "mui-button") return;
23
+ const e = Array.from(this.shadowRoot.querySelectorAll('slot[name="actions"], slot[name="actions-trigger"], slot[name="actions-right"]')), o = (r, s) => {
24
+ if (!s || r.tagName.toLowerCase() !== "mui-button") return;
25
25
  if (r.hasAttribute("icon-only")) {
26
26
  r.style.marginRight = "var(--space-025)";
27
27
  return;
@@ -29,16 +29,16 @@ class k extends HTMLElement {
29
29
  r.style.marginRight === "var(--space-025)" && (r.style.marginRight = "");
30
30
  };
31
31
  e.forEach((r) => {
32
- const a = r.name === "actions";
33
- r.assignedElements({ flatten: !0 }).forEach((s) => {
34
- [s, ...Array.from(s.querySelectorAll("*"))].forEach((c) => {
32
+ const s = r.name === "actions";
33
+ r.assignedElements({ flatten: !0 }).forEach((a) => {
34
+ [a, ...Array.from(a.querySelectorAll("*"))].forEach((c) => {
35
35
  const u = c.tagName.toLowerCase();
36
36
  if (u === "mui-button") {
37
- c.setAttribute("variant", "tertiary"), o(c, a);
37
+ c.setAttribute("variant", "tertiary"), o(c, s);
38
38
  return;
39
39
  }
40
40
  u === "mui-dropdown" && c.querySelectorAll('[slot="action"]').forEach((h) => {
41
- h instanceof HTMLElement && h.tagName.toLowerCase() === "mui-button" && (h.setAttribute("variant", "tertiary"), o(h, a));
41
+ h instanceof HTMLElement && h.tagName.toLowerCase() === "mui-button" && (h.setAttribute("variant", "tertiary"), o(h, s));
42
42
  });
43
43
  });
44
44
  });
@@ -48,8 +48,8 @@ class k extends HTMLElement {
48
48
  }, this.onPaste = (t) => {
49
49
  const e = t, o = e.clipboardData;
50
50
  if (!o) return;
51
- const r = Array.from(o.files || []), a = o.getData("text/plain") || "", i = a.trim(), s = i.length > 0, l = s ? this.detectMediaUrl(i) : null, c = this.getAttribute("preview-overflow-to-preview") !== "false", u = this.getAttribute("preview-threshold-chars"), p = Number.isFinite(Number.parseInt(u || "", 10)) ? Math.max(1, Number.parseInt(u || "", 10)) : 220, h = s ? this.detectBadge(i) : "", m = h !== "" && h !== "Insightful", b = c && s && (!!(l != null && l.url) || i.length >= p || m), g = r.length > 0;
52
- if (!g && !s) return;
51
+ const r = Array.from(o.files || []), s = o.getData("text/plain") || "", i = s.trim(), a = i.length > 0, l = a ? this.detectMediaUrl(i) : null, c = this.getAttribute("preview-overflow-to-preview") !== "false", u = this.getAttribute("preview-threshold-chars"), p = Number.isFinite(Number.parseInt(u || "", 10)) ? Math.max(1, Number.parseInt(u || "", 10)) : 220, h = a ? this.detectBadge(i) : "", m = h !== "" && h !== "Insightful", b = c && a && (!!(l != null && l.url) || i.length >= p || m), g = r.length > 0;
52
+ if (!g && !a) return;
53
53
  (g || b) && e.preventDefault();
54
54
  const v = r.map((d) => ({
55
55
  kind: d.type.startsWith("image/") ? "image" : d.type.startsWith("video/") ? "video" : d.type.startsWith("audio/") ? "audio" : "file",
@@ -72,11 +72,11 @@ class k extends HTMLElement {
72
72
  mimeType: "text/plain",
73
73
  badge: this.detectBadge(i),
74
74
  preview: i.slice(0, 260),
75
- value: a
75
+ value: s
76
76
  })), this.emitPromptItems({
77
77
  source: "paste",
78
78
  items: v,
79
- text: a || "",
79
+ text: s || "",
80
80
  textBadge: (l == null ? void 0 : l.badge) || h,
81
81
  overflowed: b,
82
82
  thresholdChars: p
@@ -116,31 +116,31 @@ class k extends HTMLElement {
116
116
  const e = t.composedPath();
117
117
  if (e.some((i) => {
118
118
  if (!(i instanceof HTMLElement)) return !1;
119
- const s = i.tagName.toLowerCase();
120
- return s === "textarea" || s === "input" || i.isContentEditable;
119
+ const a = i.tagName.toLowerCase();
120
+ return a === "textarea" || a === "input" || i.isContentEditable;
121
121
  })) return;
122
122
  if (e.find((i) => {
123
- var s;
124
- return i instanceof HTMLElement && ((s = i.hasAttribute) == null ? void 0 : s.call(i, "context-close"));
123
+ var a;
124
+ return i instanceof HTMLElement && ((a = i.hasAttribute) == null ? void 0 : a.call(i, "context-close"));
125
125
  })) {
126
126
  this.setContextMode("icon", "dismiss"), this.updateActionsLayout();
127
127
  return;
128
128
  }
129
129
  e.find(
130
130
  (i) => {
131
- var s, l;
132
- return i instanceof HTMLElement && (((s = i.hasAttribute) == null ? void 0 : s.call(i, "context-toggle")) || ((l = i.getAttribute) == null ? void 0 : l.call(i, "slot")) === "toggle");
131
+ var a, l;
132
+ return i instanceof HTMLElement && (((a = i.hasAttribute) == null ? void 0 : a.call(i, "context-toggle")) || ((l = i.getAttribute) == null ? void 0 : l.call(i, "slot")) === "toggle");
133
133
  }
134
134
  ) && (this.setContextMode("chip", "click"), this.updateActionsLayout());
135
135
  }, this.onContextChipDismiss = (t) => {
136
136
  t.composedPath().find(
137
137
  (r) => {
138
- var a, i, s;
139
- return r instanceof HTMLElement && (((a = r.hasAttribute) == null ? void 0 : a.call(r, "context-active")) || ((i = r.hasAttribute) == null ? void 0 : i.call(r, "context-chip")) || ((s = r.hasAttribute) == null ? void 0 : s.call(r, "context-spinner")));
138
+ var s, i, a;
139
+ return r instanceof HTMLElement && (((s = r.hasAttribute) == null ? void 0 : s.call(r, "context-active")) || ((i = r.hasAttribute) == null ? void 0 : i.call(r, "context-chip")) || ((a = r.hasAttribute) == null ? void 0 : a.call(r, "context-spinner")));
140
140
  }
141
141
  ) && (this.setContextMode("icon", "dismiss"), this.updateActionsLayout());
142
142
  }, this.toggleFanOpen = () => {
143
- this.hasAttribute("actions-fan") && (this.toggleAttribute("fan-open"), this.updateActionsLayout());
143
+ this.toggleAttribute("fan-open"), this.updateActionsLayout();
144
144
  }, this.attachShadow({ mode: "open" });
145
145
  }
146
146
  static get observedAttributes() {
@@ -156,6 +156,8 @@ class k extends HTMLElement {
156
156
  "preview-scrollbar",
157
157
  "preview-threshold-chars",
158
158
  "preview-auto-clickable",
159
+ "preview-loading",
160
+ "preview-loading-label",
159
161
  "preview-dialog-width",
160
162
  "preview-dialog-title",
161
163
  "context-mode",
@@ -181,17 +183,17 @@ class k extends HTMLElement {
181
183
  }
182
184
  setDebugState(t, e) {
183
185
  if (!this.shadowRoot) return;
184
- const o = this.shadowRoot.querySelector(".debug-region"), r = this.shadowRoot.querySelector("#promptDebugStatus"), a = this.shadowRoot.querySelector("#promptDebugPayload");
185
- if (!o || !r || !a) return;
186
+ const o = this.shadowRoot.querySelector(".debug-region"), r = this.shadowRoot.querySelector("#promptDebugStatus"), s = this.shadowRoot.querySelector("#promptDebugPayload");
187
+ if (!o || !r || !s) return;
186
188
  const i = this.hasAttribute("debug");
187
- o.toggleAttribute("hidden", !i), i && (r.textContent = t, e && (this.lastDebugPayload = JSON.stringify(e)), a.textContent = this.lastDebugPayload);
189
+ o.toggleAttribute("hidden", !i), i && (r.textContent = t, e && (this.lastDebugPayload = JSON.stringify(e)), s.textContent = this.lastDebugPayload);
188
190
  }
189
191
  emitPromptItems({
190
192
  items: t,
191
193
  text: e,
192
194
  textBadge: o,
193
195
  overflowed: r,
194
- thresholdChars: a,
196
+ thresholdChars: s,
195
197
  source: i
196
198
  }) {
197
199
  this.dispatchEvent(
@@ -202,7 +204,7 @@ class k extends HTMLElement {
202
204
  text: e,
203
205
  textBadge: o,
204
206
  overflowed: r,
205
- thresholdChars: a,
207
+ thresholdChars: s,
206
208
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
207
209
  },
208
210
  bubbles: !0,
@@ -251,9 +253,12 @@ class k extends HTMLElement {
251
253
  });
252
254
  });
253
255
  }
256
+ ensureFanMode() {
257
+ this.hasAttribute("fan-open") && !this.hasAttribute("actions-fan") && this.setAttribute("actions-fan", "");
258
+ }
254
259
  connectedCallback() {
255
260
  var e;
256
- this.hasAttribute("context-mode") || this.setAttribute("context-mode", "icon"), this.render(), this.bindEvents(), this.updateActionsLayout();
261
+ this.hasAttribute("context-mode") || this.setAttribute("context-mode", "icon"), this.ensureFanMode(), this.render(), this.bindEvents(), this.updateActionsLayout();
257
262
  const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("textarea");
258
263
  t && (this.syncTextareaHeight(t), requestAnimationFrame(() => this.syncTextareaHeight(t)));
259
264
  }
@@ -268,9 +273,9 @@ class k extends HTMLElement {
268
273
  return;
269
274
  }
270
275
  if (t === "context-mode") {
271
- const a = this.normalizeContextMode(o);
272
- if (o !== a) {
273
- this.setAttribute("context-mode", a);
276
+ const s = this.normalizeContextMode(o);
277
+ if (o !== s) {
278
+ this.setAttribute("context-mode", s);
274
279
  return;
275
280
  }
276
281
  this.syncContextModeUI(), this.updateActionsLayout();
@@ -293,7 +298,7 @@ class k extends HTMLElement {
293
298
  return;
294
299
  }
295
300
  if (t === "fan-open" || t === "actions-fan") {
296
- this.updateActionsLayout();
301
+ this.ensureFanMode(), this.updateActionsLayout();
297
302
  return;
298
303
  }
299
304
  if (t === "debug") {
@@ -301,7 +306,11 @@ class k extends HTMLElement {
301
306
  return;
302
307
  }
303
308
  if (t === "loading" || t === "loading-label") {
304
- this.syncLoadingState();
309
+ this.syncLoadingState(), this.syncPreviewLoadingState();
310
+ return;
311
+ }
312
+ if (t === "preview-loading" || t === "preview-loading-label") {
313
+ this.syncPreviewLoadingState();
305
314
  return;
306
315
  }
307
316
  (t === "color-layout" || t === "color-top-start" || t === "color-top-mid" || t === "color-top-end" || t === "color-top-accent") && (this.pendingColorFade = !0), this.render(), this.bindEvents(), this.updateActionsLayout(), this.pendingColorFade && (this.runColorFade(), this.pendingColorFade = !1);
@@ -412,7 +421,7 @@ class k extends HTMLElement {
412
421
  t == null || t.focus();
413
422
  }
414
423
  syncTextareaHeight(t) {
415
- const o = Number.parseInt(this.getAttribute("rows") || String(3), 10) || 3, r = Math.max(o + 6, 10), a = getComputedStyle(t), s = (Number.parseFloat(a.fontSize) || 16) * 1.55, l = Number.parseFloat(a.paddingTop) || 0, c = Number.parseFloat(a.paddingBottom) || 0, u = Number.parseFloat(a.borderTopWidth) || 0, p = Number.parseFloat(a.borderBottomWidth) || 0, h = l + c + u + p, m = 3 * s + h, b = r * s + h;
424
+ const o = Number.parseInt(this.getAttribute("rows") || String(3), 10) || 3, r = Math.max(o + 6, 10), s = getComputedStyle(t), a = (Number.parseFloat(s.fontSize) || 16) * 1.55, l = Number.parseFloat(s.paddingTop) || 0, c = Number.parseFloat(s.paddingBottom) || 0, u = Number.parseFloat(s.borderTopWidth) || 0, p = Number.parseFloat(s.borderBottomWidth) || 0, h = l + c + u + p, m = 3 * a + h, b = r * a + h;
416
425
  t.style.height = "auto";
417
426
  const g = t.scrollHeight, v = Math.max(m, Math.min(g, b));
418
427
  t.style.height = `${Math.ceil(v)}px`, t.style.overflowY = g > b ? "auto" : "hidden";
@@ -454,14 +463,14 @@ class k extends HTMLElement {
454
463
  const o = e.match(/https?:\/\/[^\s]+/i), r = ((o == null ? void 0 : o[0]) || e).trim();
455
464
  if (!/^https?:\/\//i.test(r)) return null;
456
465
  try {
457
- const a = new URL(r), i = a.pathname.toLowerCase(), s = a.hostname.toLowerCase();
466
+ const s = new URL(r), i = s.pathname.toLowerCase(), a = s.hostname.toLowerCase();
458
467
  if (/\.(png|jpe?g|gif|webp|svg|avif|bmp)$/.test(i))
459
468
  return { url: r, kind: "image", badge: "IMG", mimeType: "image/*" };
460
- if (s === "youtu.be" || s.endsWith("youtube.com") || s.endsWith("youtube-nocookie.com"))
469
+ if (a === "youtu.be" || a.endsWith("youtube.com") || a.endsWith("youtube-nocookie.com"))
461
470
  return { url: r, kind: "video", badge: "VIDEO", mimeType: "video/*" };
462
- if (s.endsWith("vimeo.com") || s.endsWith("twitch.tv"))
471
+ if (a.endsWith("vimeo.com") || a.endsWith("twitch.tv"))
463
472
  return { url: r, kind: "video", badge: "VIDEO", mimeType: "video/*" };
464
- if (s.endsWith("soundcloud.com") || s.endsWith("spotify.com") || s.endsWith("bandcamp.com") || s.endsWith("mixcloud.com"))
473
+ if (a.endsWith("soundcloud.com") || a.endsWith("spotify.com") || a.endsWith("bandcamp.com") || a.endsWith("mixcloud.com"))
465
474
  return { url: r, kind: "audio", badge: "MUSIC", mimeType: "audio/*" };
466
475
  if (/\.(mp4|webm|mov|m4v|ogv)$/.test(i))
467
476
  return { url: r, kind: "video", badge: "VIDEO", mimeType: "video/*" };
@@ -477,14 +486,14 @@ class k extends HTMLElement {
477
486
  this.unbindEvents();
478
487
  const t = this.shadowRoot.querySelector("textarea");
479
488
  t == null || t.addEventListener("input", this.onInput), t == null || t.addEventListener("keydown", this.onKeyDown), t == null || t.addEventListener("paste", this.onPaste), t == null || t.addEventListener("focus", this.onTextareaFocus);
480
- const e = this.shadowRoot.querySelector('slot[name="actions"]'), o = this.shadowRoot.querySelector('slot[name="actions-trigger"]'), r = this.shadowRoot.querySelector('slot[name="actions-right"]'), a = this.shadowRoot.querySelector("#promptDefaultSubmitAction");
481
- e == null || e.addEventListener("slotchange", () => this.updateActionsLayout()), o == null || o.addEventListener("slotchange", () => this.updateActionsLayout()), r == null || r.addEventListener("slotchange", () => this.updateActionsLayout()), a == null || a.addEventListener("click", this.onDefaultSubmitClick), this.addEventListener("prompt-preview-open", this.onPreviewOpen), this.addEventListener("click", this.onContextToggleClick), this.addEventListener("dismiss", this.onContextChipDismiss), this.syncErrorVisibility(), this.bindPreviewOverflow(), this.bindActionTrigger(), this.syncLoadingState();
489
+ const e = this.shadowRoot.querySelector('slot[name="actions"]'), o = this.shadowRoot.querySelector('slot[name="actions-trigger"]'), r = this.shadowRoot.querySelector('slot[name="actions-right"]'), s = this.shadowRoot.querySelector("#promptDefaultSubmitAction");
490
+ e == null || e.addEventListener("slotchange", () => this.updateActionsLayout()), o == null || o.addEventListener("slotchange", () => this.updateActionsLayout()), r == null || r.addEventListener("slotchange", () => this.updateActionsLayout()), s == null || s.addEventListener("click", this.onDefaultSubmitClick), this.addEventListener("prompt-preview-open", this.onPreviewOpen), this.addEventListener("click", this.onContextToggleClick), this.addEventListener("dismiss", this.onContextChipDismiss), this.syncErrorVisibility(), this.bindPreviewOverflow(), this.bindActionTrigger(), this.syncLoadingState();
482
491
  }
483
492
  unbindEvents() {
484
- var o, r, a;
493
+ var o, r, s;
485
494
  if (!this.shadowRoot) return;
486
495
  const t = this.shadowRoot.querySelector("textarea"), e = this.shadowRoot.querySelector("#promptDefaultSubmitAction");
487
- t == null || t.removeEventListener("input", this.onInput), t == null || t.removeEventListener("keydown", this.onKeyDown), t == null || t.removeEventListener("paste", this.onPaste), t == null || t.removeEventListener("focus", this.onTextareaFocus), e == null || e.removeEventListener("click", this.onDefaultSubmitClick), this.removeEventListener("prompt-preview-open", this.onPreviewOpen), this.removeEventListener("click", this.onContextToggleClick), this.removeEventListener("dismiss", this.onContextChipDismiss), this.triggerEl && (this.triggerEl.removeEventListener("click", this.toggleFanOpen), this.triggerEl = null), (o = this.previewRowEl) == null || o.removeEventListener("scroll", this.onPreviewScroll), (r = this.previewSlotEl) == null || r.removeEventListener("slotchange", this.onPreviewSlotChange), (a = this.previewResizeObserver) == null || a.disconnect(), this.previewResizeObserver = null, this.previewShellEl = null, this.previewRowEl = null, this.previewSlotEl = null;
496
+ t == null || t.removeEventListener("input", this.onInput), t == null || t.removeEventListener("keydown", this.onKeyDown), t == null || t.removeEventListener("paste", this.onPaste), t == null || t.removeEventListener("focus", this.onTextareaFocus), e == null || e.removeEventListener("click", this.onDefaultSubmitClick), this.removeEventListener("prompt-preview-open", this.onPreviewOpen), this.removeEventListener("click", this.onContextToggleClick), this.removeEventListener("dismiss", this.onContextChipDismiss), this.triggerEl && (this.triggerEl.removeEventListener("click", this.toggleFanOpen), this.triggerEl = null), (o = this.previewRowEl) == null || o.removeEventListener("scroll", this.onPreviewScroll), (r = this.previewSlotEl) == null || r.removeEventListener("slotchange", this.onPreviewSlotChange), (s = this.previewResizeObserver) == null || s.disconnect(), this.previewResizeObserver = null, this.previewShellEl = null, this.previewRowEl = null, this.previewSlotEl = null;
488
497
  }
489
498
  bindPreviewOverflow() {
490
499
  var t, e;
@@ -493,7 +502,7 @@ class k extends HTMLElement {
493
502
  syncPreviewVisibility() {
494
503
  if (!this.previewShellEl || !this.previewSlotEl) return;
495
504
  const t = this.previewSlotEl.assignedElements({ flatten: !0 }), e = t.length > 0;
496
- this.previewShellEl.toggleAttribute("hidden", !e), this.syncPreviewInteractivity(t);
505
+ this.previewShellEl.toggleAttribute("hidden", !e), this.syncPreviewInteractivity(t), this.syncPreviewLoadingState(t);
497
506
  }
498
507
  syncPreviewInteractivity(t) {
499
508
  var o;
@@ -502,22 +511,36 @@ class k extends HTMLElement {
502
511
  r.tagName.toLowerCase() === "mui-prompt-preview" && r.getAttribute("clickable") !== "false" && r.setAttribute("clickable", "");
503
512
  });
504
513
  }
514
+ syncPreviewLoadingState(t) {
515
+ var i;
516
+ const e = this.getAttribute("preview-loading"), o = (this.getAttribute("preview-loading-label") || "").trim(), r = t || ((i = this.previewSlotEl) == null ? void 0 : i.assignedElements({ flatten: !0 })) || [];
517
+ if (!e) {
518
+ r.forEach((a) => {
519
+ a.tagName.toLowerCase() === "mui-prompt-preview" && a.removeAttribute("loading");
520
+ });
521
+ return;
522
+ }
523
+ const s = e === "auto" ? this.hasAttribute("loading") : !0;
524
+ r.forEach((a) => {
525
+ a.tagName.toLowerCase() === "mui-prompt-preview" && (s ? a.setAttribute("loading", "") : a.removeAttribute("loading"), o && a.setAttribute("loading-label", o));
526
+ });
527
+ }
505
528
  normalizePreviewDetail(t) {
506
- const e = String(t.value || "").trim(), o = String(t.bgImage || "").trim(), r = String(t.badge || "").trim(), a = String(t.label || "Pasted Content"), i = String(t.imageTint || "").trim(), s = o ? "image" : e ? "code" : "text";
529
+ const e = String(t.value || "").trim(), o = String(t.bgImage || "").trim(), r = String(t.badge || "").trim(), s = String(t.label || "Pasted Content"), i = String(t.imageTint || "").trim(), a = o ? "image" : e ? "code" : "text";
507
530
  return {
508
531
  id: String(t.id || ""),
509
532
  value: e,
510
533
  badge: r || (o ? "IMG" : this.detectBadge(e)),
511
- label: a,
534
+ label: s,
512
535
  bgImage: o,
513
536
  imageTint: i,
514
- type: s
537
+ type: a
515
538
  };
516
539
  }
517
540
  openInternalPreviewDialog(t) {
518
541
  var y;
519
542
  if (!this.shadowRoot) return;
520
- const e = this.shadowRoot.querySelector("#promptAutoPreviewDialog"), o = this.shadowRoot.querySelector("#promptAutoPreviewTitle"), r = this.shadowRoot.querySelector("#promptAutoPreviewCode"), a = this.shadowRoot.querySelector("#promptAutoPreviewImage"), i = this.shadowRoot.querySelector("#promptAutoPreviewMedia"), s = this.shadowRoot.querySelector("#promptAutoPreviewMediaUrl"), l = this.normalizePreviewDetail(t), c = this.getAttribute("preview-dialog-title") || l.label, u = l.value, p = l.bgImage, h = l.badge, m = u ? this.detectMediaUrl(u) : null, b = !p && u.length > 0 && (h === "VIDEO" || h === "MUSIC"), g = !p && (!!(m && (m.kind === "video" || m.kind === "audio")) || b), v = p.length > 0, d = u.length > 0, w = (() => {
543
+ const e = this.shadowRoot.querySelector("#promptAutoPreviewDialog"), o = this.shadowRoot.querySelector("#promptAutoPreviewTitle"), r = this.shadowRoot.querySelector("#promptAutoPreviewCode"), s = this.shadowRoot.querySelector("#promptAutoPreviewImage"), i = this.shadowRoot.querySelector("#promptAutoPreviewMedia"), a = this.shadowRoot.querySelector("#promptAutoPreviewMediaUrl"), l = this.normalizePreviewDetail(t), c = this.getAttribute("preview-dialog-title") || l.label, u = l.value, p = l.bgImage, h = l.badge, m = u ? this.detectMediaUrl(u) : null, b = !p && u.length > 0 && (h === "VIDEO" || h === "MUSIC"), g = !p && (!!(m && (m.kind === "video" || m.kind === "audio")) || b), v = p.length > 0, d = u.length > 0, w = (() => {
521
544
  if (!m || m.kind !== "audio") return !1;
522
545
  try {
523
546
  const f = new URL(m.url);
@@ -536,14 +559,14 @@ class k extends HTMLElement {
536
559
  })();
537
560
  if (!(!v && !d && !g)) {
538
561
  if (this.setAttribute("preview-dialog-value", u), this.setAttribute("preview-dialog-image", p), this.setAttribute("preview-dialog-type", h || (v ? "IMG" : "CODE")), o && (o.textContent = c), g ? e == null || e.setAttribute("content-max-height", "none") : e == null || e.removeAttribute("content-max-height"), v)
539
- s && s.setAttribute("hidden", ""), a && (a.setAttribute("src", p), a.removeAttribute("hidden")), i && i.setAttribute("hidden", ""), r && r.setAttribute("hidden", "");
562
+ a && a.setAttribute("hidden", ""), s && (s.setAttribute("src", p), s.removeAttribute("hidden")), i && i.setAttribute("hidden", ""), r && r.setAttribute("hidden", "");
540
563
  else if (g && m) {
541
- if (s) {
564
+ if (a) {
542
565
  const f = w;
543
- s.textContent = f ? n : m.url, f ? (s.setAttribute("href", m.url), s.setAttribute("target", "_blank"), s.setAttribute("rel", "noopener noreferrer")) : (s.removeAttribute("href"), s.removeAttribute("target"), s.removeAttribute("rel")), s.toggleAttribute("hidden", !f);
566
+ a.textContent = f ? n : m.url, f ? (a.setAttribute("href", m.url), a.setAttribute("target", "_blank"), a.setAttribute("rel", "noopener noreferrer")) : (a.removeAttribute("href"), a.removeAttribute("target"), a.removeAttribute("rel")), a.toggleAttribute("hidden", !f);
544
567
  }
545
- i && (i.setAttribute("src", m.url), i.removeAttribute("type"), i.removeAttribute("prefer-native-controls"), i.removeAttribute("hidden")), r && r.setAttribute("hidden", ""), a && (a.removeAttribute("src"), a.setAttribute("hidden", ""));
546
- } else b ? (s && (s.textContent = u, s.toggleAttribute("hidden", !0)), i && (i.setAttribute("src", u), i.setAttribute("type", h === "VIDEO" ? "video" : "audio"), i.removeAttribute("prefer-native-controls"), i.removeAttribute("hidden")), r && r.setAttribute("hidden", ""), a && (a.removeAttribute("src"), a.setAttribute("hidden", ""))) : (s && s.setAttribute("hidden", ""), r && (r.textContent = this.formatPreviewCode(u, h), r.removeAttribute("hidden")), i && (i.removeAttribute("src"), i.removeAttribute("prefer-native-controls"), i.setAttribute("hidden", "")), a && (a.removeAttribute("src"), a.setAttribute("hidden", "")));
568
+ i && (i.setAttribute("src", m.url), i.removeAttribute("type"), i.removeAttribute("prefer-native-controls"), i.removeAttribute("hidden")), r && r.setAttribute("hidden", ""), s && (s.removeAttribute("src"), s.setAttribute("hidden", ""));
569
+ } else b ? (a && (a.textContent = u, a.toggleAttribute("hidden", !0)), i && (i.setAttribute("src", u), i.setAttribute("type", h === "VIDEO" ? "video" : "audio"), i.removeAttribute("prefer-native-controls"), i.removeAttribute("hidden")), r && r.setAttribute("hidden", ""), s && (s.removeAttribute("src"), s.setAttribute("hidden", ""))) : (a && a.setAttribute("hidden", ""), r && (r.textContent = this.formatPreviewCode(u, h), r.removeAttribute("hidden")), i && (i.removeAttribute("src"), i.removeAttribute("prefer-native-controls"), i.setAttribute("hidden", "")), s && (s.removeAttribute("src"), s.setAttribute("hidden", "")));
547
570
  (y = e == null ? void 0 : e.open) == null || y.call(e);
548
571
  }
549
572
  }
@@ -562,16 +585,16 @@ class k extends HTMLElement {
562
585
  this.triggerEl && (this.triggerEl.removeEventListener("click", this.toggleFanOpen), this.triggerEl = null);
563
586
  const r = ((e == null ? void 0 : e.assignedElements({ flatten: !0 })) || []).filter(
564
587
  (c) => !c.hasAttribute("hidden")
565
- ), a = t.assignedElements({ flatten: !0 }).filter(
588
+ ), s = t.assignedElements({ flatten: !0 }).filter(
566
589
  (c) => !c.hasAttribute("hidden")
567
590
  );
568
- if (!(a.length > 0)) {
591
+ if (!(s.length > 0)) {
569
592
  o && (o.setAttribute("hidden", ""), o.style.display = "none");
570
593
  return;
571
594
  }
572
- const s = r.length === 0 && a.length === 1 && this.isContextOnlyAction(a[0]);
573
- o && (o.toggleAttribute("hidden", s), o.style.display = s ? "none" : "inline-flex");
574
- const l = s ? null : r.find((c) => c.hasAttribute("fan-trigger")) || r[0] || o || a.find((c) => c.hasAttribute("fan-trigger")) || a[0] || null;
595
+ const a = r.length === 0 && s.length === 1 && this.isContextOnlyAction(s[0]);
596
+ o && (o.toggleAttribute("hidden", a), o.style.display = a ? "none" : "inline-flex");
597
+ const l = a ? null : r.find((c) => c.hasAttribute("fan-trigger")) || r[0] || o || s.find((c) => c.hasAttribute("fan-trigger")) || s[0] || null;
575
598
  l && (this.triggerEl = l, this.triggerEl.addEventListener("click", this.toggleFanOpen), this.syncTriggerIconState());
576
599
  }
577
600
  syncTriggerIconState() {
@@ -595,18 +618,18 @@ class k extends HTMLElement {
595
618
  this.syncContextModeUI();
596
619
  const t = this.shadowRoot.querySelector('slot[name="actions"]'), e = this.shadowRoot.querySelector('slot[name="actions-trigger"]'), o = this.shadowRoot.querySelector("#promptDefaultActionsTrigger"), r = this.shadowRoot.querySelector(".actions-separator");
597
620
  if (!t) return;
598
- const a = ((e == null ? void 0 : e.assignedElements({ flatten: !0 })) || []).filter(
621
+ const s = ((e == null ? void 0 : e.assignedElements({ flatten: !0 })) || []).filter(
599
622
  (n) => !n.hasAttribute("hidden")
600
623
  ), i = t.assignedElements({ flatten: !0 }).filter(
601
624
  (n) => !n.hasAttribute("hidden")
602
- ), s = i.length > 0, l = this.shadowRoot.querySelector(".actions-slot-left");
603
- l && (l.style.display = s ? "inline-flex" : "none");
604
- const c = a.length === 0 && i.length === 1 && this.isContextOnlyAction(i[0]);
625
+ ), a = i.length > 0, l = this.shadowRoot.querySelector(".actions-slot-left");
626
+ l && (l.style.display = a ? "inline-flex" : "none");
627
+ const c = s.length === 0 && i.length === 1 && this.isContextOnlyAction(i[0]);
605
628
  if (o) {
606
- const n = !s || c;
629
+ const n = !a || c;
607
630
  o.toggleAttribute("hidden", n), o.style.display = n ? "none" : "inline-flex";
608
631
  }
609
- const u = c ? null : a.find((n) => n.hasAttribute("fan-trigger")) || a[0] || o || i.find((n) => n.hasAttribute("fan-trigger")) || i[0] || null, p = i.filter((n) => n !== u), h = u ? [u, ...p] : i, m = this.shadowRoot.querySelector('slot[name="actions-right"]'), b = (m == null ? void 0 : m.assignedElements({ flatten: !0 })) || [], g = this.hasAttribute("actions-fan"), v = this.hasAttribute("fan-open"), d = 100, w = "calc(var(--action-icon-only-size-medium) + var(--space-100))";
632
+ const u = c ? null : s.find((n) => n.hasAttribute("fan-trigger")) || s[0] || o || i.find((n) => n.hasAttribute("fan-trigger")) || i[0] || null, p = i.filter((n) => n !== u), h = u ? [u, ...p] : i, m = this.shadowRoot.querySelector('slot[name="actions-right"]'), b = (m == null ? void 0 : m.assignedElements({ flatten: !0 })) || [], g = this.hasAttribute("actions-fan"), v = this.hasAttribute("fan-open"), d = 100, w = "calc(var(--action-icon-only-size-medium) + var(--space-100))";
610
633
  if (r) {
611
634
  const n = g && v && i.length > 0;
612
635
  r.toggleAttribute("hidden", !n), r.style.display = n ? "inline-flex" : "none";
@@ -657,7 +680,7 @@ class k extends HTMLElement {
657
680
  }
658
681
  render() {
659
682
  if (!this.shadowRoot) return;
660
- const t = this.getAttribute("placeholder") || "Reply to Mui...", e = this.getAttribute("value") || "", o = this.getAttribute("rows") || "3", r = this.hasAttribute("disabled"), a = this.getAttribute("preview-dialog-width") || "560px", i = this.getAttribute("color-top-start") || "", s = this.getAttribute("color-top-mid") || "", l = this.getAttribute("color-top-end") || "", c = this.getAttribute("color-top-accent") || "", p = (this.getAttribute("color-layout") || "default").toLowerCase() === "swap", h = p ? l || "var(--prompt-color-top-end, var(--green-500))" : i || "var(--prompt-color-top-start, var(--mui-brand-400))", m = p ? c || "var(--prompt-color-top-accent, var(--orange-500))" : s || "var(--prompt-color-top-mid, var(--blue-500))", b = p ? i || "var(--prompt-color-top-start, var(--mui-brand-400))" : l || "var(--prompt-color-top-end, var(--green-500))", g = p ? s || "var(--prompt-color-top-mid, var(--blue-500))" : c || "var(--prompt-color-top-accent, var(--orange-500))", v = this.getAttribute("aria-label"), d = this.getAttribute("aria-labelledby"), w = this.getAttribute("aria-describedby"), n = !v && !d ? "Prompt input" : "", y = (this.getAttribute("error-message") || "").trim(), f = y;
683
+ const t = this.getAttribute("placeholder") || "Reply to Mui...", e = this.getAttribute("value") || "", o = this.getAttribute("rows") || "3", r = this.hasAttribute("disabled"), s = this.getAttribute("preview-dialog-width") || "560px", i = this.getAttribute("color-top-start") || "", a = this.getAttribute("color-top-mid") || "", l = this.getAttribute("color-top-end") || "", c = this.getAttribute("color-top-accent") || "", p = (this.getAttribute("color-layout") || "default").toLowerCase() === "swap", h = p ? l || "var(--prompt-color-top-end, var(--green-500))" : i || "var(--prompt-color-top-start, var(--blue-500))", m = p ? c || "var(--prompt-color-top-accent, var(--orange-500))" : a || "var(--prompt-color-top-mid, var(--blue-500))", b = p ? i || "var(--prompt-color-top-start, var(--blue-500))" : l || "var(--prompt-color-top-end, var(--green-500))", g = p ? a || "var(--prompt-color-top-mid, var(--blue-500))" : c || "var(--prompt-color-top-accent, var(--orange-500))", v = this.getAttribute("aria-label"), d = this.getAttribute("aria-labelledby"), w = this.getAttribute("aria-describedby"), n = !v && !d ? "Prompt input" : "", y = (this.getAttribute("error-message") || "").trim(), f = y;
661
684
  this.shadowRoot.innerHTML = /*html*/
662
685
  `
663
686
  <style>
@@ -668,7 +691,7 @@ class k extends HTMLElement {
668
691
  --_prompt-color-top-mid-source: ${m};
669
692
  --_prompt-color-top-end-source: ${b};
670
693
  --_prompt-color-top-accent-source: ${g};
671
- --_prompt-accent-primary: var(--prompt-accent-primary, var(--prompt-spectrum-start, var(--mui-brand-400)));
694
+ --_prompt-accent-primary: var(--prompt-accent-primary, var(--prompt-spectrum-start, var(--blue-500)));
672
695
  --_prompt-accent-secondary: var(--prompt-accent-secondary, var(--blue-500));
673
696
  --_prompt-accent-mid: color-mix(in srgb, var(--_prompt-accent-primary) 52%, var(--_prompt-accent-secondary) 48%);
674
697
  --_prompt-start-tint: color-mix(in srgb, var(--_prompt-color-top-start-source) 24%, transparent 76%);
@@ -1446,7 +1469,7 @@ class k extends HTMLElement {
1446
1469
 
1447
1470
  <mui-dialog
1448
1471
  id="promptAutoPreviewDialog"
1449
- width="${a}"
1472
+ width="${s}"
1450
1473
  content-padding="none"
1451
1474
  >
1452
1475
  <mui-heading id="promptAutoPreviewTitle" slot="title" size="5">Pasted Content</mui-heading>
@@ -4,9 +4,10 @@ import "../mui-button/index.js";
4
4
  import "../mui-icons/close/index.js";
5
5
  import "../mui-icons/play-rectangle/index.js";
6
6
  import "../mui-icons/music-microphone/index.js";
7
+ import "../mui-spinner/index.js";
7
8
  import "../mui-stack/vstack/index.js";
8
- import { getPartMap as E } from "../../utils/part-map/index.js";
9
- class C extends HTMLElement {
9
+ import { getPartMap as C } from "../../utils/part-map/index.js";
10
+ class S extends HTMLElement {
10
11
  constructor() {
11
12
  super(), this.onDismiss = (e) => {
12
13
  e.preventDefault(), e.stopPropagation(), this.dispatchEvent(
@@ -60,7 +61,9 @@ class C extends HTMLElement {
60
61
  "animated",
61
62
  "animation-mode",
62
63
  "variant",
63
- "clickable"
64
+ "clickable",
65
+ "loading",
66
+ "loading-label"
64
67
  ];
65
68
  }
66
69
  get value() {
@@ -156,14 +159,14 @@ class C extends HTMLElement {
156
159
  }
157
160
  render() {
158
161
  if (!this.shadowRoot) return;
159
- const e = this.getAttribute("value") || "", a = e.trim() || "Paste long content to preview it here.", t = this.getBadge(e), s = E("text", "spacing", "layout", "visual"), r = this.getAttribute("accent") || "var(--prompt-preview-accent, var(--surface-elevated-200))", i = this.getAttribute("bg-image") || "", n = this.getAttribute("image-tint") || r, m = i ? n : r, b = this.hasAttribute("inverted"), u = this.hasAttribute("badge-only") ? !1 : !i || this.hasAttribute("show-text"), d = (this.getAttribute("animation-mode") || "loop").toLowerCase(), v = (this.getAttribute("variant") || "").toLowerCase(), h = (this.hasAttribute("animated") || !!i) && d !== "off", g = d === "once" ? "1" : "infinite", c = v === "overlay" || !!i, w = c ? "overlay" : "neutral", f = c ? "overlay" : "secondary", x = `dismiss-action${c ? "" : " dismiss-secondary"}`, y = this.hasAttribute("clickable"), o = this.extractUrl(e), A = !!(o && this.isImageUrl(o)), k = !!(o && !i && (t === "VIDEO" || t === "MUSIC")), $ = o ? this.escapeHtml(o) : "", z = i.replace(/"/g, "&quot;"), I = i ? `
162
+ const e = this.getAttribute("value") || "", a = e.trim() || "Paste long content to preview it here.", t = this.getBadge(e), s = C("text", "spacing", "layout", "visual"), r = this.getAttribute("accent") || "var(--prompt-preview-accent, var(--surface-elevated-200))", i = this.getAttribute("bg-image") || "", n = this.getAttribute("image-tint") || r, d = i ? n : r, v = this.hasAttribute("inverted"), g = this.hasAttribute("badge-only") ? !1 : !i || this.hasAttribute("show-text"), b = (this.getAttribute("animation-mode") || "loop").toLowerCase(), h = (this.getAttribute("variant") || "").toLowerCase(), l = this.hasAttribute("loading"), u = (this.getAttribute("loading-label") || "Loading preview").trim(), w = (this.hasAttribute("animated") || !!i) && b !== "off", f = b === "once" ? "1" : "infinite", c = h === "overlay" || !!i, x = c ? "overlay" : "neutral", y = c ? "overlay" : "secondary", A = `dismiss-action${c ? "" : " dismiss-secondary"}`, k = this.hasAttribute("clickable") && !l, o = this.extractUrl(e), $ = !!(o && this.isImageUrl(o)), z = !!(o && !i && (t === "VIDEO" || t === "MUSIC")), I = o ? this.escapeHtml(o) : "", P = i.replace(/"/g, "&quot;"), E = i ? `
160
163
  linear-gradient(
161
164
  180deg,
162
165
  color-mix(in srgb, ${n} 42%, transparent 58%) 0%,
163
166
  color-mix(in srgb, ${n} 22%, transparent 78%) 30%,
164
167
  color-mix(in srgb, #000 24%, transparent 76%) 100%
165
168
  ),
166
- url("${z}") center / cover no-repeat
169
+ url("${P}") center / cover no-repeat
167
170
  ` : `
168
171
  radial-gradient(
169
172
  circle at 12% 18%,
@@ -191,7 +194,7 @@ class C extends HTMLElement {
191
194
  color-mix(in srgb, ${r} var(--prompt-preview-accent-mix-500), transparent) 30%,
192
195
  transparent 100%
193
196
  )
194
- `, P = `box${i ? " has-image" : ""}${c ? " variant-overlay" : ""}${b ? " inverted" : ""}`;
197
+ `, L = `box${i ? " has-image" : ""}${c ? " variant-overlay" : ""}${v ? " inverted" : ""}`;
195
198
  this.shadowRoot.innerHTML = /*html*/
196
199
  `
197
200
  <style>
@@ -218,13 +221,13 @@ class C extends HTMLElement {
218
221
  box-shadow:
219
222
  var(--shadow-200),
220
223
  0 var(--stroke-size-100) var(--stroke-size-200) var(--black-opacity-20),
221
- inset 0 0 0 1px color-mix(in srgb, ${m} 12%, transparent 88%),
224
+ inset 0 0 0 1px color-mix(in srgb, ${d} 12%, transparent 88%),
222
225
  inset 0 calc(var(--space-050) * -1) var(--space-300) color-mix(in srgb, #000 12%, transparent 88%);
223
226
  filter: var(
224
227
  --prompt-preview-box-drop-shadow,
225
228
  drop-shadow(0 var(--stroke-size-100) var(--stroke-size-200) var(--black-opacity-20))
226
229
  );
227
- background: ${I};
230
+ background: ${E};
228
231
  box-sizing: border-box;
229
232
  width: 100%;
230
233
  min-height: calc(var(--space-600) * 2);
@@ -238,6 +241,25 @@ class C extends HTMLElement {
238
241
  --prompt-preview-top-shade-end-active: var(--prompt-preview-top-shade-end);
239
242
  color: var(--prompt-preview-text-color);
240
243
  }
244
+ .box.loading .inner,
245
+ .box.loading mui-badge,
246
+ .box.loading .dismiss-action {
247
+ display: none;
248
+ }
249
+ .loading-overlay {
250
+ position: absolute;
251
+ inset: 0;
252
+ z-index: 4;
253
+ display: none;
254
+ align-items: center;
255
+ justify-content: center;
256
+ pointer-events: none;
257
+ background: color-mix(in srgb, var(--surface-elevated-100) 35%, transparent 65%);
258
+ backdrop-filter: blur(var(--space-025));
259
+ }
260
+ .box.loading .loading-overlay {
261
+ display: inline-flex;
262
+ }
241
263
  .box.animated {
242
264
  overflow: hidden;
243
265
  }
@@ -274,7 +296,7 @@ class C extends HTMLElement {
274
296
  .box::before {
275
297
  background: radial-gradient(
276
298
  120% 80% at 50% -10%,
277
- color-mix(in srgb, ${m} 32%, transparent 68%) 0%,
299
+ color-mix(in srgb, ${d} 32%, transparent 68%) 0%,
278
300
  transparent 70%
279
301
  );
280
302
  filter: blur(var(--space-050));
@@ -476,22 +498,25 @@ class C extends HTMLElement {
476
498
  }
477
499
  </style>
478
500
 
479
- <div class="${P}${h ? " animated" : ""}" part="${s}" style="--prompt-preview-iterations: ${g};">
501
+ <div class="${L}${w ? " animated" : ""}${l ? " loading" : ""}" part="${s}" style="--prompt-preview-iterations: ${f};" ${l ? 'aria-busy="true"' : ""}>
480
502
  <span class="top-shade"></span>
481
503
  <span class="scanline"></span>
482
- <mui-button class="${x}" icon-only size="xx-small" variant="${f}" aria-label="Dismiss preview">
504
+ <mui-button class="${A}" icon-only size="xx-small" variant="${y}" aria-label="Dismiss preview">
483
505
  <mui-icon-close size="xx-small"></mui-icon-close>
484
506
  </mui-button>
485
- <mui-badge variant="${w}" size="x-small">${t}</mui-badge>
486
- <mui-v-stack class="inner${k ? " media-inline" : ""}" space="var(--space-025)" alignX="stretch">
487
- ${u ? A && !i ? `<img class="snippet-image" src="${$}" alt="${this.escapeHtml(t)} preview image" />` : `<mui-body class="snippet" size="x-small" variant="optional">${o ? `${t === "VIDEO" ? '<span class="snippet-media-only"><mui-icon-play-rectangle class="snippet-media-icon" size="medium"></mui-icon-play-rectangle></span>' : t === "MUSIC" ? '<span class="snippet-media-only"><mui-icon-music-microphone class="snippet-media-icon" size="medium"></mui-icon-music-microphone></span>' : this.escapeHtml(a.slice(0, 260))}` : this.escapeHtml(a.slice(0, 260))}</mui-body>` : ""}
507
+ <mui-badge variant="${x}" size="x-small">${t}</mui-badge>
508
+ <mui-v-stack class="inner${z ? " media-inline" : ""}" space="var(--space-025)" alignX="stretch">
509
+ ${g ? $ && !i ? `<img class="snippet-image" src="${I}" alt="${this.escapeHtml(t)} preview image" />` : `<mui-body class="snippet" size="x-small" variant="optional">${o ? `${t === "VIDEO" ? '<span class="snippet-media-only"><mui-icon-play-rectangle class="snippet-media-icon" size="medium"></mui-icon-play-rectangle></span>' : t === "MUSIC" ? '<span class="snippet-media-only"><mui-icon-music-microphone class="snippet-media-icon" size="medium"></mui-icon-music-microphone></span>' : this.escapeHtml(a.slice(0, 260))}` : this.escapeHtml(a.slice(0, 260))}</mui-body>` : ""}
488
510
  </mui-v-stack>
511
+ <div class="loading-overlay" aria-live="polite" aria-label="${this.escapeHtml(u)}">
512
+ <mui-spinner size="small" label="${this.escapeHtml(u)}"></mui-spinner>
513
+ </div>
489
514
  </div>
490
515
  `;
491
- const l = this.shadowRoot.querySelector(".dismiss-action");
492
- l == null || l.addEventListener("click", this.onDismiss);
516
+ const m = this.shadowRoot.querySelector(".dismiss-action");
517
+ m == null || m.addEventListener("click", this.onDismiss);
493
518
  const p = this.shadowRoot.querySelector(".box");
494
- p == null || p.removeEventListener("click", this.onOpenPreview), this.removeEventListener("keydown", this.onKeyOpenPreview), y ? (this.setAttribute("tabindex", this.getAttribute("tabindex") || "0"), this.setAttribute("role", this.getAttribute("role") || "button"), this.setAttribute("aria-haspopup", this.getAttribute("aria-haspopup") || "dialog"), this.hasAttribute("aria-label") || this.setAttribute("aria-label", this.getAccessibleSummary(e, t)), p == null || p.addEventListener("click", this.onOpenPreview), this.addEventListener("keydown", this.onKeyOpenPreview)) : (this.getAttribute("tabindex") === "0" && this.removeAttribute("tabindex"), this.getAttribute("role") === "button" && this.removeAttribute("role"), this.getAttribute("aria-haspopup") === "dialog" && this.removeAttribute("aria-haspopup"));
519
+ p == null || p.removeEventListener("click", this.onOpenPreview), this.removeEventListener("keydown", this.onKeyOpenPreview), k ? (this.setAttribute("tabindex", this.getAttribute("tabindex") || "0"), this.setAttribute("role", this.getAttribute("role") || "button"), this.setAttribute("aria-haspopup", this.getAttribute("aria-haspopup") || "dialog"), this.hasAttribute("aria-label") || this.setAttribute("aria-label", this.getAccessibleSummary(e, t)), p == null || p.addEventListener("click", this.onOpenPreview), this.addEventListener("keydown", this.onKeyOpenPreview)) : (this.getAttribute("tabindex") === "0" && this.removeAttribute("tabindex"), this.getAttribute("role") === "button" && this.removeAttribute("role"), this.getAttribute("aria-haspopup") === "dialog" && this.removeAttribute("aria-haspopup"));
495
520
  }
496
521
  }
497
- customElements.get("mui-prompt-preview") || customElements.define("mui-prompt-preview", C);
522
+ customElements.get("mui-prompt-preview") || customElements.define("mui-prompt-preview", S);
@@ -1,4 +1,4 @@
1
- class o extends HTMLElement {
1
+ class s extends HTMLElement {
2
2
  static get observedAttributes() {
3
3
  return ["length", "weight", "direction"];
4
4
  }
@@ -12,8 +12,8 @@ class o extends HTMLElement {
12
12
  this.updateStyles();
13
13
  }
14
14
  syncContextAttributes() {
15
- const t = !!this.closest("mui-card"), e = !!this.closest("mui-form-section");
16
- this.toggleAttribute("in-card", t), this.toggleAttribute("in-form-section", e);
15
+ const t = !!this.closest("mui-card"), e = !!this.closest("mui-form-section"), i = !!this.closest("mui-dialog"), o = !!this.closest("mui-drawer");
16
+ this.toggleAttribute("in-card", t), this.toggleAttribute("in-form-section", e), this.toggleAttribute("in-dialog", i), this.toggleAttribute("in-drawer", o);
17
17
  }
18
18
  updateStyles() {
19
19
  const t = this.getAttribute("length") || "100%", e = this.getAttribute("weight") || "1px", i = (
@@ -24,7 +24,9 @@ class o extends HTMLElement {
24
24
  background: var(--border-color);
25
25
  }
26
26
  :host([in-card]),
27
- :host([in-form-section]) {
27
+ :host([in-form-section]),
28
+ :host([in-dialog]),
29
+ :host([in-drawer]) {
28
30
  background: color-mix(in srgb, var(--border-color) 50%, transparent);
29
31
  }
30
32
  :host([direction="horizontal"]) {
@@ -40,4 +42,4 @@ class o extends HTMLElement {
40
42
  this.shadowRoot.innerHTML = `<style>${i}</style>`;
41
43
  }
42
44
  }
43
- customElements.get("mui-rule") || customElements.define("mui-rule", o);
45
+ customElements.get("mui-rule") || customElements.define("mui-rule", s);