@mushi-mushi/web 1.37.0 → 1.38.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.
package/dist/index.cjs CHANGED
@@ -254,6 +254,701 @@ var init_widget_views = __esm({
254
254
  }
255
255
  });
256
256
 
257
+ // src/capture/screenshot-dom.ts
258
+ var screenshot_dom_exports = {};
259
+ __export(screenshot_dom_exports, {
260
+ captureDomScreenshot: () => captureDomScreenshot
261
+ });
262
+ async function captureDomScreenshot(privacy, fail) {
263
+ const canvas = document.createElement("canvas");
264
+ const ctx = canvas.getContext("2d", { willReadFrequently: true });
265
+ if (!ctx) {
266
+ fail("unsupported");
267
+ return null;
268
+ }
269
+ const width = window.innerWidth;
270
+ const height = window.innerHeight;
271
+ const dpr = Math.min(window.devicePixelRatio || 1, 2);
272
+ canvas.width = width * dpr;
273
+ canvas.height = height * dpr;
274
+ ctx.scale(dpr, dpr);
275
+ const safeDocument = await buildPrivacySafeDocument(privacy);
276
+ const markup = new XMLSerializer().serializeToString(safeDocument).replace(XML_INVALID_CHARS, "");
277
+ const svgData = `
278
+ <svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}">
279
+ <foreignObject width="100%" height="100%">
280
+ <div xmlns="http://www.w3.org/1999/xhtml">
281
+ ${markup}
282
+ </div>
283
+ </foreignObject>
284
+ </svg>
285
+ `;
286
+ const img = new Image();
287
+ const url = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svgData)}`;
288
+ let cspBlocked = false;
289
+ const onViolation = (e) => {
290
+ const v = e;
291
+ if (/^img-src|^default-src/.test(v.violatedDirective ?? "") && /^data/.test(v.blockedURI ?? "")) cspBlocked = true;
292
+ };
293
+ document.addEventListener("securitypolicyviolation", onViolation);
294
+ return new Promise((resolve) => {
295
+ let settled = false;
296
+ const settle = (value, reason) => {
297
+ if (settled) return;
298
+ settled = true;
299
+ clearTimeout(timer);
300
+ document.removeEventListener("securitypolicyviolation", onViolation);
301
+ if (reason) fail(reason);
302
+ resolve(value);
303
+ };
304
+ const timer = setTimeout(() => settle(null, "timeout"), 5e3);
305
+ img.onload = () => {
306
+ try {
307
+ ctx.drawImage(img, 0, 0, width, height);
308
+ if (isCanvasBlank(ctx, width, height)) {
309
+ settle(null, "unsupported");
310
+ return;
311
+ }
312
+ settle(canvas.toDataURL("image/jpeg", 0.7));
313
+ } catch {
314
+ settle(null, "taint");
315
+ }
316
+ };
317
+ img.onerror = () => setTimeout(() => settle(null, cspBlocked ? "csp" : "error"), 0);
318
+ img.src = url;
319
+ });
320
+ }
321
+ async function buildPrivacySafeDocument(privacy) {
322
+ const live = document.documentElement;
323
+ const clone = live.cloneNode(true);
324
+ const liveLinks = live.querySelectorAll("link");
325
+ const cloneLinks = clone.querySelectorAll("link");
326
+ const linkSlots = /* @__PURE__ */ new Map();
327
+ if (liveLinks.length === cloneLinks.length) liveLinks.forEach((l, i) => linkSlots.set(l, cloneLinks[i]));
328
+ const { offscreen, pins, backgrounds } = replayLiveState(live, clone);
329
+ fillScriptedStyleElements(live, clone);
330
+ const hidden = [
331
+ ALWAYS_REDACT_SELECTORS,
332
+ ...privacy?.redactSelectors ?? DEFAULT_REDACT_SELECTORS,
333
+ ...privacy?.maskSelectors ?? [],
334
+ ...privacy?.blockSelectors ?? []
335
+ ];
336
+ inlineMedia(
337
+ Array.from(live.querySelectorAll(MEDIA_SELECTOR)),
338
+ Array.from(clone.querySelectorAll(MEDIA_SELECTOR)),
339
+ (el) => offscreen.has(el) || hidden.some((selector) => matchesOrInside(el, selector))
340
+ );
341
+ pinOffscreen(pins);
342
+ await inlineBackgrounds(backgrounds.filter((bg) => !hidden.some((selector) => matchesOrInside(bg.live, selector))));
343
+ clone.querySelector("#mushi-mushi-widget")?.remove();
344
+ await inlineDocumentStyles(clone, linkSlots);
345
+ stripTaintSources(clone);
346
+ makeXmlSafe(clone);
347
+ freezeMotion(clone);
348
+ fillViewport(clone);
349
+ const redactSelectors = [
350
+ ALWAYS_REDACT_SELECTORS,
351
+ ...privacy?.redactSelectors ?? DEFAULT_REDACT_SELECTORS
352
+ ];
353
+ for (const selector of redactSelectors) {
354
+ for (const el of safeQueryAll(clone, selector)) {
355
+ redactElement(el);
356
+ }
357
+ }
358
+ for (const selector of privacy?.blockSelectors ?? []) {
359
+ for (const el of safeQueryAll(clone, selector)) {
360
+ el.remove();
361
+ }
362
+ }
363
+ for (const selector of privacy?.maskSelectors ?? []) {
364
+ for (const el of safeQueryAll(clone, selector)) {
365
+ maskElement(el);
366
+ }
367
+ }
368
+ return clone;
369
+ }
370
+ function replayLiveState(live, clone) {
371
+ const offscreen = /* @__PURE__ */ new Set();
372
+ const pins = [];
373
+ const backgrounds = [];
374
+ const liveAll = [live, ...Array.from(live.querySelectorAll("*"))];
375
+ const cloneAll = [clone, ...Array.from(clone.querySelectorAll("*"))];
376
+ if (liveAll.length !== cloneAll.length) return { offscreen, pins, backgrounds };
377
+ const animated = animationTargets();
378
+ const styles = [];
379
+ const scroller = document.scrollingElement;
380
+ const pending = /* @__PURE__ */ new Map();
381
+ const set = (el, prop, value) => {
382
+ let decls = pending.get(el);
383
+ if (!decls) pending.set(el, decls = /* @__PURE__ */ new Map());
384
+ decls.set(prop, value);
385
+ };
386
+ const scrolled = [];
387
+ const withBackground = [];
388
+ let inBody = false;
389
+ for (let i = 0; i < liveAll.length; i++) {
390
+ const liveEl = liveAll[i];
391
+ const cloneEl = cloneAll[i];
392
+ const computed = getComputedStyle(liveEl);
393
+ styles.push(computed);
394
+ if (liveEl === document.body) inBody = true;
395
+ if (inBody) {
396
+ if (computed.display === "none") set(cloneEl, "display", "none");
397
+ else {
398
+ const parent = liveEl.parentElement;
399
+ if (computed.visibility !== "visible" && parent && getComputedStyle(parent).visibility === "visible") {
400
+ set(cloneEl, "visibility", computed.visibility);
401
+ }
402
+ if (computed.opacity === "0") set(cloneEl, "opacity", "0");
403
+ if (computed.backgroundImage.includes("url(")) withBackground.push(i);
404
+ }
405
+ }
406
+ if (animated.has(liveEl)) {
407
+ for (const p of ANIMATED_PROPERTIES) set(cloneEl, p, computed.getPropertyValue(p));
408
+ }
409
+ if (computed.position === "sticky" && liveEl instanceof HTMLElement) {
410
+ const offset = stickyOffset(liveEl);
411
+ if (offset) {
412
+ set(cloneEl, "position", "relative");
413
+ set(cloneEl, "top", `${offset.top}px`);
414
+ set(cloneEl, "left", `${offset.left}px`);
415
+ set(cloneEl, "bottom", "auto");
416
+ set(cloneEl, "right", "auto");
417
+ }
418
+ }
419
+ if (liveEl !== scroller && (liveEl.scrollTop > 0 || liveEl.scrollLeft > 0)) scrolled.push(i);
420
+ }
421
+ for (const i of scrolled) {
422
+ const liveEl = liveAll[i];
423
+ const liveKids = liveEl.children;
424
+ const cloneKids = cloneAll[i].children;
425
+ for (let j = 0; j < liveKids.length && j < cloneKids.length; j++) {
426
+ const kid = getComputedStyle(liveKids[j]);
427
+ if (kid.position === "fixed") continue;
428
+ const own = pending.get(cloneKids[j])?.get("transform") ?? kid.transform;
429
+ const shift = `translate(${-liveEl.scrollLeft}px, ${-liveEl.scrollTop}px)`;
430
+ set(cloneKids[j], "transform", own && own !== "none" ? `${shift} ${own}` : shift);
431
+ }
432
+ }
433
+ if (window.scrollX || window.scrollY) {
434
+ set(clone, "position", "relative");
435
+ set(clone, "top", `${-window.scrollY}px`);
436
+ set(clone, "left", `${-window.scrollX}px`);
437
+ }
438
+ for (const [el, decls] of pending) {
439
+ const held = Array.from(decls, ([p, v]) => `${p}:${v}!important`).join(";");
440
+ el.setAttribute("style", `${el.getAttribute("style") ?? ""};${held}`);
441
+ }
442
+ findOffscreen(liveAll, cloneAll, styles, offscreen, pins);
443
+ for (const i of withBackground) {
444
+ if (!offscreen.has(liveAll[i])) {
445
+ backgrounds.push({ live: liveAll[i], clone: cloneAll[i], value: styles[i].backgroundImage });
446
+ }
447
+ }
448
+ return { offscreen, pins, backgrounds };
449
+ }
450
+ async function inlineBackgrounds(backgrounds) {
451
+ const urls = /* @__PURE__ */ new Map();
452
+ let bytes = 0;
453
+ const load = (url) => {
454
+ let pending = urls.get(url);
455
+ if (!pending) {
456
+ pending = urls.size >= MAX_BACKGROUND_URLS ? Promise.resolve(null) : readAsDataUrl(url).then((data) => {
457
+ if (!data || bytes + data.length > MAX_BACKGROUND_BYTES) return null;
458
+ bytes += data.length;
459
+ return data;
460
+ });
461
+ urls.set(url, pending);
462
+ }
463
+ return pending;
464
+ };
465
+ await Promise.all(
466
+ backgrounds.map(async (bg) => {
467
+ const refs = Array.from(bg.value.matchAll(CSS_URL), (m) => m[2].trim()).filter((u) => !u.startsWith("data:"));
468
+ if (refs.length === 0) return;
469
+ const data = await Promise.all(refs.map(load));
470
+ let value = bg.value;
471
+ refs.forEach((ref, k) => {
472
+ if (data[k]) value = value.split(ref).join(data[k]);
473
+ });
474
+ if (value !== bg.value) {
475
+ bg.clone.setAttribute("style", `${bg.clone.getAttribute("style") ?? ""};background-image:${value}!important`);
476
+ }
477
+ })
478
+ );
479
+ }
480
+ async function readAsDataUrl(url) {
481
+ if (typeof fetch !== "function") return null;
482
+ const abort = typeof AbortController === "function" ? new AbortController() : null;
483
+ const timer = setTimeout(() => abort?.abort(), SHEET_FETCH_TIMEOUT_MS);
484
+ try {
485
+ const res = await fetch(url, { cache: "force-cache", signal: abort?.signal });
486
+ if (!res.ok) return null;
487
+ const blob = await res.blob();
488
+ if (blob.size > MAX_BACKGROUND_IMAGE_BYTES || !blob.type.startsWith("image/")) return null;
489
+ const bytes = new Uint8Array(await blob.arrayBuffer());
490
+ let binary = "";
491
+ for (let i = 0; i < bytes.length; i += 32768) {
492
+ binary += String.fromCharCode(...bytes.subarray(i, i + 32768));
493
+ }
494
+ return `data:${blob.type};base64,${btoa(binary)}`;
495
+ } catch {
496
+ return null;
497
+ } finally {
498
+ clearTimeout(timer);
499
+ }
500
+ }
501
+ function findOffscreen(liveAll, cloneAll, styles, offscreen, pins) {
502
+ const bodyIndex = document.body ? liveAll.indexOf(document.body) : -1;
503
+ if (bodyIndex < 0) return;
504
+ const vw = window.innerWidth;
505
+ const vh = window.innerHeight;
506
+ const index = /* @__PURE__ */ new Map();
507
+ const visible = new Array(liveAll.length).fill(false);
508
+ const outside = new Array(liveAll.length).fill(false);
509
+ for (let i = bodyIndex; i < liveAll.length; i++) index.set(liveAll[i], i);
510
+ visible[bodyIndex] = true;
511
+ for (let i = liveAll.length - 1; i > bodyIndex; i--) {
512
+ const el = liveAll[i];
513
+ const r = el.getBoundingClientRect();
514
+ if (r.width > 0 || r.height > 0) {
515
+ if (r.bottom > 0 && r.top < vh && r.right > 0 && r.left < vw) visible[i] = true;
516
+ else outside[i] = true;
517
+ }
518
+ if (styles[i].position === "fixed") visible[i] = true;
519
+ if (visible[i]) {
520
+ outside[i] = false;
521
+ const parent = el.parentElement ? index.get(el.parentElement) : void 0;
522
+ if (parent !== void 0) visible[parent] = true;
523
+ } else if (outside[i]) {
524
+ offscreen.add(el);
525
+ }
526
+ }
527
+ const covered = new Array(liveAll.length).fill(false);
528
+ for (let i = bodyIndex + 1; i < liveAll.length; i++) {
529
+ const el = liveAll[i];
530
+ const parentIndex = el.parentElement ? index.get(el.parentElement) : void 0;
531
+ if (parentIndex === void 0) continue;
532
+ if (covered[parentIndex]) {
533
+ covered[i] = true;
534
+ continue;
535
+ }
536
+ if (!outside[i] || !(el instanceof HTMLElement)) continue;
537
+ const s = styles[i];
538
+ if (!PINNABLE_DISPLAY.test(s.display)) continue;
539
+ covered[i] = true;
540
+ const inFlow = BLOCK_FLOW.test(styles[parentIndex].display) && s.float === "none" && (s.position === "static" || s.position === "relative");
541
+ pins.push({
542
+ clone: cloneAll[i],
543
+ width: el.offsetWidth,
544
+ height: el.offsetHeight,
545
+ marginTop: inFlow ? gapAbove(el) : null,
546
+ marginBottom: inFlow ? gapBelow(el) : null
547
+ });
548
+ }
549
+ }
550
+ function gapAbove(el) {
551
+ const prev = el.previousElementSibling;
552
+ if (!(prev instanceof HTMLElement) || prev.offsetParent !== el.offsetParent) return null;
553
+ return Math.max(0, el.offsetTop - (prev.offsetTop + prev.offsetHeight));
554
+ }
555
+ function gapBelow(el) {
556
+ const next = el.nextElementSibling;
557
+ if (!(next instanceof HTMLElement) || next.offsetParent !== el.offsetParent) return null;
558
+ return Math.max(0, next.offsetTop - (el.offsetTop + el.offsetHeight));
559
+ }
560
+ function pinOffscreen(pins) {
561
+ for (const pin of pins) {
562
+ pin.clone.replaceChildren();
563
+ let pinned = `width:${pin.width}px!important;height:${pin.height}px!important;box-sizing:border-box!important;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;content-visibility:visible!important;contain:none!important;`;
564
+ if (pin.marginTop !== null) pinned += `margin-top:${pin.marginTop}px!important;`;
565
+ if (pin.marginBottom !== null) pinned += `margin-bottom:${pin.marginBottom}px!important;`;
566
+ pin.clone.setAttribute("style", `${pin.clone.getAttribute("style") ?? ""};${pinned}`);
567
+ }
568
+ }
569
+ function animationTargets() {
570
+ try {
571
+ return new Set(
572
+ document.getAnimations().map((a) => a.effect?.target).filter((t) => t instanceof Element && !t.pseudoElement)
573
+ );
574
+ } catch {
575
+ return /* @__PURE__ */ new Set();
576
+ }
577
+ }
578
+ function stickyOffset(el) {
579
+ const stuck = el.getBoundingClientRect();
580
+ const value = el.style.getPropertyValue("position");
581
+ const priority = el.style.getPropertyPriority("position");
582
+ el.style.setProperty("position", "static", "important");
583
+ const flow = el.getBoundingClientRect();
584
+ el.style.removeProperty("position");
585
+ if (value) el.style.setProperty("position", value, priority);
586
+ const top = stuck.top - flow.top;
587
+ const left = stuck.left - flow.left;
588
+ return top || left ? { top, left } : null;
589
+ }
590
+ function inlineMedia(liveMedia, clonedMedia, isHidden) {
591
+ let count = 0;
592
+ let bytes = 0;
593
+ for (let i = 0; i < clonedMedia.length; i++) {
594
+ const cloned = clonedMedia[i];
595
+ const liveEl = liveMedia[i];
596
+ const rect = liveEl?.getBoundingClientRect();
597
+ const layout = liveEl instanceof HTMLElement && liveEl.offsetWidth > 0 ? { width: liveEl.offsetWidth, height: liveEl.offsetHeight } : rect && { width: rect.width, height: rect.height };
598
+ let pixels = null;
599
+ if (liveEl && layout && layout.width > 0 && layout.height > 0 && count < MAX_INLINED_MEDIA && bytes < MAX_INLINED_BYTES && !isHidden(liveEl)) {
600
+ pixels = readPixels(liveEl);
601
+ if (pixels) {
602
+ count++;
603
+ bytes += pixels.url.length;
604
+ }
605
+ }
606
+ replaceMedia(cloned, pixels, layout);
607
+ }
608
+ }
609
+ function readPixels(el) {
610
+ try {
611
+ let source = null;
612
+ let width = 0;
613
+ let height = 0;
614
+ if (el instanceof HTMLCanvasElement) {
615
+ [source, width, height] = [el, el.width, el.height];
616
+ } else if (el instanceof HTMLImageElement && el.complete && el.naturalWidth > 0) {
617
+ [source, width, height] = [el, el.naturalWidth, el.naturalHeight];
618
+ } else if (el instanceof HTMLVideoElement && el.readyState >= 2) {
619
+ [source, width, height] = [el, el.videoWidth, el.videoHeight];
620
+ }
621
+ if (!source || width <= 0 || height <= 0) return null;
622
+ const scale = Math.min(1, MAX_IMAGE_SIDE / Math.max(width, height));
623
+ const canvas = document.createElement("canvas");
624
+ canvas.width = Math.max(1, Math.round(width * scale));
625
+ canvas.height = Math.max(1, Math.round(height * scale));
626
+ const ctx = canvas.getContext("2d");
627
+ if (!ctx) return null;
628
+ ctx.drawImage(source, 0, 0, canvas.width, canvas.height);
629
+ const url = canvas.toDataURL("image/webp", 0.85);
630
+ return url === "data:," ? null : { url, width, height };
631
+ } catch {
632
+ return null;
633
+ }
634
+ }
635
+ function matchesOrInside(el, selector) {
636
+ try {
637
+ return el.closest(selector) !== null;
638
+ } catch {
639
+ return false;
640
+ }
641
+ }
642
+ function replaceMedia(cloned, pixels, layout) {
643
+ const box = cloned.ownerDocument.createElement(pixels ? "img" : "div");
644
+ for (const name of cloned.getAttributeNames()) {
645
+ if (!SOURCE_ATTRIBUTES.has(name)) box.setAttribute(name, cloned.getAttribute(name) ?? "");
646
+ }
647
+ const size = layout ? `width:${layout.width}px;height:${layout.height}px;` : "";
648
+ if (pixels) {
649
+ box.setAttribute("src", pixels.url);
650
+ box.setAttribute("alt", "");
651
+ if (!box.hasAttribute("width")) box.setAttribute("width", String(pixels.width));
652
+ if (!box.hasAttribute("height")) box.setAttribute("height", String(pixels.height));
653
+ box.setAttribute("style", `${box.getAttribute("style") ?? ""};${size}`);
654
+ } else {
655
+ box.setAttribute(
656
+ "style",
657
+ `${box.getAttribute("style") ?? ""};${size}background:#d4d4d4!important;display:${cloned.tagName === "IMG" || cloned.tagName === "CANVAS" ? "inline-block" : "block"};`
658
+ );
659
+ }
660
+ const parent = cloned.parentElement;
661
+ const target = parent && parent.tagName === "PICTURE" ? parent : cloned;
662
+ target.replaceWith(box);
663
+ }
664
+ function makeXmlSafe(root) {
665
+ const doc = root.ownerDocument;
666
+ const walker = doc.createTreeWalker(root, NodeFilter.SHOW_COMMENT);
667
+ const comments = [];
668
+ for (let n = walker.nextNode(); n; n = walker.nextNode()) comments.push(n);
669
+ for (const c of comments) c.parentNode?.removeChild(c);
670
+ for (const el of [root, ...Array.from(root.querySelectorAll("*"))]) {
671
+ for (const name of el.getAttributeNames()) {
672
+ if (!XML_ATTRIBUTE_NAME.test(name)) el.removeAttribute(name);
673
+ }
674
+ }
675
+ }
676
+ function safeQueryAll(root, selector) {
677
+ try {
678
+ return Array.from(root.querySelectorAll(selector));
679
+ } catch {
680
+ return [];
681
+ }
682
+ }
683
+ function redactElement(el) {
684
+ if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) {
685
+ el.value = "";
686
+ el.setAttribute("value", "");
687
+ }
688
+ el.textContent = "";
689
+ el.setAttribute(
690
+ "style",
691
+ `${el.getAttribute("style") ?? ""};background:#000!important;color:#000!important;text-shadow:none!important;border-color:#000!important;`
692
+ );
693
+ el.setAttribute("data-mushi-redacted", "true");
694
+ while (el.firstChild) el.removeChild(el.firstChild);
695
+ }
696
+ function stripTaintSources(root) {
697
+ const pageOrigin = typeof location !== "undefined" ? location.origin : "";
698
+ for (const link of root.querySelectorAll('link[rel="stylesheet"], link[as="style"]')) {
699
+ link.remove();
700
+ }
701
+ for (const styleEl of root.querySelectorAll("style")) {
702
+ const cleaned = stripCssUrlRefs(styleEl.textContent ?? "", pageOrigin);
703
+ if (cleaned !== styleEl.textContent) styleEl.textContent = cleaned;
704
+ }
705
+ for (const el of root.querySelectorAll("[style]")) {
706
+ const s = el.getAttribute("style");
707
+ if (!s) continue;
708
+ const cleaned = stripCssUrlRefs(s, pageOrigin);
709
+ if (cleaned !== s) el.setAttribute("style", cleaned);
710
+ }
711
+ for (const script of root.querySelectorAll("script, noscript, template")) {
712
+ script.remove();
713
+ }
714
+ }
715
+ function stripCssUrlRefs(css, pageOrigin) {
716
+ return css.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/gi, (_match, _q, href) => {
717
+ const trimmed = href.trim();
718
+ if (!trimmed || trimmed.startsWith("data:") || trimmed.startsWith("#")) return _match;
719
+ if (isCrossOriginUrl(trimmed, pageOrigin)) return "none";
720
+ return _match;
721
+ });
722
+ }
723
+ async function inlineDocumentStyles(clone, linkSlots) {
724
+ const sheets = [
725
+ ...Array.from(document.styleSheets),
726
+ ...document.adoptedStyleSheets ?? []
727
+ ];
728
+ const texts = await Promise.all(
729
+ sheets.map(async (sheet) => {
730
+ const owner = sheet.ownerNode;
731
+ if (sheet.disabled || owner instanceof Element && owner.tagName === "STYLE") return "";
732
+ return withMedia(await sheetSource(sheet) ?? serializeSheet(sheet), sheet);
733
+ })
734
+ );
735
+ const head = clone.querySelector("head") ?? clone;
736
+ sheets.forEach((sheet, i) => {
737
+ if (!texts[i]) return;
738
+ const styleEl = document.createElement("style");
739
+ styleEl.textContent = texts[i];
740
+ const slot = sheet.ownerNode ? linkSlots.get(sheet.ownerNode) : void 0;
741
+ if (slot && clone.contains(slot)) slot.replaceWith(styleEl);
742
+ else head.appendChild(styleEl);
743
+ });
744
+ }
745
+ async function sheetSource(sheet, depth = 0) {
746
+ const href = sheet.href;
747
+ if (!href || depth > 3 || typeof fetch !== "function") return null;
748
+ const abort = typeof AbortController === "function" ? new AbortController() : null;
749
+ const timer = setTimeout(() => abort?.abort(), SHEET_FETCH_TIMEOUT_MS);
750
+ try {
751
+ const res = await fetch(href, { cache: "force-cache", signal: abort?.signal });
752
+ if (!res.ok) return null;
753
+ let imported = "";
754
+ for (const rule of readableRules(sheet)) {
755
+ if (!(rule instanceof CSSImportRule) || !rule.styleSheet) continue;
756
+ const text = await sheetSource(rule.styleSheet, depth + 1) ?? serializeSheet(rule.styleSheet);
757
+ imported += wrapImport(text, rule);
758
+ }
759
+ const own = absolutizeCssUrls((await res.text()).replace(/@import\s[^;]*;/gi, ""), href);
760
+ return `${imported}
761
+ ${own}`;
762
+ } catch {
763
+ return null;
764
+ } finally {
765
+ clearTimeout(timer);
766
+ }
767
+ }
768
+ function readableRules(sheet) {
769
+ try {
770
+ return Array.from(sheet.cssRules);
771
+ } catch {
772
+ return [];
773
+ }
774
+ }
775
+ function wrapImport(text, rule) {
776
+ const layer = rule.layerName;
777
+ let out = layer == null ? text : `@layer ${layer}{${text}}`;
778
+ const media = rule.media?.mediaText;
779
+ if (media && media !== "all") out = `@media ${media}{${out}}`;
780
+ return `${out}
781
+ `;
782
+ }
783
+ function withMedia(text, sheet) {
784
+ const media = sheet.media?.mediaText;
785
+ return text && media && media !== "all" ? `@media ${media}{${text}}` : text;
786
+ }
787
+ function absolutizeCssUrls(css, base) {
788
+ return css.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/gi, (match, quote, ref) => {
789
+ const trimmed = ref.trim();
790
+ if (!trimmed || /^(data:|#|[a-z][a-z\d+.-]*:)/i.test(trimmed)) return match;
791
+ try {
792
+ return `url(${quote}${new URL(trimmed, base).href}${quote})`;
793
+ } catch {
794
+ return match;
795
+ }
796
+ });
797
+ }
798
+ function fillScriptedStyleElements(live, clone) {
799
+ const liveStyles = live.querySelectorAll("style");
800
+ const cloneStyles = clone.querySelectorAll("style");
801
+ if (liveStyles.length !== cloneStyles.length) return;
802
+ liveStyles.forEach((el, i) => {
803
+ if ((el.textContent ?? "").trim() || !el.sheet) return;
804
+ const text = serializeSheet(el.sheet);
805
+ if (text) cloneStyles[i].textContent = text;
806
+ });
807
+ }
808
+ function fillViewport(clone) {
809
+ const clear = (c) => !c || c === "transparent" || /^rgba\(.*,\s*0\)$/.test(c);
810
+ let bg = getComputedStyle(document.documentElement).backgroundColor;
811
+ if (clear(bg) && document.body) bg = getComputedStyle(document.body).backgroundColor;
812
+ const root = clone;
813
+ root.style.setProperty("background-color", clear(bg) ? "Canvas" : bg);
814
+ root.style.setProperty("min-height", `${window.innerHeight}px`);
815
+ }
816
+ function freezeMotion(clone) {
817
+ const styleEl = document.createElement("style");
818
+ styleEl.textContent = FREEZE_MOTION_CSS;
819
+ (clone.querySelector("head") ?? clone).appendChild(styleEl);
820
+ }
821
+ function serializeSheet(sheet) {
822
+ let rules;
823
+ try {
824
+ rules = sheet.cssRules;
825
+ } catch {
826
+ return "";
827
+ }
828
+ let text = "";
829
+ for (const rule of Array.from(rules)) {
830
+ if (rule instanceof CSSImportRule) {
831
+ if (rule.styleSheet) text += serializeSheet(rule.styleSheet);
832
+ continue;
833
+ }
834
+ text += `${rule.cssText}
835
+ `;
836
+ }
837
+ return text;
838
+ }
839
+ function isCanvasBlank(ctx, width, height) {
840
+ try {
841
+ const stepX = Math.max(1, Math.floor(width / 8));
842
+ const stepY = Math.max(1, Math.floor(height / 8));
843
+ for (let y = 0; y < height; y += stepY) {
844
+ for (let x = 0; x < width; x += stepX) {
845
+ if (ctx.getImageData(x, y, 1, 1).data[3] !== 0) return false;
846
+ }
847
+ }
848
+ return true;
849
+ } catch {
850
+ return false;
851
+ }
852
+ }
853
+ function isCrossOriginUrl(raw, pageOrigin) {
854
+ if (!raw || raw.startsWith("data:") || raw.startsWith("blob:")) return false;
855
+ try {
856
+ const resolved = new URL(raw, typeof location !== "undefined" ? location.href : "http://localhost/");
857
+ return Boolean(pageOrigin) && resolved.origin !== pageOrigin;
858
+ } catch {
859
+ return true;
860
+ }
861
+ }
862
+ function maskElement(el) {
863
+ if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) {
864
+ el.value = "";
865
+ el.setAttribute("value", "");
866
+ el.setAttribute("placeholder", "\u2022\u2022\u2022\u2022");
867
+ }
868
+ el.textContent = el.children.length === 0 ? "\u2022\u2022\u2022\u2022" : el.textContent;
869
+ el.setAttribute(
870
+ "style",
871
+ `${el.getAttribute("style") ?? ""};background:#8f8f8f!important;color:transparent!important;text-shadow:none!important;`
872
+ );
873
+ el.setAttribute("data-mushi-masked", "true");
874
+ }
875
+ var XML_INVALID_CHARS, XML_ATTRIBUTE_NAME, MAX_INLINED_MEDIA, MAX_INLINED_BYTES, MEDIA_SELECTOR, DEFAULT_REDACT_SELECTORS, ANIMATED_PROPERTIES, MAX_BACKGROUND_URLS, MAX_BACKGROUND_BYTES, MAX_BACKGROUND_IMAGE_BYTES, CSS_URL, PINNABLE_DISPLAY, BLOCK_FLOW, MAX_IMAGE_SIDE, SOURCE_ATTRIBUTES, SHEET_FETCH_TIMEOUT_MS, FREEZE_MOTION_CSS;
876
+ var init_screenshot_dom = __esm({
877
+ "src/capture/screenshot-dom.ts"() {
878
+ init_screenshot();
879
+ XML_INVALID_CHARS = /[\u0000-\u0008\u000B\u000C\u000E-\u001F￾￿]/g;
880
+ XML_ATTRIBUTE_NAME = /^[A-Za-z_][\w.:-]*$/;
881
+ MAX_INLINED_MEDIA = 60;
882
+ MAX_INLINED_BYTES = 12 * 1024 * 1024;
883
+ MEDIA_SELECTOR = "img, video, canvas, iframe, object, embed";
884
+ DEFAULT_REDACT_SELECTORS = ["[data-mushi-redact]"];
885
+ ANIMATED_PROPERTIES = [
886
+ "transform",
887
+ "translate",
888
+ "scale",
889
+ "rotate",
890
+ "opacity",
891
+ "visibility",
892
+ "clip-path",
893
+ "object-position",
894
+ "background-position",
895
+ "left",
896
+ "top",
897
+ "width",
898
+ "height",
899
+ "color",
900
+ "background-color"
901
+ ];
902
+ MAX_BACKGROUND_URLS = 40;
903
+ MAX_BACKGROUND_BYTES = 6 * 1024 * 1024;
904
+ MAX_BACKGROUND_IMAGE_BYTES = 2 * 1024 * 1024;
905
+ CSS_URL = /url\(\s*(['"]?)([^)'"]+)\1\s*\)/gi;
906
+ PINNABLE_DISPLAY = /^(block|flow-root|flex|grid|list-item|inline-block|inline-flex|inline-grid|table)$/;
907
+ BLOCK_FLOW = /^(block|flow-root|list-item)$/;
908
+ MAX_IMAGE_SIDE = 2048;
909
+ SOURCE_ATTRIBUTES = /* @__PURE__ */ new Set(["src", "srcset", "sizes", "poster", "data", "loading", "decoding"]);
910
+ SHEET_FETCH_TIMEOUT_MS = 2500;
911
+ FREEZE_MOTION_CSS = "*,*::before,*::after{animation:none!important;transition:none!important}";
912
+ }
913
+ });
914
+
915
+ // src/capture/screenshot.ts
916
+ function createScreenshotCapture(options = {}) {
917
+ let activeOptions = options;
918
+ const fail = (reason) => {
919
+ activeOptions.onFailed?.(reason);
920
+ emitScreenshotFailed(reason);
921
+ };
922
+ async function take() {
923
+ try {
924
+ if (typeof document === "undefined") return null;
925
+ const { captureDomScreenshot: captureDomScreenshot2 } = await Promise.resolve().then(() => (init_screenshot_dom(), screenshot_dom_exports));
926
+ return await captureDomScreenshot2(activeOptions.privacy, fail);
927
+ } catch {
928
+ fail("error");
929
+ return null;
930
+ }
931
+ }
932
+ return {
933
+ take,
934
+ updateOptions(nextOptions) {
935
+ activeOptions = nextOptions;
936
+ }
937
+ };
938
+ }
939
+ function emitScreenshotFailed(reason) {
940
+ try {
941
+ document.dispatchEvent(new CustomEvent("mushi:screenshot_failed", { detail: { reason }, bubbles: false }));
942
+ } catch {
943
+ }
944
+ }
945
+ var ALWAYS_REDACT_SELECTORS;
946
+ var init_screenshot = __esm({
947
+ "src/capture/screenshot.ts"() {
948
+ ALWAYS_REDACT_SELECTORS = 'input[type="password"],input[autocomplete^="cc-"],[data-private],[data-mushi-mask]';
949
+ }
950
+ });
951
+
257
952
  // src/journey-recording.ts
258
953
  var journey_recording_exports = {};
259
954
  __export(journey_recording_exports, {
@@ -760,6 +1455,7 @@ var en = {
760
1455
  screenshotShareTab: "Share this tab instead",
761
1456
  notSentBlocked: "Not sent. This report was filtered out before sending. Your text is still here; add a little more detail and try again.",
762
1457
  notSentThrottled: "Not sent. Too many reports in a short time. Your text is still here; wait a minute and try again.",
1458
+ screenshotReview: "Check the screenshot below, then press Send again.",
763
1459
  screenshotErrors: {
764
1460
  permission: "Screen capture was blocked. Allow it, then try again.",
765
1461
  unsupported: "This browser can't capture the page. Describe it instead.",
@@ -939,6 +1635,7 @@ var ja = {
939
1635
  screenshotShareTab: "\u3053\u306E\u30BF\u30D6\u3092\u5171\u6709\u3057\u3066\u64AE\u5F71",
940
1636
  notSentBlocked: "\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u9001\u4FE1\u524D\u306E\u78BA\u8A8D\u3067\u5BFE\u8C61\u5916\u3068\u5224\u65AD\u3055\u308C\u307E\u3057\u305F\u3002\u5165\u529B\u5185\u5BB9\u306F\u6B8B\u3063\u3066\u3044\u307E\u3059\u3002\u3082\u3046\u5C11\u3057\u8A73\u3057\u304F\u66F8\u3044\u3066\u3001\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",
941
1637
  notSentThrottled: "\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u77ED\u3044\u6642\u9593\u306B\u9001\u4FE1\u304C\u7D9A\u3044\u3066\u3044\u307E\u3059\u3002\u5165\u529B\u5185\u5BB9\u306F\u6B8B\u3063\u3066\u3044\u307E\u3059\u30021 \u5206\u307B\u3069\u5F85\u3063\u3066\u304B\u3089\u3001\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",
1638
+ screenshotReview: "\u4E0B\u306E\u30B9\u30AF\u30EA\u30FC\u30F3\u30B7\u30E7\u30C3\u30C8\u3092\u78BA\u8A8D\u3057\u3066\u304B\u3089\u3001\u3082\u3046\u4E00\u5EA6\u300C\u9001\u4FE1\u300D\u3092\u62BC\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
942
1639
  screenshotErrors: {
943
1640
  permission: "\u753B\u9762\u306E\u53D6\u5F97\u304C\u8A31\u53EF\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u8A31\u53EF\u3057\u3066\u304B\u3089\u3001\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",
944
1641
  unsupported: "\u3053\u306E\u30D6\u30E9\u30A6\u30B6\u3067\u306F\u753B\u9762\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3002\u6587\u7AE0\u3067\u304A\u77E5\u3089\u305B\u304F\u3060\u3055\u3044\u3002",
@@ -1118,6 +1815,7 @@ var th = {
1118
1815
  screenshotShareTab: "\u0E41\u0E0A\u0E23\u0E4C\u0E41\u0E17\u0E47\u0E1A\u0E19\u0E35\u0E49\u0E41\u0E17\u0E19",
1119
1816
  notSentBlocked: "\u0E22\u0E31\u0E07\u0E44\u0E21\u0E48\u0E44\u0E14\u0E49\u0E2A\u0E48\u0E07 \u0E23\u0E32\u0E22\u0E07\u0E32\u0E19\u0E19\u0E35\u0E49\u0E16\u0E39\u0E01\u0E01\u0E23\u0E2D\u0E07\u0E2D\u0E2D\u0E01\u0E01\u0E48\u0E2D\u0E19\u0E2A\u0E48\u0E07 \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13\u0E22\u0E31\u0E07\u0E2D\u0E22\u0E39\u0E48 \u0E40\u0E1E\u0E34\u0E48\u0E21\u0E23\u0E32\u0E22\u0E25\u0E30\u0E40\u0E2D\u0E35\u0E22\u0E14\u0E2D\u0E35\u0E01\u0E40\u0E25\u0E47\u0E01\u0E19\u0E49\u0E2D\u0E22\u0E41\u0E25\u0E49\u0E27\u0E25\u0E2D\u0E07\u0E2D\u0E35\u0E01\u0E04\u0E23\u0E31\u0E49\u0E07",
1120
1817
  notSentThrottled: "\u0E22\u0E31\u0E07\u0E44\u0E21\u0E48\u0E44\u0E14\u0E49\u0E2A\u0E48\u0E07 \u0E2A\u0E48\u0E07\u0E23\u0E32\u0E22\u0E07\u0E32\u0E19\u0E21\u0E32\u0E01\u0E40\u0E01\u0E34\u0E19\u0E44\u0E1B\u0E43\u0E19\u0E40\u0E27\u0E25\u0E32\u0E2A\u0E31\u0E49\u0E19\u0E46 \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13\u0E22\u0E31\u0E07\u0E2D\u0E22\u0E39\u0E48 \u0E23\u0E2D\u0E2A\u0E31\u0E01\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E19\u0E32\u0E17\u0E35\u0E41\u0E25\u0E49\u0E27\u0E25\u0E2D\u0E07\u0E2D\u0E35\u0E01\u0E04\u0E23\u0E31\u0E49\u0E07",
1818
+ screenshotReview: "\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E20\u0E32\u0E1E\u0E2B\u0E19\u0E49\u0E32\u0E08\u0E2D\u0E14\u0E49\u0E32\u0E19\u0E25\u0E48\u0E32\u0E07 \u0E41\u0E25\u0E49\u0E27\u0E01\u0E14 \u0E2A\u0E48\u0E07 \u0E2D\u0E35\u0E01\u0E04\u0E23\u0E31\u0E49\u0E07",
1121
1819
  screenshotErrors: {
1122
1820
  permission: "\u0E01\u0E32\u0E23\u0E08\u0E31\u0E1A\u0E20\u0E32\u0E1E\u0E16\u0E39\u0E01\u0E1A\u0E25\u0E47\u0E2D\u0E01 \u0E42\u0E1B\u0E23\u0E14\u0E2D\u0E19\u0E38\u0E0D\u0E32\u0E15\u0E41\u0E25\u0E49\u0E27\u0E25\u0E2D\u0E07\u0E2D\u0E35\u0E01\u0E04\u0E23\u0E31\u0E49\u0E07",
1123
1821
  unsupported: "\u0E40\u0E1A\u0E23\u0E32\u0E27\u0E4C\u0E40\u0E0B\u0E2D\u0E23\u0E4C\u0E19\u0E35\u0E49\u0E08\u0E31\u0E1A\u0E20\u0E32\u0E1E\u0E2B\u0E19\u0E49\u0E32\u0E44\u0E21\u0E48\u0E44\u0E14\u0E49 \u0E42\u0E1B\u0E23\u0E14\u0E2D\u0E18\u0E34\u0E1A\u0E32\u0E22\u0E41\u0E17\u0E19",
@@ -1297,6 +1995,7 @@ var es = {
1297
1995
  screenshotShareTab: "Compartir esta pesta\xF1a",
1298
1996
  notSentBlocked: "No se envi\xF3. El reporte se filtr\xF3 antes de enviarse. Tu texto sigue aqu\xED; a\xF1ade algo m\xE1s de detalle e int\xE9ntalo de nuevo.",
1299
1997
  notSentThrottled: "No se envi\xF3. Demasiados reportes en poco tiempo. Tu texto sigue aqu\xED; espera un minuto e int\xE9ntalo de nuevo.",
1998
+ screenshotReview: "Revisa la captura de abajo y pulsa Enviar otra vez.",
1300
1999
  screenshotErrors: {
1301
2000
  permission: "Se bloque\xF3 la captura. Perm\xEDtela y reintenta.",
1302
2001
  unsupported: "Este navegador no puede capturar la p\xE1gina. Descr\xEDbelo.",
@@ -1476,6 +2175,7 @@ var zh = {
1476
2175
  screenshotShareTab: "\u5171\u4EAB\u6B64\u6807\u7B7E\u9875\u6765\u622A\u56FE",
1477
2176
  notSentBlocked: "\u672A\u53D1\u9001\u3002\u8BE5\u53CD\u9988\u5728\u53D1\u9001\u524D\u88AB\u8FC7\u6EE4\u3002\u4F60\u7684\u6587\u5B57\u4ECD\u4FDD\u7559\u5728\u8FD9\u91CC\uFF0C\u8BF7\u8865\u5145\u4E00\u4E9B\u7EC6\u8282\u540E\u91CD\u8BD5\u3002",
1478
2177
  notSentThrottled: "\u672A\u53D1\u9001\u3002\u77ED\u65F6\u95F4\u5185\u63D0\u4EA4\u8FC7\u591A\u3002\u4F60\u7684\u6587\u5B57\u4ECD\u4FDD\u7559\u5728\u8FD9\u91CC\uFF0C\u8BF7\u7B49\u5F85\u4E00\u5206\u949F\u540E\u91CD\u8BD5\u3002",
2178
+ screenshotReview: "\u8BF7\u5148\u67E5\u770B\u4E0B\u65B9\u622A\u56FE\uFF0C\u518D\u70B9\u51FB\u201C\u53D1\u9001\u201D\u3002",
1479
2179
  screenshotErrors: {
1480
2180
  permission: "\u622A\u56FE\u88AB\u62E6\u622A\u4E86\u3002\u8BF7\u5141\u8BB8\u540E\u518D\u8BD5\u3002",
1481
2181
  unsupported: "\u6B64\u6D4F\u89C8\u5668\u65E0\u6CD5\u622A\u56FE\u3002\u8BF7\u7528\u6587\u5B57\u63CF\u8FF0\u3002",
@@ -1743,7 +2443,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
1743
2443
  const touchTarget = 44;
1744
2444
  const panelLauncherGap = fabSize + core.MUSHI_SPACING.comfy;
1745
2445
  const controlRadius = core.MUSHI_RADIUS.control;
1746
- return ` :host{all:initial;color-scheme:${isDark ? "dark" : "light"};font-family:var(--mushi-font,inherit);font-size:var(--mushi-font-size,14px);line-height:1.45;--_bg:var(--mushi-bg,Canvas);--_fg:var(--mushi-fg,CanvasText);--_muted:var(--mushi-muted,color-mix(in oklab,var(--_fg) 64%,transparent));--_surface:var(--mushi-surface,color-mix(in oklab,var(--_bg) 94%,var(--_fg)));--_border:var(--mushi-border,color-mix(in oklab,var(--_fg) 16%,transparent));--_accent:var(--mushi-accent,${panelAccent || "var(--_fg)"});--_accent-fg:var(--mushi-accent-fg,${panelAccent ? panelAccentFg || "white" : "var(--_bg)"});--_ok:var(--mushi-success,${ok});--_err:var(--mushi-error,${danger});--_radius:var(--mushi-radius,12px);--_shadow:var(--mushi-shadow,0 12px 40px rgb(0 0 0 / .18));color:var(--_fg);-webkit-font-smoothing:antialiased;pointer-events:none;}.mushi-trigger,.mushi-banner,.mushi-panel,.mushi-toast{pointer-events:auto;}*,*::before,*::after{box-sizing:border-box;margin:0;padding:0;}button{font-family:inherit;}.mushi-trigger{position:fixed;width:${fabSize}px;height:${fabSize}px;min-width:44px;min-height:44px;border:1px solid var(--_border);border-radius:${controlRadius}px;background:var(--_bg);color:var(--_fg);cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:22px;line-height:1;box-shadow:0 1px 0 var(--_border),0 6px 14px -8px rgba(${shadowInk},0.35),inset 0 -3px 0 var(--_accent);transition:transform ${durationFast}ms ${easeStamp},opacity ${durationFast}ms ${easeStamp};overflow:visible;isolation:isolate;}.mushi-trigger::after{content:'';position:absolute;top:6px;right:6px;width:6px;height:6px;border-radius:50%;background:var(--_accent);box-shadow:0 0 0 0 var(--_accent);animation:mushi-pulse 2.4s ${easeStamp} infinite;}.mushi-trigger:hover{transform:translateY(-2px) rotate(-1.5deg);box-shadow:0 1px 0 var(--_border),0 14px 24px -10px rgba(${shadowInk},0.45),0 0 20px -6px color-mix(in oklab,var(--_accent) 22%,transparent),inset 0 -3px 0 var(--_accent);}.mushi-trigger:active{transform:translateY(0) rotate(0);box-shadow:0 1px 0 var(--_border),0 2px 4px -2px rgba(${shadowInk},0.35),inset 0 -2px 0 var(--_accent);}.mushi-trigger:focus-visible{outline:2px solid var(--_accent);outline-offset:3px;}@keyframes mushi-trigger-pulse{0%{box-shadow:0 0 0 0 color-mix(in oklab,var(--_accent) 55%,transparent),0 1px 0 var(--_border),0 10px 24px -14px rgba(${shadowInk},0.45);}70%{box-shadow:0 0 0 16px color-mix(in oklab,var(--_accent) 0%,transparent),0 1px 0 var(--_border),0 10px 24px -14px rgba(${shadowInk},0.45);}100%{box-shadow:0 0 0 0 color-mix(in oklab,var(--_accent) 0%,transparent),0 1px 0 var(--_border),0 10px 24px -14px rgba(${shadowInk},0.45);}}.mushi-trigger-pulse{animation:mushi-trigger-pulse 800ms ${easeStamp} 3;}@media (prefers-reduced-motion:reduce){.mushi-trigger-pulse{animation:none;}}.mushi-trigger.bottom-right{bottom:var(--mushi-bottom,calc(${gutter}px + env(safe-area-inset-bottom,0px)));right:var(--mushi-right,calc(${gutter}px + env(safe-area-inset-right,0px)));}.mushi-trigger.bottom-left{bottom:var(--mushi-bottom,calc(${gutter}px + env(safe-area-inset-bottom,0px)));left:var(--mushi-left,calc(${gutter}px + env(safe-area-inset-left,0px)));}.mushi-trigger.top-right{top:var(--mushi-top,calc(${gutter}px + env(safe-area-inset-top,0px)));right:var(--mushi-right,calc(${gutter}px + env(safe-area-inset-right,0px)));}.mushi-trigger.top-left{top:var(--mushi-top,calc(${gutter}px + env(safe-area-inset-top,0px)));left:var(--mushi-left,calc(${gutter}px + env(safe-area-inset-left,0px)));}.mushi-trigger.edge-tab{width:${touchTarget}px;height:${edgeTabHeight}px;background:transparent;border:0;border-radius:0;box-shadow:none;font-size:14px;justify-content:flex-end;}.mushi-trigger.edge-tab::after{display:none;}.mushi-trigger.edge-tab:hover,.mushi-trigger.edge-tab:active,.mushi-trigger.edge-tab.dragging{transform:none;box-shadow:none;}.mushi-trigger-face{display:flex;align-items:center;justify-content:center;width:${edgeTabWidth}px;height:100%;background:var(--_bg);border:1px solid var(--_border);border-right:0;border-radius:${controlRadius}px 0 0 ${controlRadius}px;box-shadow:0 4px 12px -6px rgba(${shadowInk},0.4),inset -2px 0 0 var(--_accent);transition:width ${durationFast}ms ${easeStamp},transform ${durationFast}ms ${easeStamp},opacity ${durationFast}ms ${easeStamp};}.mushi-trigger.edge-tab.text{height:auto;min-height:${edgeTabHeight}px;}.mushi-trigger.edge-tab.text .mushi-trigger-face{height:auto;min-height:${edgeTabHeight}px;padding:10px 0;writing-mode:vertical-rl;font-size:12px;white-space:nowrap;}.mushi-trigger.edge-tab:hover .mushi-trigger-face,.mushi-trigger.edge-tab:focus-visible .mushi-trigger-face{width:${edgeTabWidth + 6}px;}.mushi-trigger.edge-tab:focus-visible{outline:none;}.mushi-trigger.edge-tab:focus-visible .mushi-trigger-face{outline:2px solid var(--_accent);outline-offset:2px;}.mushi-trigger.edge-tab.bottom-right,.mushi-trigger.edge-tab.top-right{right:calc(var(--mushi-safe-area,1) * env(safe-area-inset-right,0px));}.mushi-trigger.edge-tab.bottom-left,.mushi-trigger.edge-tab.top-left{left:calc(var(--mushi-safe-area,1) * env(safe-area-inset-left,0px));justify-content:flex-start;}.mushi-trigger.edge-tab.bottom-left .mushi-trigger-face,.mushi-trigger.edge-tab.top-left .mushi-trigger-face{border-right:1px solid var(--_border);border-left:0;border-radius:0 ${controlRadius}px ${controlRadius}px 0;box-shadow:0 4px 12px -6px rgba(${shadowInk},0.4),inset 2px 0 0 var(--_accent);}.mushi-trigger.tucked{opacity:0.3;}.mushi-trigger.edge-tab.tucked{opacity:1;}.mushi-trigger.edge-tab.tucked .mushi-trigger-face{opacity:0.55;transform:translateX(${edgeTabWidth - 6}px);}.mushi-trigger.edge-tab.bottom-left.tucked .mushi-trigger-face,.mushi-trigger.edge-tab.top-left.tucked .mushi-trigger-face{transform:translateX(-${edgeTabWidth - 6}px);}.mushi-trigger.tucked:focus-visible,.mushi-trigger.tucked:focus-visible .mushi-trigger-face{opacity:1;transform:none;}.mushi-trigger.shrunk{width:${bannerHeight}px;height:${bannerHeight}px;opacity:0.82;transform:scale(0.92);}.mushi-trigger{touch-action:none;translate:calc(var(--mushi-drag-active,0) * var(--mushi-drag-x,0px)) calc(var(--mushi-drag-active,0) * var(--mushi-drag-y,0px));}.mushi-trigger.dragging{cursor:grabbing !important;z-index:calc(var(--z,${core.MUSHI_Z.base}) + 2);transition:none !important;box-shadow:0 1px 0 var(--_border),0 20px 40px -12px rgba(${shadowInk},0.55),inset 0 -3px 0 var(--_accent);opacity:0.92;}@media (prefers-reduced-motion:reduce){.mushi-trigger,.mushi-trigger-face{transition:none !important;}.mushi-trigger::after{animation:none;}.mushi-trigger.edge-tab.tucked .mushi-trigger-face{transform:none !important;}}@keyframes mushi-pulse{0%{box-shadow:0 0 0 0 var(--_accent);opacity:1;}70%{box-shadow:0 0 0 8px transparent;opacity:0.5;}100%{box-shadow:0 0 0 0 transparent;opacity:1;}}.mushi-panel{position:fixed;width:calc(${panelWidth}px + 40px);max-width:calc(100vw - 32px);max-height:min(calc(${panelMaxHeight}px + 160px),calc(100dvh - 96px - var(--mushi-keyboard-inset,0px)));background:var(--_bg);color:var(--_fg);border:1px solid var(--_border);border-radius:var(--_radius);box-shadow:var(--_shadow);overflow:hidden;display:flex;flex-direction:column;transform-origin:var(--mushi-origin,bottom right);}.mushi-panel.open{animation:mushi-open 180ms cubic-bezier(.2,.8,.2,1) both;}.mushi-panel.closed{display:none;}.mushi-panel.mushi-swap .mushi-scroll,.mushi-panel.mushi-swap .mushi-footer{animation:mushi-fade 120ms ease-out both;}@keyframes mushi-open{from{opacity:0;transform:translateY(8px);}}@keyframes mushi-fade{from{opacity:0;}}.mushi-panel.bottom-right{bottom:var(--mushi-panel-bottom,calc(var(--mushi-bottom,${gutter}px) + ${panelLauncherGap}px));right:var(--mushi-right,calc(${gutter}px + env(safe-area-inset-right,0px)));--mushi-origin:bottom right;}.mushi-panel.bottom-left{bottom:var(--mushi-panel-bottom,calc(var(--mushi-bottom,${gutter}px) + ${panelLauncherGap}px));left:var(--mushi-left,calc(${gutter}px + env(safe-area-inset-left,0px)));--mushi-origin:bottom left;}.mushi-panel.top-right{top:var(--mushi-panel-top,calc(var(--mushi-top,${gutter}px) + ${panelLauncherGap}px));right:var(--mushi-right,calc(${gutter}px + env(safe-area-inset-right,0px)));--mushi-origin:top right;}.mushi-panel.top-left{top:var(--mushi-panel-top,calc(var(--mushi-top,${gutter}px) + ${panelLauncherGap}px));left:var(--mushi-left,calc(${gutter}px + env(safe-area-inset-left,0px)));--mushi-origin:top left;}.mushi-panel.keyboard-open{bottom:calc(var(--mushi-keyboard-inset,0px) + 8px) !important;}@media (max-width:${panelSheetBreakpoint}px){.mushi-panel{left:0 !important;right:0 !important;top:auto !important;width:100% !important;max-width:100% !important;max-height:calc(100dvh - 24px - var(--mushi-keyboard-inset,0px));border-radius:var(--_radius) var(--_radius) 0 0;bottom:var(--mushi-keyboard-inset,0px) !important;padding-bottom:env(safe-area-inset-bottom,0px);}}.mushi-panel :focus-visible{outline:2px solid var(--_accent);outline-offset:2px;}.mushi-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;}.mushi-notice:empty,.mushi-lead:empty,.mushi-footer:empty,.mushi-brand:empty{display:none;}.mushi-outdated{margin:8px 12px 0;padding:8px 10px;border-radius:8px;background:var(--_surface);font-size:12px;}.mushi-header{display:flex;align-items:center;gap:8px;min-height:56px;padding:6px 6px 6px 16px;border-bottom:1px solid var(--_border);}.mushi-title{flex:1;min-width:0;margin:0;font-size:16px;font-weight:600;line-height:1.25;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow-wrap:anywhere;}.mushi-title:focus{outline:none;}.mushi-header-host-icon{width:20px;height:20px;margin-right:8px;border-radius:4px;object-fit:contain;}.mushi-header .mushi-icon-btn:first-child{margin-left:-10px;}.mushi-header .mushi-icon-btn:last-child{margin-right:-4px;}.mushi-beta-receipt{display:flex;flex-direction:column;gap:2px;align-items:center;}.mushi-icon-btn{display:inline-flex;align-items:center;justify-content:center;flex:none;min-width:44px;min-height:44px;border:0;border-radius:10px;background:none;color:var(--_muted);font:inherit;font-size:17px;cursor:pointer;}.mushi-icon-btn:hover{background:var(--_surface);color:var(--_fg);}.mushi-pill-btn{display:inline-flex;align-items:center;gap:6px;flex:none;min-height:44px;padding:0 12px;border:1px solid var(--_border);border-radius:999px;background:none;color:var(--_fg);font:inherit;font-size:13px;white-space:nowrap;cursor:pointer;}.mushi-pill-btn:hover{background:var(--_surface);}.mushi-badge{padding:1px 7px;border-radius:999px;background:var(--_fg);color:var(--_bg);font-size:11px;font-weight:600;}.mushi-menu-wrap{position:relative;}.mushi-menu{position:absolute;right:0;top:calc(100% + 4px);z-index:2;display:flex;flex-direction:column;min-width:210px;padding:4px;background:var(--_bg);border:1px solid var(--_border);border-radius:10px;box-shadow:var(--_shadow);}.mushi-menu-item{min-height:44px;padding:0 12px;border:0;border-radius:8px;background:none;color:var(--_fg);font:inherit;text-align:left;cursor:pointer;}.mushi-menu-item:hover{background:var(--_surface);}.mushi-scroll{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;display:flex;flex-direction:column;gap:12px;padding:12px 16px 16px;scrollbar-width:thin;}.mushi-body{display:flex;flex-direction:column;gap:12px;min-width:0;}.mushi-footer{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px;padding:10px 12px 12px 16px;border-top:1px solid var(--_border);}.mushi-footer-hint{flex:1;min-width:0;font-size:12px;color:var(--_muted);}.mushi-brand-footer{padding:6px 12px 8px;text-align:center;font-size:11px;color:var(--_muted);}.mushi-brand-link{color:inherit;text-decoration:none;}.mushi-brand-link:hover{text-decoration:underline;}.mushi-textarea,.mushi-input{width:100%;border:1px solid var(--_border);border-radius:10px;background:var(--_bg);color:var(--_fg);font:inherit;}.mushi-textarea{display:block;min-height:88px;max-height:40vh;padding:12px;font-size:15px;line-height:1.45;resize:vertical;}.mushi-input{flex:1;min-width:0;min-height:44px;padding:10px 12px;resize:none;}.mushi-textarea:focus,.mushi-input:focus{outline:2px solid var(--_accent);outline-offset:1px;border-color:transparent;}.mushi-textarea::placeholder,.mushi-input::placeholder{color:var(--_muted);opacity:1;}.mushi-chips{display:flex;flex-wrap:wrap;gap:6px;}.mushi-chip-group{display:contents;}.mushi-chip{min-height:44px;padding:0 14px;border:1px solid var(--_border);border-radius:999px;background:none;color:var(--_fg);font:inherit;font-size:13px;cursor:pointer;}.mushi-chip:hover{background:var(--_surface);}.mushi-chip[aria-checked="true"]{background:var(--_fg);border-color:var(--_fg);color:var(--_bg);}.mushi-chip-more{border-style:dashed;color:var(--_muted);}.mushi-chip-sm{padding:0 12px;font-size:12px;}.mushi-attachments{display:flex;flex-wrap:wrap;align-items:flex-start;gap:8px;}.mushi-attach-btn{display:inline-flex;align-items:center;gap:6px;min-height:44px;padding:0 12px;border:1px solid var(--_border);border-radius:10px;background:var(--_surface);color:var(--_fg);font:inherit;font-size:13px;cursor:pointer;}.mushi-attach-btn:hover{border-color:var(--_muted);}.mushi-attach-btn.active{border-color:var(--_ok);}.mushi-attach-btn.error{border-color:var(--_err);color:var(--_err);}.mushi-attach-btn[disabled]{cursor:progress;opacity:.75;}.mushi-screenshot-preview{display:flex;align-items:flex-start;gap:10px;width:100%;margin:0;}.mushi-screenshot-preview.open{flex-direction:column;}.mushi-thumb{flex:none;padding:0;border:1px solid var(--_border);border-radius:8px;background:var(--_surface);line-height:0;overflow:hidden;cursor:zoom-in;}.mushi-thumb img{display:block;width:72px;height:54px;object-fit:cover;}.mushi-screenshot-preview.open .mushi-thumb{cursor:zoom-out;}.mushi-screenshot-preview.open .mushi-thumb img{width:100%;height:auto;max-height:40vh;object-fit:contain;}.mushi-screenshot-preview figcaption{display:flex;flex-direction:column;gap:2px;min-width:0;font-size:13px;}.mushi-screenshot-hint{font-size:12px;color:var(--_muted);}.mushi-attach-actions{display:flex;gap:14px;}.mushi-annotate-host{width:100%;}.mushi-annotate-host:empty{display:none;}.mushi-note{margin:0;font-size:12px;line-height:1.45;color:var(--_muted);}.mushi-error-inline,.mushi-warn{color:var(--_err);}.mushi-empty{margin:0;padding:24px 8px;text-align:center;color:var(--_muted);}.mushi-link-btn{min-height:24px;padding:0;border:0;background:none;color:inherit;font:inherit;text-decoration:underline;text-underline-offset:2px;cursor:pointer;}.mushi-btn,.mushi-submit{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:44px;padding:0 16px;border-radius:10px;font:inherit;font-size:14px;font-weight:500;cursor:pointer;}.mushi-btn{border:1px solid var(--_border);background:none;color:var(--_fg);}.mushi-btn:hover{background:var(--_surface);}.mushi-submit{min-width:88px;padding:0 20px;border:0;background:var(--_accent);color:var(--_accent-fg);font-weight:600;}.mushi-submit:hover{filter:brightness(1.08);}.mushi-submit[aria-disabled="true"]{opacity:.45;cursor:not-allowed;}.mushi-submit[aria-busy="true"],.mushi-btn[aria-busy="true"]{cursor:progress;opacity:.75;}.mushi-check{display:flex;align-items:center;gap:10px;min-height:44px;font-size:14px;cursor:pointer;}.mushi-check input{width:18px;height:18px;margin:0;accent-color:var(--_fg);}.mushi-inline-form{display:flex;gap:8px;width:100%;}.mushi-optins{display:flex;flex-direction:column;align-items:flex-start;gap:8px;width:100%;margin-top:4px;text-align:left;}.mushi-beta-strip{display:flex;flex-direction:column;gap:4px;padding:10px 12px;border-radius:10px;background:var(--_surface);font-size:13px;}.mushi-beta-strip p{margin:0;}.mushi-beta-tag{padding:0 6px;border-radius:4px;background:var(--_fg);color:var(--_bg);font-size:10px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;}.mushi-beta-perks,.mushi-changelog ul{margin:0;padding-left:18px;font-size:12px;}.mushi-changelog summary{font-size:12px;color:var(--_muted);cursor:pointer;}.mushi-spinner{display:inline-block;width:12px;height:12px;border:2px solid currentColor;border-top-color:transparent;border-radius:50%;vertical-align:-2px;animation:mushi-spin .8s linear infinite;}@keyframes mushi-spin{to{transform:rotate(360deg);}}.mushi-success{display:flex;flex-direction:column;align-items:center;gap:8px;padding:12px 0 4px;text-align:center;}.mushi-success-stamp{position:relative;display:inline-flex;align-items:center;justify-content:center;width:72px;height:72px;color:var(--_accent);}.mushi-success-stamp svg{position:absolute;inset:0;width:100%;height:100%;}.mushi-success-stamp circle{fill:none;stroke:currentColor;stroke-width:3;stroke-dasharray:280;stroke-dashoffset:280;transform:rotate(-90deg);transform-origin:center;animation:mushi-ring 600ms ease-out 60ms forwards;}.mushi-success-stamp-label{font-size:24px;font-weight:600;opacity:0;transform:rotate(-6deg);animation:mushi-press 300ms ease-out 450ms forwards;}@keyframes mushi-ring{to{stroke-dashoffset:0;}}@keyframes mushi-press{from{opacity:0;transform:rotate(-6deg) scale(1.3);}to{opacity:1;transform:rotate(-6deg) scale(1);}}.mushi-success-meta{font-size:12px;color:var(--_muted);}.mushi-success-receipt{display:flex;flex-direction:column;align-items:center;gap:6px;}.mushi-success-sla{margin:0;font-size:15px;}.mushi-success-receipt-id{min-height:24px;padding:2px 6px;border:1px dashed var(--_border);border-radius:6px;background:none;color:inherit;font-family:ui-monospace,monospace;font-size:12px;cursor:pointer;}.mushi-success-rewards{width:100%;}.mushi-success-pts-award{font-size:20px;font-weight:700;}.mushi-tier-bar-track{height:4px;margin:6px 0;border-radius:2px;background:var(--_surface);overflow:hidden;}.mushi-tier-bar-fill{height:100%;background:var(--_fg);transform-origin:left;transform:scaleX(var(--mushi-tier-pct,0));}.mushi-report-list,.mushi-thread,.mushi-assistant-log{display:flex;flex-direction:column;gap:8px;}.mushi-report-row{display:flex;flex-direction:column;gap:4px;width:100%;min-height:56px;padding:10px 12px;border:1px solid var(--_border);border-radius:10px;background:none;color:var(--_fg);font:inherit;text-align:left;}button.mushi-report-row{cursor:pointer;}button.mushi-report-row:hover{background:var(--_surface);}.mushi-report-row.unread{box-shadow:inset 3px 0 0 var(--_fg);}.mushi-row-top{display:flex;align-items:center;gap:8px;min-width:0;}.mushi-row-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;}.mushi-row-when,.mushi-row-meta,.mushi-event time,.mushi-bubble time{font-size:12px;color:var(--_muted);}.mushi-row-when{flex:none;}.mushi-row-meta{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.mushi-row-news{font-size:13px;}.unread .mushi-row-title,.unread .mushi-row-news{font-weight:600;}.mushi-roadmap-row .mushi-btn{align-self:flex-start;}.mushi-pill{flex:none;display:inline-block;padding:2px 8px;border-radius:999px;font-size:12px;font-weight:500;line-height:1.5;white-space:nowrap;}.mushi-tone-neutral,.mushi-tone-muted{background:var(--_surface);color:var(--_muted);}.mushi-tone-info{background:${statusSent.bg};color:color-mix(in oklab,${statusSent.fg} 85%,var(--_fg));}.mushi-tone-attention{background:${statusReview.bg};color:color-mix(in oklab,${statusReview.fg} 85%,var(--_fg));}.mushi-tone-progress{background:${statusFixing.bg};color:color-mix(in oklab,${statusFixing.fg} 85%,var(--_fg));}.mushi-tone-success,.mushi-tone-success-muted{background:${statusFixed.bg};color:color-mix(in oklab,${statusFixed.fg} 85%,var(--_fg));}.mushi-skeleton{display:flex;flex-direction:column;gap:8px;}.mushi-skeleton span{height:14px;border-radius:6px;background:var(--_surface);animation:mushi-shimmer 1.2s ease-in-out infinite alternate;}.mushi-skeleton span:nth-child(2){width:82%;}.mushi-skeleton span:nth-child(3){width:58%;}@keyframes mushi-shimmer{to{opacity:.45;}}.mushi-thread-summary{display:flex;flex-direction:column;gap:6px;padding:12px;border-radius:10px;background:var(--_surface);}.mushi-card-status,.mushi-summary-text{margin:0;}.mushi-summary-text{font-size:14px;white-space:pre-wrap;word-break:break-word;}.mushi-card-thumb{align-self:flex-start;max-width:100%;max-height:160px;border-radius:8px;object-fit:contain;}.mushi-timeline{display:flex;flex-direction:column;gap:10px;margin:0;padding:0;list-style:none;}.mushi-event{display:flex;justify-content:space-between;gap:8px;padding-left:10px;border-left:2px solid var(--_border);font-size:12px;color:var(--_muted);}.mushi-event time,.mushi-bubble time{flex:none;}.mushi-bubble,.mushi-assistant-msg{display:flex;flex-direction:column;gap:2px;max-width:88%;padding:8px 12px;border-radius:12px;background:var(--_surface);white-space:pre-wrap;word-break:break-word;}.mushi-bubble.dev,.mushi-assistant-msg.dev{align-self:flex-start;border:1px solid var(--_border);border-bottom-left-radius:4px;background:none;}.mushi-bubble.mine,.mushi-assistant-msg.mine{align-self:flex-end;border-bottom-right-radius:4px;background:color-mix(in oklab,var(--_fg) 9%,var(--_bg));}.mushi-bubble strong{font-size:12px;}.mushi-bubble p{margin:0;font-size:14px;}.mushi-bubble-state{font-size:11px;color:var(--_muted);}.mushi-verify{display:flex;gap:8px;width:100%;}.mushi-verify .mushi-btn{flex:1;}.mushi-thread-composer{display:flex;align-items:flex-end;gap:8px;width:100%;}.mushi-reply{max-height:104px;overflow-y:auto;}.mushi-send{min-width:44px;padding:0;font-size:18px;}.mushi-thread-action-error{width:100%;margin:0;font-size:12px;}.mushi-assistant-greeting{margin:0;color:var(--_muted);}.mushi-lb{margin:0;padding:0;list-style:none;}.mushi-lb-row{display:flex;align-items:center;gap:10px;min-height:40px;border-bottom:1px solid var(--_border);font-size:13px;}.mushi-lb-row.me{font-weight:600;}.mushi-xapp-group{display:flex;flex-direction:column;gap:6px;}.mushi-xapp-app-name{display:flex;align-items:center;gap:8px;margin:0;font-size:12px;font-weight:600;color:var(--_muted);}.mushi-app-icon{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:22px;height:22px;border:1px solid var(--_border);border-radius:6px;background:var(--_surface);overflow:hidden;}.mushi-app-icon-img{display:block;width:16px;height:16px;object-fit:contain;}.mushi-app-icon-initials{font-size:9px;font-weight:700;line-height:1;color:var(--_muted);}.mushi-toast{position:fixed;display:flex;align-items:center;gap:6px;max-width:min(380px,calc(100vw - 32px));padding:6px 6px 6px 14px;background:var(--_bg);color:var(--_fg);border:1px solid var(--_border);border-radius:12px;box-shadow:var(--_shadow);font-size:14px;animation:mushi-open 180ms ease-out both;}.mushi-toast span{display:flex;flex-direction:column;flex:1;min-width:0;}.mushi-toast strong{font-weight:600;}.mushi-toast small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;color:var(--_muted);}.mushi-toast .mushi-btn{padding:0 12px;}.mushi-toast.bottom-right,.mushi-toast.bottom-left{bottom:calc(var(--mushi-bottom,${gutter}px) + ${panelLauncherGap}px);}.mushi-toast.top-right,.mushi-toast.top-left{top:calc(var(--mushi-top,${gutter}px) + ${panelLauncherGap}px);}.mushi-toast.bottom-right,.mushi-toast.top-right,.mushi-toast.banner-top,.mushi-toast.banner-bottom{right:var(--mushi-right,${gutter}px);}.mushi-toast.bottom-left,.mushi-toast.top-left{left:var(--mushi-left,${gutter}px);}.mushi-toast.banner-top{top:calc(var(--mushi-banner-offset,${bannerHeight}px) + 12px);}.mushi-toast.banner-bottom{bottom:calc(var(--mushi-banner-offset,${bannerHeight}px) + 12px);}.mushi-banner{position:fixed;left:0;right:0;box-sizing:border-box;min-height:${bannerHeight}px;display:flex;align-items:center;justify-content:center;gap:10px;padding:0 calc(16px + env(safe-area-inset-right,0px)) 0 calc(16px + env(safe-area-inset-left,0px));font-family:${fontMono};font-size:12px;letter-spacing:0.04em;white-space:nowrap;overflow:hidden;z-index:var(--mushi-banner-z,${zBanner});animation:mushi-banner-slide-in ${durPanel}ms ${easeStamp} both;}.mushi-banner.top{top:0;padding-top:env(safe-area-inset-top,0px);}.mushi-banner.bottom{bottom:0;padding-bottom:env(safe-area-inset-bottom,0px);}.mushi-banner.neon{background:${neonBannerBg};color:${neonBannerFg};border-bottom:1.5px solid ${neonBannerBorder};}.mushi-banner.neon.bottom{border-top:1.5px solid ${neonBannerBorder};border-bottom:none;}.mushi-banner.neon .mushi-banner-btn{background:rgba(0,0,0,0.14);color:${neonBannerFg};border:1px solid rgba(0,0,0,0.22);}.mushi-banner.neon .mushi-banner-btn:hover{background:rgba(0,0,0,0.22);}.mushi-banner.brand{background:${widgetAccent};color:${inverse};border-bottom:1.5px solid ${brandBannerBorder};}.mushi-banner.brand.bottom{border-top:1.5px solid ${brandBannerBorder};border-bottom:none;}.mushi-banner.brand .mushi-banner-btn{background:rgba(255,255,255,0.18);color:${inverse};border:1px solid rgba(255,255,255,0.32);}.mushi-banner.brand .mushi-banner-btn:hover{background:rgba(255,255,255,0.28);}.mushi-banner.subtle{background:${isDark ? "rgba(15,14,12,0.88)" : "rgba(248,244,237,0.92)"};backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);color:${ink};border-bottom:1px solid ${ruleStrong};}.mushi-banner.subtle.bottom{border-top:1px solid ${ruleStrong};border-bottom:none;}.mushi-banner.subtle .mushi-banner-btn{background:${isDark ? "rgba(242,235,221,0.10)" : "rgba(14,13,11,0.08)"};color:${ink};border:1px solid ${ruleStrong};}.mushi-banner.subtle .mushi-banner-btn:hover{background:${isDark ? "rgba(242,235,221,0.18)" : "rgba(14,13,11,0.14)"};}.mushi-banner-label{flex:1;text-align:center;overflow:hidden;text-overflow:ellipsis;}.mushi-banner--rich{justify-content:space-between;gap:12px;min-height:${bannerHeight}px;height:auto;padding:4px 12px 4px 16px;white-space:normal;}.mushi-banner-body{display:flex;align-items:center;gap:8px;flex:1;min-width:0;overflow:hidden;}.mushi-banner-pill{display:inline-flex;flex-shrink:0;align-items:center;padding:1px 6px;border-radius:3px;border:1px solid currentColor;font-size:10px;font-weight:700;letter-spacing:0.18em;text-transform:uppercase;opacity:0.92;}.mushi-banner.neon .mushi-banner-pill{border-color:rgba(10,26,10,0.45);background:rgba(10,26,10,0.12);}.mushi-banner.brand .mushi-banner-pill{border-color:rgba(255,255,255,0.45);background:rgba(255,255,255,0.14);}.mushi-banner.subtle .mushi-banner-pill{border-color:${ruleStrong};background:${isDark ? "rgba(242,235,221,0.08)" : "rgba(14,13,11,0.06)"};}.mushi-banner-message{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;font-weight:500;line-height:1.3;opacity:0.9;}.mushi-banner-actions{display:inline-flex;align-items:center;gap:0;flex-shrink:1;min-width:0;overflow-x:auto;scrollbar-width:none;font-size:11px;}.mushi-banner-actions::-webkit-scrollbar{display:none;}@media (max-width:${panelSheetBreakpoint}px){.mushi-banner-actions .mushi-banner-extra{display:none;}}.mushi-banner-link{display:inline-flex;align-items:center;padding:2px 8px;border:none;background:transparent;color:inherit;cursor:pointer;font:inherit;letter-spacing:inherit;text-decoration:none;opacity:0.88;transition:opacity ${durInstant}ms ${easeStamp};flex-shrink:0;}.mushi-banner-link:hover{opacity:1;}.mushi-banner-link:focus-visible{outline:2px solid ${widgetAccent};outline-offset:2px;border-radius:2px;}.mushi-banner-divider{opacity:0.28;padding:0 1px;user-select:none;flex-shrink:0;}.mushi-banner--rich .mushi-banner-dismiss{margin-left:4px;}.mushi-banner-btn{display:inline-flex;align-items:center;gap:4px;padding:3px 10px;border-radius:3px;cursor:pointer;font:inherit;letter-spacing:inherit;transition:opacity ${durInstant}ms ${easeStamp};flex-shrink:0;height:24px;line-height:1;}.mushi-banner-btn:focus-visible{outline:2px solid ${widgetAccent};outline-offset:2px;}.mushi-banner-dismiss{background:transparent !important;border:none !important;opacity:0.65;cursor:pointer;font-size:14px;line-height:1;padding:4px 8px;margin-left:auto;flex-shrink:0;color:inherit;border-radius:3px;transition:opacity ${durInstant}ms ${easeStamp};}.mushi-banner-dismiss:hover{opacity:1;background:rgba(0,0,0,0.12) !important;}.mushi-banner.neon .mushi-banner-dismiss:hover{background:rgba(0,0,0,0.18) !important;}.mushi-banner-my-reports{background:transparent;border:none;cursor:pointer;font-size:11px;font-family:${fontMono};opacity:0.75;color:inherit;padding:2px 6px;border-radius:3px;white-space:nowrap;flex-shrink:0;transition:opacity ${durInstant}ms ${easeStamp};margin-left:4px;}.mushi-banner-my-reports:hover{opacity:1;background:rgba(0,0,0,0.10);}.mushi-banner.neon .mushi-banner-my-reports:hover{background:rgba(0,0,0,0.18);}@keyframes mushi-banner-slide-in{from{transform:translateY(calc(-1 * 100%));opacity:0.5;}to{transform:translateY(0);opacity:1;}}.mushi-banner.bottom{animation-name:mushi-banner-slide-in-bottom;}@keyframes mushi-banner-slide-in-bottom{from{transform:translateY(100%);opacity:0.5;}to{transform:translateY(0);opacity:1;}}@media (prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:0.001ms !important;animation-iteration-count:1 !important;transition-duration:0.001ms !important;}.mushi-success-stamp circle{stroke-dashoffset:0;}.mushi-success-stamp-label{opacity:1;}}`;
2446
+ return ` :host{all:initial;color-scheme:${isDark ? "dark" : "light"};font-family:var(--mushi-font,inherit);font-size:var(--mushi-font-size,14px);line-height:1.45;--_bg:var(--mushi-bg,Canvas);--_fg:var(--mushi-fg,CanvasText);--_muted:var(--mushi-muted,color-mix(in oklab,var(--_fg) 64%,transparent));--_surface:var(--mushi-surface,color-mix(in oklab,var(--_bg) 94%,var(--_fg)));--_border:var(--mushi-border,color-mix(in oklab,var(--_fg) 16%,transparent));--_accent:var(--mushi-accent,${panelAccent || "var(--_fg)"});--_accent-fg:var(--mushi-accent-fg,${panelAccent ? panelAccentFg || "white" : "var(--_bg)"});--_ok:var(--mushi-success,${ok});--_err:var(--mushi-error,${danger});--_radius:var(--mushi-radius,12px);--_shadow:var(--mushi-shadow,0 12px 40px rgb(0 0 0 / .18));color:var(--_fg);-webkit-font-smoothing:antialiased;pointer-events:none;}.mushi-trigger,.mushi-banner,.mushi-panel,.mushi-toast{pointer-events:auto;}*,*::before,*::after{box-sizing:border-box;margin:0;padding:0;}button{font-family:inherit;}.mushi-trigger{position:fixed;width:${fabSize}px;height:${fabSize}px;min-width:44px;min-height:44px;border:1px solid var(--_border);border-radius:${controlRadius}px;background:var(--_bg);color:var(--_fg);cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:22px;line-height:1;box-shadow:0 1px 0 var(--_border),0 6px 14px -8px rgba(${shadowInk},0.35),inset 0 -3px 0 var(--_accent);transition:transform ${durationFast}ms ${easeStamp},opacity ${durationFast}ms ${easeStamp};overflow:visible;isolation:isolate;}.mushi-trigger::after{content:'';position:absolute;top:6px;right:6px;width:6px;height:6px;border-radius:50%;background:var(--_accent);box-shadow:0 0 0 0 var(--_accent);animation:mushi-pulse 2.4s ${easeStamp} infinite;}.mushi-trigger:hover{transform:translateY(-2px) rotate(-1.5deg);box-shadow:0 1px 0 var(--_border),0 14px 24px -10px rgba(${shadowInk},0.45),0 0 20px -6px color-mix(in oklab,var(--_accent) 22%,transparent),inset 0 -3px 0 var(--_accent);}.mushi-trigger:active{transform:translateY(0) rotate(0);box-shadow:0 1px 0 var(--_border),0 2px 4px -2px rgba(${shadowInk},0.35),inset 0 -2px 0 var(--_accent);}.mushi-trigger:focus-visible{outline:2px solid var(--_accent);outline-offset:3px;}@keyframes mushi-trigger-pulse{0%{box-shadow:0 0 0 0 color-mix(in oklab,var(--_accent) 55%,transparent),0 1px 0 var(--_border),0 10px 24px -14px rgba(${shadowInk},0.45);}70%{box-shadow:0 0 0 16px color-mix(in oklab,var(--_accent) 0%,transparent),0 1px 0 var(--_border),0 10px 24px -14px rgba(${shadowInk},0.45);}100%{box-shadow:0 0 0 0 color-mix(in oklab,var(--_accent) 0%,transparent),0 1px 0 var(--_border),0 10px 24px -14px rgba(${shadowInk},0.45);}}.mushi-trigger-pulse{animation:mushi-trigger-pulse 800ms ${easeStamp} 3;}@media (prefers-reduced-motion:reduce){.mushi-trigger-pulse{animation:none;}}.mushi-trigger.bottom-right{bottom:var(--mushi-bottom,calc(${gutter}px + env(safe-area-inset-bottom,0px)));right:var(--mushi-right,calc(${gutter}px + env(safe-area-inset-right,0px)));}.mushi-trigger.bottom-left{bottom:var(--mushi-bottom,calc(${gutter}px + env(safe-area-inset-bottom,0px)));left:var(--mushi-left,calc(${gutter}px + env(safe-area-inset-left,0px)));}.mushi-trigger.top-right{top:var(--mushi-top,calc(${gutter}px + env(safe-area-inset-top,0px)));right:var(--mushi-right,calc(${gutter}px + env(safe-area-inset-right,0px)));}.mushi-trigger.top-left{top:var(--mushi-top,calc(${gutter}px + env(safe-area-inset-top,0px)));left:var(--mushi-left,calc(${gutter}px + env(safe-area-inset-left,0px)));}.mushi-trigger.edge-tab{width:${touchTarget}px;height:${edgeTabHeight}px;background:transparent;border:0;border-radius:0;box-shadow:none;font-size:14px;justify-content:flex-end;}.mushi-trigger.edge-tab::after{display:none;}.mushi-trigger.edge-tab:hover,.mushi-trigger.edge-tab:active,.mushi-trigger.edge-tab.dragging{transform:none;box-shadow:none;}.mushi-trigger-face{display:flex;align-items:center;justify-content:center;width:${edgeTabWidth}px;height:100%;background:var(--_bg);border:1px solid var(--_border);border-right:0;border-radius:${controlRadius}px 0 0 ${controlRadius}px;box-shadow:0 4px 12px -6px rgba(${shadowInk},0.4),inset -2px 0 0 var(--_accent);transition:width ${durationFast}ms ${easeStamp},transform ${durationFast}ms ${easeStamp},opacity ${durationFast}ms ${easeStamp};}.mushi-trigger.edge-tab.text{height:auto;min-height:${edgeTabHeight}px;}.mushi-trigger.edge-tab.text .mushi-trigger-face{height:auto;min-height:${edgeTabHeight}px;padding:10px 0;writing-mode:vertical-rl;font-size:12px;white-space:nowrap;}.mushi-trigger.edge-tab:hover .mushi-trigger-face,.mushi-trigger.edge-tab:focus-visible .mushi-trigger-face{width:${edgeTabWidth + 6}px;}.mushi-trigger.edge-tab:focus-visible{outline:none;}.mushi-trigger.edge-tab:focus-visible .mushi-trigger-face{outline:2px solid var(--_accent);outline-offset:2px;}.mushi-trigger.edge-tab.bottom-right,.mushi-trigger.edge-tab.top-right{right:calc(var(--mushi-safe-area,1) * env(safe-area-inset-right,0px));}.mushi-trigger.edge-tab.bottom-left,.mushi-trigger.edge-tab.top-left{left:calc(var(--mushi-safe-area,1) * env(safe-area-inset-left,0px));justify-content:flex-start;}.mushi-trigger.edge-tab.bottom-left .mushi-trigger-face,.mushi-trigger.edge-tab.top-left .mushi-trigger-face{border-right:1px solid var(--_border);border-left:0;border-radius:0 ${controlRadius}px ${controlRadius}px 0;box-shadow:0 4px 12px -6px rgba(${shadowInk},0.4),inset 2px 0 0 var(--_accent);}.mushi-trigger.tucked{opacity:0.3;}.mushi-trigger.edge-tab.tucked{opacity:1;}.mushi-trigger.edge-tab.tucked .mushi-trigger-face{opacity:0.55;transform:translateX(${edgeTabWidth - 6}px);}.mushi-trigger.edge-tab.bottom-left.tucked .mushi-trigger-face,.mushi-trigger.edge-tab.top-left.tucked .mushi-trigger-face{transform:translateX(-${edgeTabWidth - 6}px);}.mushi-trigger.tucked:focus-visible,.mushi-trigger.tucked:focus-visible .mushi-trigger-face{opacity:1;transform:none;}.mushi-trigger.shrunk{width:${bannerHeight}px;height:${bannerHeight}px;opacity:0.82;transform:scale(0.92);}.mushi-trigger{touch-action:none;translate:calc(var(--mushi-drag-active,0) * var(--mushi-drag-x,0px)) calc(var(--mushi-drag-active,0) * var(--mushi-drag-y,0px));}.mushi-trigger.dragging{cursor:grabbing !important;z-index:calc(var(--z,${core.MUSHI_Z.base}) + 2);transition:none !important;box-shadow:0 1px 0 var(--_border),0 20px 40px -12px rgba(${shadowInk},0.55),inset 0 -3px 0 var(--_accent);opacity:0.92;}@media (prefers-reduced-motion:reduce){.mushi-trigger,.mushi-trigger-face{transition:none !important;}.mushi-trigger::after{animation:none;}.mushi-trigger.edge-tab.tucked .mushi-trigger-face{transform:none !important;}}@keyframes mushi-pulse{0%{box-shadow:0 0 0 0 var(--_accent);opacity:1;}70%{box-shadow:0 0 0 8px transparent;opacity:0.5;}100%{box-shadow:0 0 0 0 transparent;opacity:1;}}.mushi-panel{position:fixed;width:calc(${panelWidth}px + 40px);max-width:calc(100vw - 32px);max-height:min(calc(${panelMaxHeight}px + 160px),calc(100dvh - 96px - var(--mushi-keyboard-inset,0px)));background:var(--_bg);color:var(--_fg);border:1px solid var(--_border);border-radius:var(--_radius);box-shadow:var(--_shadow);overflow:hidden;display:flex;flex-direction:column;transform-origin:var(--mushi-origin,bottom right);}.mushi-panel.open{animation:mushi-open 180ms cubic-bezier(.2,.8,.2,1) both;}.mushi-panel.closed{display:none;}.mushi-panel.mushi-swap .mushi-scroll,.mushi-panel.mushi-swap .mushi-footer{animation:mushi-fade 120ms ease-out both;}@keyframes mushi-open{from{opacity:0;transform:translateY(8px);}}@keyframes mushi-fade{from{opacity:0;}}.mushi-panel.bottom-right{bottom:var(--mushi-panel-bottom,calc(var(--mushi-bottom,${gutter}px) + ${panelLauncherGap}px));right:var(--mushi-right,calc(${gutter}px + env(safe-area-inset-right,0px)));--mushi-origin:bottom right;}.mushi-panel.bottom-left{bottom:var(--mushi-panel-bottom,calc(var(--mushi-bottom,${gutter}px) + ${panelLauncherGap}px));left:var(--mushi-left,calc(${gutter}px + env(safe-area-inset-left,0px)));--mushi-origin:bottom left;}.mushi-panel.top-right{top:var(--mushi-panel-top,calc(var(--mushi-top,${gutter}px) + ${panelLauncherGap}px));right:var(--mushi-right,calc(${gutter}px + env(safe-area-inset-right,0px)));--mushi-origin:top right;}.mushi-panel.top-left{top:var(--mushi-panel-top,calc(var(--mushi-top,${gutter}px) + ${panelLauncherGap}px));left:var(--mushi-left,calc(${gutter}px + env(safe-area-inset-left,0px)));--mushi-origin:top left;}.mushi-panel.keyboard-open{bottom:calc(var(--mushi-keyboard-inset,0px) + 8px) !important;}@media (max-width:${panelSheetBreakpoint}px){.mushi-panel{left:0 !important;right:0 !important;top:auto !important;width:100% !important;max-width:100% !important;max-height:calc(100dvh - 24px - var(--mushi-keyboard-inset,0px));border-radius:var(--_radius) var(--_radius) 0 0;bottom:var(--mushi-keyboard-inset,0px) !important;padding-bottom:env(safe-area-inset-bottom,0px);}}.mushi-panel :focus-visible{outline:2px solid var(--_accent);outline-offset:2px;}.mushi-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;}.mushi-notice:empty,.mushi-lead:empty,.mushi-footer:empty,.mushi-brand:empty{display:none;}.mushi-outdated{margin:8px 12px 0;padding:8px 10px;border-radius:8px;background:var(--_surface);font-size:12px;}.mushi-header{display:flex;align-items:center;gap:8px;min-height:56px;padding:6px 6px 6px 16px;border-bottom:1px solid var(--_border);}.mushi-title{flex:1;min-width:0;margin:0;font-size:16px;font-weight:600;line-height:1.25;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow-wrap:anywhere;}.mushi-title:focus{outline:none;}.mushi-header-host-icon{width:20px;height:20px;margin-right:8px;border-radius:4px;object-fit:contain;}.mushi-header .mushi-icon-btn:first-child{margin-left:-10px;}.mushi-header .mushi-icon-btn:last-child{margin-right:-4px;}.mushi-beta-receipt{display:flex;flex-direction:column;gap:2px;align-items:center;}.mushi-icon-btn{display:inline-flex;align-items:center;justify-content:center;flex:none;min-width:44px;min-height:44px;border:0;border-radius:10px;background:none;color:var(--_muted);font:inherit;font-size:17px;cursor:pointer;}.mushi-icon-btn:hover{background:var(--_surface);color:var(--_fg);}.mushi-pill-btn{display:inline-flex;align-items:center;gap:6px;flex:none;min-height:44px;padding:0 12px;border:1px solid var(--_border);border-radius:999px;background:none;color:var(--_fg);font:inherit;font-size:13px;white-space:nowrap;cursor:pointer;}.mushi-pill-btn:hover{background:var(--_surface);}.mushi-badge{padding:1px 7px;border-radius:999px;background:var(--_fg);color:var(--_bg);font-size:11px;font-weight:600;}.mushi-menu-wrap{position:relative;}.mushi-menu{position:absolute;right:0;top:calc(100% + 4px);z-index:2;display:flex;flex-direction:column;min-width:210px;padding:4px;background:var(--_bg);border:1px solid var(--_border);border-radius:10px;box-shadow:var(--_shadow);}.mushi-menu-item{min-height:44px;padding:0 12px;border:0;border-radius:8px;background:none;color:var(--_fg);font:inherit;text-align:left;cursor:pointer;}.mushi-menu-item:hover{background:var(--_surface);}.mushi-scroll{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;display:flex;flex-direction:column;gap:12px;padding:12px 16px 16px;scrollbar-width:thin;}.mushi-body{display:flex;flex-direction:column;gap:12px;min-width:0;}.mushi-footer{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px;padding:10px 12px 12px 16px;border-top:1px solid var(--_border);}.mushi-footer-hint{flex:1;min-width:0;font-size:12px;color:var(--_muted);}.mushi-brand-footer{padding:6px 12px 8px;text-align:center;font-size:11px;color:var(--_muted);}.mushi-brand-link{color:inherit;text-decoration:none;}.mushi-brand-link:hover{text-decoration:underline;}.mushi-textarea,.mushi-input{width:100%;border:1px solid var(--_border);border-radius:10px;background:var(--_bg);color:var(--_fg);font:inherit;}.mushi-textarea{display:block;min-height:88px;max-height:40vh;padding:12px;font-size:15px;line-height:1.45;resize:vertical;}.mushi-input{flex:1;min-width:0;min-height:44px;padding:10px 12px;resize:none;}.mushi-textarea:focus,.mushi-input:focus{outline:2px solid var(--_accent);outline-offset:1px;border-color:transparent;}.mushi-textarea::placeholder,.mushi-input::placeholder{color:var(--_muted);opacity:1;}.mushi-chips{display:flex;flex-wrap:wrap;gap:6px;}.mushi-chip-group{display:contents;}.mushi-chip{min-height:44px;padding:0 14px;border:1px solid var(--_border);border-radius:999px;background:none;color:var(--_fg);font:inherit;font-size:13px;cursor:pointer;}.mushi-chip:hover{background:var(--_surface);}.mushi-chip[aria-checked="true"]{background:var(--_fg);border-color:var(--_fg);color:var(--_bg);}.mushi-chip-more{border-style:dashed;color:var(--_muted);}.mushi-chip-sm{padding:0 12px;font-size:12px;}.mushi-attachments{display:flex;flex-wrap:wrap;align-items:flex-start;gap:8px;}.mushi-attach-btn{display:inline-flex;align-items:center;gap:6px;min-height:44px;padding:0 12px;border:1px solid var(--_border);border-radius:10px;background:var(--_surface);color:var(--_fg);font:inherit;font-size:13px;cursor:pointer;}.mushi-attach-btn:hover{border-color:var(--_muted);}.mushi-attach-btn.active{border-color:var(--_ok);}.mushi-attach-btn.error{border-color:var(--_err);color:var(--_err);}.mushi-attach-btn[disabled]{cursor:progress;opacity:.75;}.mushi-screenshot-preview{display:flex;align-items:flex-start;gap:10px;width:100%;margin:0;}.mushi-screenshot-preview.open{flex-direction:column;}.mushi-thumb{flex:none;padding:0;border:1px solid var(--_border);border-radius:8px;background:var(--_surface);line-height:0;overflow:hidden;cursor:zoom-in;}.mushi-thumb img{display:block;width:72px;height:54px;object-fit:cover;}.mushi-screenshot-preview.open .mushi-thumb{cursor:zoom-out;}.mushi-screenshot-preview.open .mushi-thumb img{width:100%;height:auto;max-height:40vh;object-fit:contain;}.mushi-screenshot-preview figcaption{display:flex;flex-direction:column;gap:2px;min-width:0;font-size:13px;}.mushi-screenshot-hint{font-size:12px;color:var(--_muted);}.mushi-attach-actions{display:flex;gap:14px;}.mushi-annotate-host{width:100%;}.mushi-annotate-host:empty{display:none;}.mushi-note{margin:0;font-size:12px;line-height:1.45;color:var(--_muted);}.mushi-error-inline,.mushi-warn{color:var(--_err);}.mushi-screenshot-review{color:var(--_fg);font-weight:600;}.mushi-empty{margin:0;padding:24px 8px;text-align:center;color:var(--_muted);}.mushi-link-btn{min-height:24px;padding:0;border:0;background:none;color:inherit;font:inherit;text-decoration:underline;text-underline-offset:2px;cursor:pointer;}.mushi-btn,.mushi-submit{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:44px;padding:0 16px;border-radius:10px;font:inherit;font-size:14px;font-weight:500;cursor:pointer;}.mushi-btn{border:1px solid var(--_border);background:none;color:var(--_fg);}.mushi-btn:hover{background:var(--_surface);}.mushi-submit{min-width:88px;padding:0 20px;border:0;background:var(--_accent);color:var(--_accent-fg);font-weight:600;}.mushi-submit:hover{filter:brightness(1.08);}.mushi-submit[aria-disabled="true"]{opacity:.45;cursor:not-allowed;}.mushi-submit[aria-busy="true"],.mushi-btn[aria-busy="true"]{cursor:progress;opacity:.75;}.mushi-check{display:flex;align-items:center;gap:10px;min-height:44px;font-size:14px;cursor:pointer;}.mushi-check input{width:18px;height:18px;margin:0;accent-color:var(--_fg);}.mushi-inline-form{display:flex;gap:8px;width:100%;}.mushi-optins{display:flex;flex-direction:column;align-items:flex-start;gap:8px;width:100%;margin-top:4px;text-align:left;}.mushi-beta-strip{display:flex;flex-direction:column;gap:4px;padding:10px 12px;border-radius:10px;background:var(--_surface);font-size:13px;}.mushi-beta-strip p{margin:0;}.mushi-beta-tag{padding:0 6px;border-radius:4px;background:var(--_fg);color:var(--_bg);font-size:10px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;}.mushi-beta-perks,.mushi-changelog ul{margin:0;padding-left:18px;font-size:12px;}.mushi-changelog summary{font-size:12px;color:var(--_muted);cursor:pointer;}.mushi-spinner{display:inline-block;width:12px;height:12px;border:2px solid currentColor;border-top-color:transparent;border-radius:50%;vertical-align:-2px;animation:mushi-spin .8s linear infinite;}@keyframes mushi-spin{to{transform:rotate(360deg);}}.mushi-success{display:flex;flex-direction:column;align-items:center;gap:8px;padding:12px 0 4px;text-align:center;}.mushi-success-stamp{position:relative;display:inline-flex;align-items:center;justify-content:center;width:72px;height:72px;color:var(--_accent);}.mushi-success-stamp svg{position:absolute;inset:0;width:100%;height:100%;}.mushi-success-stamp circle{fill:none;stroke:currentColor;stroke-width:3;stroke-dasharray:280;stroke-dashoffset:280;transform:rotate(-90deg);transform-origin:center;animation:mushi-ring 600ms ease-out 60ms forwards;}.mushi-success-stamp-label{font-size:24px;font-weight:600;opacity:0;transform:rotate(-6deg);animation:mushi-press 300ms ease-out 450ms forwards;}@keyframes mushi-ring{to{stroke-dashoffset:0;}}@keyframes mushi-press{from{opacity:0;transform:rotate(-6deg) scale(1.3);}to{opacity:1;transform:rotate(-6deg) scale(1);}}.mushi-success-meta{font-size:12px;color:var(--_muted);}.mushi-success-receipt{display:flex;flex-direction:column;align-items:center;gap:6px;}.mushi-success-sla{margin:0;font-size:15px;}.mushi-success-receipt-id{min-height:24px;padding:2px 6px;border:1px dashed var(--_border);border-radius:6px;background:none;color:inherit;font-family:ui-monospace,monospace;font-size:12px;cursor:pointer;}.mushi-success-rewards{width:100%;}.mushi-success-pts-award{font-size:20px;font-weight:700;}.mushi-tier-bar-track{height:4px;margin:6px 0;border-radius:2px;background:var(--_surface);overflow:hidden;}.mushi-tier-bar-fill{height:100%;background:var(--_fg);transform-origin:left;transform:scaleX(var(--mushi-tier-pct,0));}.mushi-report-list,.mushi-thread,.mushi-assistant-log{display:flex;flex-direction:column;gap:8px;}.mushi-report-row{display:flex;flex-direction:column;gap:4px;width:100%;min-height:56px;padding:10px 12px;border:1px solid var(--_border);border-radius:10px;background:none;color:var(--_fg);font:inherit;text-align:left;}button.mushi-report-row{cursor:pointer;}button.mushi-report-row:hover{background:var(--_surface);}.mushi-report-row.unread{box-shadow:inset 3px 0 0 var(--_fg);}.mushi-row-top{display:flex;align-items:center;gap:8px;min-width:0;}.mushi-row-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;}.mushi-row-when,.mushi-row-meta,.mushi-event time,.mushi-bubble time{font-size:12px;color:var(--_muted);}.mushi-row-when{flex:none;}.mushi-row-meta{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.mushi-row-news{font-size:13px;}.unread .mushi-row-title,.unread .mushi-row-news{font-weight:600;}.mushi-roadmap-row .mushi-btn{align-self:flex-start;}.mushi-pill{flex:none;display:inline-block;padding:2px 8px;border-radius:999px;font-size:12px;font-weight:500;line-height:1.5;white-space:nowrap;}.mushi-tone-neutral,.mushi-tone-muted{background:var(--_surface);color:var(--_muted);}.mushi-tone-info{background:${statusSent.bg};color:color-mix(in oklab,${statusSent.fg} 85%,var(--_fg));}.mushi-tone-attention{background:${statusReview.bg};color:color-mix(in oklab,${statusReview.fg} 85%,var(--_fg));}.mushi-tone-progress{background:${statusFixing.bg};color:color-mix(in oklab,${statusFixing.fg} 85%,var(--_fg));}.mushi-tone-success,.mushi-tone-success-muted{background:${statusFixed.bg};color:color-mix(in oklab,${statusFixed.fg} 85%,var(--_fg));}.mushi-skeleton{display:flex;flex-direction:column;gap:8px;}.mushi-skeleton span{height:14px;border-radius:6px;background:var(--_surface);animation:mushi-shimmer 1.2s ease-in-out infinite alternate;}.mushi-skeleton span:nth-child(2){width:82%;}.mushi-skeleton span:nth-child(3){width:58%;}@keyframes mushi-shimmer{to{opacity:.45;}}.mushi-thread-summary{display:flex;flex-direction:column;gap:6px;padding:12px;border-radius:10px;background:var(--_surface);}.mushi-card-status,.mushi-summary-text{margin:0;}.mushi-summary-text{font-size:14px;white-space:pre-wrap;word-break:break-word;}.mushi-card-thumb{align-self:flex-start;max-width:100%;max-height:160px;border-radius:8px;object-fit:contain;}.mushi-timeline{display:flex;flex-direction:column;gap:10px;margin:0;padding:0;list-style:none;}.mushi-event{display:flex;justify-content:space-between;gap:8px;padding-left:10px;border-left:2px solid var(--_border);font-size:12px;color:var(--_muted);}.mushi-event time,.mushi-bubble time{flex:none;}.mushi-bubble,.mushi-assistant-msg{display:flex;flex-direction:column;gap:2px;max-width:88%;padding:8px 12px;border-radius:12px;background:var(--_surface);white-space:pre-wrap;word-break:break-word;}.mushi-bubble.dev,.mushi-assistant-msg.dev{align-self:flex-start;border:1px solid var(--_border);border-bottom-left-radius:4px;background:none;}.mushi-bubble.mine,.mushi-assistant-msg.mine{align-self:flex-end;border-bottom-right-radius:4px;background:color-mix(in oklab,var(--_fg) 9%,var(--_bg));}.mushi-bubble strong{font-size:12px;}.mushi-bubble p{margin:0;font-size:14px;}.mushi-bubble-state{font-size:11px;color:var(--_muted);}.mushi-verify{display:flex;gap:8px;width:100%;}.mushi-verify .mushi-btn{flex:1;}.mushi-thread-composer{display:flex;align-items:flex-end;gap:8px;width:100%;}.mushi-reply{max-height:104px;overflow-y:auto;}.mushi-send{min-width:44px;padding:0;font-size:18px;}.mushi-thread-action-error{width:100%;margin:0;font-size:12px;}.mushi-assistant-greeting{margin:0;color:var(--_muted);}.mushi-lb{margin:0;padding:0;list-style:none;}.mushi-lb-row{display:flex;align-items:center;gap:10px;min-height:40px;border-bottom:1px solid var(--_border);font-size:13px;}.mushi-lb-row.me{font-weight:600;}.mushi-xapp-group{display:flex;flex-direction:column;gap:6px;}.mushi-xapp-app-name{display:flex;align-items:center;gap:8px;margin:0;font-size:12px;font-weight:600;color:var(--_muted);}.mushi-app-icon{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:22px;height:22px;border:1px solid var(--_border);border-radius:6px;background:var(--_surface);overflow:hidden;}.mushi-app-icon-img{display:block;width:16px;height:16px;object-fit:contain;}.mushi-app-icon-initials{font-size:9px;font-weight:700;line-height:1;color:var(--_muted);}.mushi-toast{position:fixed;display:flex;align-items:center;gap:6px;max-width:min(380px,calc(100vw - 32px));padding:6px 6px 6px 14px;background:var(--_bg);color:var(--_fg);border:1px solid var(--_border);border-radius:12px;box-shadow:var(--_shadow);font-size:14px;animation:mushi-open 180ms ease-out both;}.mushi-toast span{display:flex;flex-direction:column;flex:1;min-width:0;}.mushi-toast strong{font-weight:600;}.mushi-toast small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;color:var(--_muted);}.mushi-toast .mushi-btn{padding:0 12px;}.mushi-toast.bottom-right,.mushi-toast.bottom-left{bottom:calc(var(--mushi-bottom,${gutter}px) + ${panelLauncherGap}px);}.mushi-toast.top-right,.mushi-toast.top-left{top:calc(var(--mushi-top,${gutter}px) + ${panelLauncherGap}px);}.mushi-toast.bottom-right,.mushi-toast.top-right,.mushi-toast.banner-top,.mushi-toast.banner-bottom{right:var(--mushi-right,${gutter}px);}.mushi-toast.bottom-left,.mushi-toast.top-left{left:var(--mushi-left,${gutter}px);}.mushi-toast.banner-top{top:calc(var(--mushi-banner-offset,${bannerHeight}px) + 12px);}.mushi-toast.banner-bottom{bottom:calc(var(--mushi-banner-offset,${bannerHeight}px) + 12px);}.mushi-banner{position:fixed;left:0;right:0;box-sizing:border-box;min-height:${bannerHeight}px;display:flex;align-items:center;justify-content:center;gap:10px;padding:0 calc(16px + env(safe-area-inset-right,0px)) 0 calc(16px + env(safe-area-inset-left,0px));font-family:${fontMono};font-size:12px;letter-spacing:0.04em;white-space:nowrap;overflow:hidden;z-index:var(--mushi-banner-z,${zBanner});animation:mushi-banner-slide-in ${durPanel}ms ${easeStamp} both;}.mushi-banner.top{top:0;padding-top:env(safe-area-inset-top,0px);}.mushi-banner.bottom{bottom:0;padding-bottom:env(safe-area-inset-bottom,0px);}.mushi-banner.neon{background:${neonBannerBg};color:${neonBannerFg};border-bottom:1.5px solid ${neonBannerBorder};}.mushi-banner.neon.bottom{border-top:1.5px solid ${neonBannerBorder};border-bottom:none;}.mushi-banner.neon .mushi-banner-btn{background:rgba(0,0,0,0.14);color:${neonBannerFg};border:1px solid rgba(0,0,0,0.22);}.mushi-banner.neon .mushi-banner-btn:hover{background:rgba(0,0,0,0.22);}.mushi-banner.brand{background:${widgetAccent};color:${inverse};border-bottom:1.5px solid ${brandBannerBorder};}.mushi-banner.brand.bottom{border-top:1.5px solid ${brandBannerBorder};border-bottom:none;}.mushi-banner.brand .mushi-banner-btn{background:rgba(255,255,255,0.18);color:${inverse};border:1px solid rgba(255,255,255,0.32);}.mushi-banner.brand .mushi-banner-btn:hover{background:rgba(255,255,255,0.28);}.mushi-banner.subtle{background:${isDark ? "rgba(15,14,12,0.88)" : "rgba(248,244,237,0.92)"};backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);color:${ink};border-bottom:1px solid ${ruleStrong};}.mushi-banner.subtle.bottom{border-top:1px solid ${ruleStrong};border-bottom:none;}.mushi-banner.subtle .mushi-banner-btn{background:${isDark ? "rgba(242,235,221,0.10)" : "rgba(14,13,11,0.08)"};color:${ink};border:1px solid ${ruleStrong};}.mushi-banner.subtle .mushi-banner-btn:hover{background:${isDark ? "rgba(242,235,221,0.18)" : "rgba(14,13,11,0.14)"};}.mushi-banner-label{flex:1;text-align:center;overflow:hidden;text-overflow:ellipsis;}.mushi-banner--rich{justify-content:space-between;gap:12px;min-height:${bannerHeight}px;height:auto;padding:4px 12px 4px 16px;white-space:normal;}.mushi-banner-body{display:flex;align-items:center;gap:8px;flex:1;min-width:0;overflow:hidden;}.mushi-banner-pill{display:inline-flex;flex-shrink:0;align-items:center;padding:1px 6px;border-radius:3px;border:1px solid currentColor;font-size:10px;font-weight:700;letter-spacing:0.18em;text-transform:uppercase;opacity:0.92;}.mushi-banner.neon .mushi-banner-pill{border-color:rgba(10,26,10,0.45);background:rgba(10,26,10,0.12);}.mushi-banner.brand .mushi-banner-pill{border-color:rgba(255,255,255,0.45);background:rgba(255,255,255,0.14);}.mushi-banner.subtle .mushi-banner-pill{border-color:${ruleStrong};background:${isDark ? "rgba(242,235,221,0.08)" : "rgba(14,13,11,0.06)"};}.mushi-banner-message{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;font-weight:500;line-height:1.3;opacity:0.9;}.mushi-banner-actions{display:inline-flex;align-items:center;gap:0;flex-shrink:1;min-width:0;overflow-x:auto;scrollbar-width:none;font-size:11px;}.mushi-banner-actions::-webkit-scrollbar{display:none;}@media (max-width:${panelSheetBreakpoint}px){.mushi-banner-actions .mushi-banner-extra{display:none;}}.mushi-banner-link{display:inline-flex;align-items:center;padding:2px 8px;border:none;background:transparent;color:inherit;cursor:pointer;font:inherit;letter-spacing:inherit;text-decoration:none;opacity:0.88;transition:opacity ${durInstant}ms ${easeStamp};flex-shrink:0;}.mushi-banner-link:hover{opacity:1;}.mushi-banner-link:focus-visible{outline:2px solid ${widgetAccent};outline-offset:2px;border-radius:2px;}.mushi-banner-divider{opacity:0.28;padding:0 1px;user-select:none;flex-shrink:0;}.mushi-banner--rich .mushi-banner-dismiss{margin-left:4px;}.mushi-banner-btn{display:inline-flex;align-items:center;gap:4px;padding:3px 10px;border-radius:3px;cursor:pointer;font:inherit;letter-spacing:inherit;transition:opacity ${durInstant}ms ${easeStamp};flex-shrink:0;height:24px;line-height:1;}.mushi-banner-btn:focus-visible{outline:2px solid ${widgetAccent};outline-offset:2px;}.mushi-banner-dismiss{background:transparent !important;border:none !important;opacity:0.65;cursor:pointer;font-size:14px;line-height:1;padding:4px 8px;margin-left:auto;flex-shrink:0;color:inherit;border-radius:3px;transition:opacity ${durInstant}ms ${easeStamp};}.mushi-banner-dismiss:hover{opacity:1;background:rgba(0,0,0,0.12) !important;}.mushi-banner.neon .mushi-banner-dismiss:hover{background:rgba(0,0,0,0.18) !important;}.mushi-banner-my-reports{background:transparent;border:none;cursor:pointer;font-size:11px;font-family:${fontMono};opacity:0.75;color:inherit;padding:2px 6px;border-radius:3px;white-space:nowrap;flex-shrink:0;transition:opacity ${durInstant}ms ${easeStamp};margin-left:4px;}.mushi-banner-my-reports:hover{opacity:1;background:rgba(0,0,0,0.10);}.mushi-banner.neon .mushi-banner-my-reports:hover{background:rgba(0,0,0,0.18);}@keyframes mushi-banner-slide-in{from{transform:translateY(calc(-1 * 100%));opacity:0.5;}to{transform:translateY(0);opacity:1;}}.mushi-banner.bottom{animation-name:mushi-banner-slide-in-bottom;}@keyframes mushi-banner-slide-in-bottom{from{transform:translateY(100%);opacity:0.5;}to{transform:translateY(0);opacity:1;}}@media (prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:0.001ms !important;animation-iteration-count:1 !important;transition-duration:0.001ms !important;}.mushi-success-stamp circle{stroke-dashoffset:0;}.mushi-success-stamp-label{opacity:1;}}`;
1747
2447
  }
1748
2448
  var esc = escapeHtml;
1749
2449
  var BUILTIN_CHIPS = ["bug", "slow", "visual", "confusing"];
@@ -1867,6 +2567,7 @@ function reportView(ctx) {
1867
2567
  const shot = ctx.screenshotAttached && ctx.screenshotPreview ? `<figure class="mushi-screenshot-preview${ctx.previewOpen ? " open" : ""}"><button type="button" class="mushi-thumb" data-action="toggle-preview" aria-expanded="${ctx.previewOpen}"><img src="${esc(ctx.screenshotPreview)}" alt="${esc(s3.screenshotPreviewAlt)}" /></button><figcaption><span class="mushi-attach-name">${esc(s3.screenshotAttached)}</span>${ctx.screenshotHint ? `<span class="mushi-screenshot-hint">${esc(ctx.screenshotHint)}</span>` : ""}<span class="mushi-attach-actions">${ctx.callbacks.onScreenshotAnnotateRequest ? btn("annotate-screenshot", esc(p.markUp), "mushi-link-btn") : ""}${ctx.allowScreenshotRemove ? btn("remove-screenshot", esc(p.remove), "mushi-link-btn") : ""}</span></figcaption></figure><div class="mushi-annotate-host" data-role="annotate-host"></div>` : ctx.screenshotAvailable ? btn("screenshot", `${ctx.screenshotCapturing ? spin : '<span aria-hidden="true">\u{1F4F7}</span>'}${esc(shotLabel)}`, `mushi-attach-btn${ctx.screenshotError ? " error" : ""}`, `${ctx.screenshotCapturing ? " disabled" : ""} aria-label="${esc(shotLabel)}"`) : "";
1868
2568
  const element = ctx.elementAvailable ? btn("element", `${ctx.elementCapturing ? spin : '<span aria-hidden="true">\u2316</span>'}${esc(elLabel)}`, `mushi-attach-btn${ctx.elementSelected ? " active" : ""}${ctx.elementError ? " error" : ""}`, `${ctx.elementCapturing ? " disabled" : ""} aria-label="${esc(elLabel)}"`) : "";
1869
2569
  const reason = ctx.screenshotError && ctx.screenshotErrorReason ? `<p class="mushi-note mushi-error-inline" role="status" data-role="screenshot-reason">${esc(s3.screenshotErrors[ctx.screenshotErrorReason])}${ctx.callbacks.onScreenshotShareTabRequest ? ` ${btn("screenshot-share-tab", esc(s3.screenshotShareTab), "mushi-link-btn")}` : ""}</p>` : "";
2570
+ const review = ctx.screenshotReview && ctx.screenshotAttached && ctx.screenshotPreview ? `<p class="mushi-note mushi-screenshot-review" role="status" data-role="screenshot-review">${esc(s3.screenshotReview)}</p>` : "";
1870
2571
  const notSent = ctx.submitNotSent ? `<p class="mushi-note mushi-error-inline" data-role="not-sent">${esc(ctx.submitNotSent === "throttled" ? s3.notSentThrottled : s3.notSentBlocked)}</p>` : "";
1871
2572
  const who = ctx.identifiedUser?.name ?? ctx.identifiedUser?.email;
1872
2573
  const feature = ctx.chip === "idea";
@@ -1874,7 +2575,7 @@ function reportView(ctx) {
1874
2575
  return {
1875
2576
  header: renderHeader(ctx, ctx.config.expandedTitle || p.title),
1876
2577
  lead: `<textarea class="mushi-textarea" data-role="description" rows="3" maxlength="${DESCRIPTION_MAX_LENGTH}" placeholder="${esc(feature ? s3.featurePlaceholder : s3.descriptionPlaceholder)}" aria-label="${esc(p.title)}" aria-describedby="mushi-hint"></textarea>`,
1877
- body: `${ctx.config.betaMode?.enabled ? renderBetaStrip(ctx) : ""}<div class="mushi-chips"><div class="mushi-chip-group" role="radiogroup" aria-label="${esc(p.title)}">${chips}</div>${more}</div>${intentRow}<div class="mushi-attachments">${shot}${element}</div>${reason}${notSent}<p class="mushi-note">\u{1F512} ${esc(p.privacy)}</p>${who ? `<p class="mushi-note">\u{1F464} ${esc(who)}</p>` : ""}${ctx.draftLength > DESCRIPTION_MAX_LENGTH - 400 ? `<p class="mushi-note" aria-live="polite">${ctx.draftLength}/${DESCRIPTION_MAX_LENGTH}</p>` : ""}${ctx.launcherDismissible ? `<p class="mushi-note">${btn("hide-launcher", esc(t.widget.hideLauncher ?? HIDE_LAUNCHER_FALLBACK), "mushi-link-btn")}</p>` : ""}`,
2578
+ body: `${ctx.config.betaMode?.enabled ? renderBetaStrip(ctx) : ""}<div class="mushi-chips"><div class="mushi-chip-group" role="radiogroup" aria-label="${esc(p.title)}">${chips}</div>${more}</div>${intentRow}${review}<div class="mushi-attachments">${shot}${element}</div>${reason}${notSent}<p class="mushi-note">\u{1F512} ${esc(p.privacy)}</p>${who ? `<p class="mushi-note">\u{1F464} ${esc(who)}</p>` : ""}${ctx.draftLength > DESCRIPTION_MAX_LENGTH - 400 ? `<p class="mushi-note" aria-live="polite">${ctx.draftLength}/${DESCRIPTION_MAX_LENGTH}</p>` : ""}${ctx.launcherDismissible ? `<p class="mushi-note">${btn("hide-launcher", esc(t.widget.hideLauncher ?? HIDE_LAUNCHER_FALLBACK), "mushi-link-btn")}</p>` : ""}`,
1878
2579
  footer: `<span class="mushi-footer-hint" id="mushi-hint" data-role="hint">${hint}</span><button type="button" class="mushi-submit" data-action="submit" aria-disabled="${!ctx.canSend || ctx.submitting}"${ctx.submitting ? ' aria-busy="true"' : ""}>${esc(ctx.submitting ? t.widget.submitting : p.send)}</button>`
1879
2580
  };
1880
2581
  }
@@ -2033,6 +2734,8 @@ var MushiWidget = class _MushiWidget {
2033
2734
  /** The reporter asked for (or marked up) the screenshot — an auto-capture on open doesn't count as saying something. */
2034
2735
  screenshotByUser = false;
2035
2736
  previewOpen = false;
2737
+ /** Send just captured the screenshot: it stays open for review until a second Send. */
2738
+ screenshotReview = false;
2036
2739
  allowScreenshotRemove = true;
2037
2740
  /** Unusable tools are hidden — a button whose handler no-ops reads as a bug. */
2038
2741
  screenshotAvailable = true;
@@ -2295,6 +2998,7 @@ var MushiWidget = class _MushiWidget {
2295
2998
  this.screenshotPreview = null;
2296
2999
  this.screenshotByUser = false;
2297
3000
  this.previewOpen = false;
3001
+ this.screenshotReview = false;
2298
3002
  this.elementSelected = false;
2299
3003
  this.elementCapturing = false;
2300
3004
  this.elementError = false;
@@ -2446,6 +3150,7 @@ var MushiWidget = class _MushiWidget {
2446
3150
  this.screenshotPreview = null;
2447
3151
  this.screenshotByUser = false;
2448
3152
  this.previewOpen = false;
3153
+ this.screenshotReview = false;
2449
3154
  }
2450
3155
  if (this.isOpen) this.render();
2451
3156
  }
@@ -3554,6 +4259,7 @@ var MushiWidget = class _MushiWidget {
3554
4259
  screenshotAttached: this.screenshotAttached,
3555
4260
  screenshotPreview: this.screenshotPreview,
3556
4261
  previewOpen: this.previewOpen,
4262
+ screenshotReview: this.screenshotReview,
3557
4263
  screenshotHint: this.resolveScreenshotHint(),
3558
4264
  screenshotAvailable: this.screenshotAvailable,
3559
4265
  elementAvailable: this.elementAvailable,
@@ -3886,7 +4592,7 @@ var MushiWidget = class _MushiWidget {
3886
4592
  this.render();
3887
4593
  }
3888
4594
  // ─── Report submit ─────────────────────────────────────────────────
3889
- submitReport() {
4595
+ async submitReport() {
3890
4596
  if (this.submitting) return;
3891
4597
  const live = this.panel.querySelector('[data-role="description"]');
3892
4598
  if (live) this.drafts.description = live.value;
@@ -3895,6 +4601,26 @@ var MushiWidget = class _MushiWidget {
3895
4601
  live?.focus();
3896
4602
  return;
3897
4603
  }
4604
+ if (this.callbacks.onBeforeSubmit) {
4605
+ this.submitting = true;
4606
+ this.render();
4607
+ let review = false;
4608
+ try {
4609
+ review = await this.callbacks.onBeforeSubmit();
4610
+ } catch {
4611
+ review = false;
4612
+ }
4613
+ this.submitting = false;
4614
+ if (!this.isOpen || this.step !== "report") return;
4615
+ if (review && this.screenshotAttached && this.screenshotPreview) {
4616
+ this.screenshotReview = true;
4617
+ this.previewOpen = true;
4618
+ this.render();
4619
+ this.announce(this.locale.step3.screenshotReview);
4620
+ return;
4621
+ }
4622
+ }
4623
+ this.screenshotReview = false;
3898
4624
  const description = (this.drafts.description ?? "").trim();
3899
4625
  const chip2 = this.chip;
3900
4626
  const custom = chip2 ? this.resolveCustomCategory(chip2) : void 0;
@@ -5302,36 +6028,51 @@ function createConsoleCapture() {
5302
6028
  const originals = {};
5303
6029
  const wrappers = {};
5304
6030
  const levels = ["log", "warn", "error", "info", "debug"];
6031
+ const str = (arg) => {
6032
+ if (arg instanceof Error) return `${arg.name}: ${arg.message}`;
6033
+ try {
6034
+ return typeof arg === "string" ? arg : JSON.stringify(arg);
6035
+ } catch {
6036
+ return String(arg);
6037
+ }
6038
+ };
6039
+ const record = (level, message, err, extra) => {
6040
+ const entry = { level, message: message.slice(0, MAX_MESSAGE_LENGTH), timestamp: Date.now(), ...extra };
6041
+ if (err instanceof Error && err.stack) entry.stack = err.stack.slice(0, 1e3);
6042
+ entries.push(entry);
6043
+ if (entries.length > MAX_ENTRIES2) entries.shift();
6044
+ };
5305
6045
  for (const level of levels) {
5306
6046
  const original = console[level];
5307
6047
  originals[level] = original;
5308
6048
  const wrapper = (...args) => {
5309
- const message = args.map((arg) => {
5310
- try {
5311
- return typeof arg === "string" ? arg : JSON.stringify(arg);
5312
- } catch {
5313
- return String(arg);
5314
- }
5315
- }).join(" ").slice(0, MAX_MESSAGE_LENGTH);
5316
6049
  const correlationId = getActiveCorrelationId();
5317
- const entry = {
6050
+ record(
5318
6051
  level,
5319
- message,
5320
- timestamp: Date.now(),
5321
- ...correlationId ? { correlationId } : {}
5322
- };
5323
- if (level === "error" && args[0] instanceof Error) {
5324
- entry.stack = args[0].stack?.slice(0, 1e3);
5325
- }
5326
- entries.push(entry);
5327
- if (entries.length > MAX_ENTRIES2) {
5328
- entries.shift();
5329
- }
6052
+ args.map(str).join(" "),
6053
+ level === "error" ? args.find((a) => a instanceof Error) : void 0,
6054
+ correlationId ? { correlationId } : void 0
6055
+ );
5330
6056
  original.call(console, ...args);
5331
6057
  };
5332
6058
  wrappers[level] = wrapper;
5333
6059
  console[level] = wrapper;
5334
6060
  }
6061
+ const onUncaught = (event) => {
6062
+ if (event.type === "unhandledrejection") {
6063
+ const reason = event.reason;
6064
+ record("error", `Unhandled rejection: ${str(reason)}`, reason);
6065
+ } else {
6066
+ const e = event;
6067
+ const where = e.filename ? ` (${e.filename}:${e.lineno}:${e.colno})` : "";
6068
+ record("error", `Uncaught ${str(e.error ?? (e.message || "error"))}${where}`, e.error);
6069
+ }
6070
+ };
6071
+ const canListen = typeof window !== "undefined" && typeof window.addEventListener === "function";
6072
+ if (canListen) {
6073
+ window.addEventListener("error", onUncaught);
6074
+ window.addEventListener("unhandledrejection", onUncaught);
6075
+ }
5335
6076
  return {
5336
6077
  getEntries() {
5337
6078
  return [...entries];
@@ -5345,261 +6086,16 @@ function createConsoleCapture() {
5345
6086
  console[level] = originals[level];
5346
6087
  }
5347
6088
  }
5348
- }
5349
- };
5350
- }
5351
-
5352
- // src/capture/screenshot.ts
5353
- function createScreenshotCapture(options = {}) {
5354
- let activeOptions = options;
5355
- async function take() {
5356
- try {
5357
- if (typeof document === "undefined") return null;
5358
- const canvas = document.createElement("canvas");
5359
- const ctx = canvas.getContext("2d", { willReadFrequently: true });
5360
- if (!ctx) {
5361
- activeOptions.onFailed?.("unsupported");
5362
- emitScreenshotFailed("unsupported");
5363
- return null;
6089
+ if (canListen) {
6090
+ window.removeEventListener("error", onUncaught);
6091
+ window.removeEventListener("unhandledrejection", onUncaught);
5364
6092
  }
5365
- const width = window.innerWidth;
5366
- const height = window.innerHeight;
5367
- const dpr = Math.min(window.devicePixelRatio || 1, 2);
5368
- canvas.width = width * dpr;
5369
- canvas.height = height * dpr;
5370
- ctx.scale(dpr, dpr);
5371
- const safeDocument = buildPrivacySafeDocument(activeOptions.privacy);
5372
- const svgData = `
5373
- <svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}">
5374
- <foreignObject width="100%" height="100%">
5375
- <div xmlns="http://www.w3.org/1999/xhtml">
5376
- ${new XMLSerializer().serializeToString(safeDocument)}
5377
- </div>
5378
- </foreignObject>
5379
- </svg>
5380
- `;
5381
- const img = new Image();
5382
- const url = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svgData)}`;
5383
- let cspBlocked = false;
5384
- const onViolation = (e) => {
5385
- const v = e;
5386
- if (/^img-src|^default-src/.test(v.violatedDirective ?? "") && /^data/.test(v.blockedURI ?? "")) cspBlocked = true;
5387
- };
5388
- document.addEventListener("securitypolicyviolation", onViolation);
5389
- return new Promise((resolve) => {
5390
- let settled = false;
5391
- const settle = (value, reason) => {
5392
- if (settled) return;
5393
- settled = true;
5394
- clearTimeout(timer);
5395
- document.removeEventListener("securitypolicyviolation", onViolation);
5396
- if (reason) {
5397
- activeOptions.onFailed?.(reason);
5398
- emitScreenshotFailed(reason);
5399
- }
5400
- resolve(value);
5401
- };
5402
- const timer = setTimeout(() => settle(null, "timeout"), 5e3);
5403
- img.onload = () => {
5404
- try {
5405
- ctx.drawImage(img, 0, 0, width, height);
5406
- if (isCanvasBlank(ctx, width, height)) {
5407
- settle(null, "unsupported");
5408
- return;
5409
- }
5410
- settle(canvas.toDataURL("image/jpeg", 0.7));
5411
- } catch {
5412
- settle(null, "taint");
5413
- }
5414
- };
5415
- img.onerror = () => setTimeout(() => settle(null, cspBlocked ? "csp" : "error"), 0);
5416
- img.src = url;
5417
- });
5418
- } catch {
5419
- activeOptions.onFailed?.("error");
5420
- emitScreenshotFailed("error");
5421
- return null;
5422
- }
5423
- }
5424
- return {
5425
- take,
5426
- updateOptions(nextOptions) {
5427
- activeOptions = nextOptions;
5428
6093
  }
5429
6094
  };
5430
6095
  }
5431
- function emitScreenshotFailed(reason) {
5432
- try {
5433
- document.dispatchEvent(new CustomEvent("mushi:screenshot_failed", { detail: { reason }, bubbles: false }));
5434
- } catch {
5435
- }
5436
- }
5437
- var ALWAYS_REDACT_SELECTORS = 'input[type="password"],input[autocomplete^="cc-"],[data-private],[data-mushi-mask]';
5438
- var DEFAULT_REDACT_SELECTORS = ["[data-mushi-redact]"];
5439
- function buildPrivacySafeDocument(privacy) {
5440
- const clone = document.documentElement.cloneNode(true);
5441
- clone.querySelector("#mushi-mushi-widget")?.remove();
5442
- stripTaintSources(clone);
5443
- inlineDocumentStyles(clone);
5444
- freezeMotion(clone);
5445
- fillViewport(clone);
5446
- const redactSelectors = [
5447
- ALWAYS_REDACT_SELECTORS,
5448
- ...privacy?.redactSelectors ?? DEFAULT_REDACT_SELECTORS
5449
- ];
5450
- for (const selector of redactSelectors) {
5451
- for (const el of safeQueryAll(clone, selector)) {
5452
- redactElement(el);
5453
- }
5454
- }
5455
- for (const selector of privacy?.blockSelectors ?? []) {
5456
- for (const el of safeQueryAll(clone, selector)) {
5457
- el.remove();
5458
- }
5459
- }
5460
- for (const selector of privacy?.maskSelectors ?? []) {
5461
- for (const el of safeQueryAll(clone, selector)) {
5462
- maskElement(el);
5463
- }
5464
- }
5465
- return clone;
5466
- }
5467
- function safeQueryAll(root, selector) {
5468
- try {
5469
- return Array.from(root.querySelectorAll(selector));
5470
- } catch {
5471
- return [];
5472
- }
5473
- }
5474
- function redactElement(el) {
5475
- if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) {
5476
- el.value = "";
5477
- el.setAttribute("value", "");
5478
- }
5479
- el.textContent = "";
5480
- el.setAttribute(
5481
- "style",
5482
- `${el.getAttribute("style") ?? ""};background:#000!important;color:#000!important;text-shadow:none!important;border-color:#000!important;`
5483
- );
5484
- el.setAttribute("data-mushi-redacted", "true");
5485
- while (el.firstChild) el.removeChild(el.firstChild);
5486
- }
5487
- function stripTaintSources(root) {
5488
- const pageOrigin = typeof location !== "undefined" ? location.origin : "";
5489
- for (const el of root.querySelectorAll("img, video, iframe, object, embed, picture")) {
5490
- el.remove();
5491
- }
5492
- for (const link of root.querySelectorAll('link[rel="stylesheet"], link[as="style"]')) {
5493
- link.remove();
5494
- }
5495
- for (const styleEl of root.querySelectorAll("style")) {
5496
- const cleaned = stripCssUrlRefs(styleEl.textContent ?? "", pageOrigin);
5497
- if (cleaned !== styleEl.textContent) styleEl.textContent = cleaned;
5498
- }
5499
- for (const el of root.querySelectorAll("[style]")) {
5500
- const s = el.getAttribute("style");
5501
- if (!s) continue;
5502
- const cleaned = stripCssUrlRefs(s, pageOrigin);
5503
- if (cleaned !== s) el.setAttribute("style", cleaned);
5504
- }
5505
- for (const script of root.querySelectorAll("script")) {
5506
- script.remove();
5507
- }
5508
- }
5509
- function stripCssUrlRefs(css, pageOrigin) {
5510
- return css.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/gi, (_match, _q, href) => {
5511
- const trimmed = href.trim();
5512
- if (!trimmed || trimmed.startsWith("data:") || trimmed.startsWith("#")) return _match;
5513
- if (isCrossOriginUrl(trimmed, pageOrigin)) return "none";
5514
- return _match;
5515
- });
5516
- }
5517
- function inlineDocumentStyles(clone) {
5518
- const pageOrigin = typeof location !== "undefined" ? location.origin : "";
5519
- const chunks = [];
5520
- const sheets = [
5521
- ...Array.from(document.styleSheets),
5522
- ...document.adoptedStyleSheets ?? []
5523
- ];
5524
- for (const sheet of sheets) {
5525
- const owner = sheet.ownerNode;
5526
- if (owner instanceof Element && owner.tagName === "STYLE") continue;
5527
- chunks.push(serializeSheet(sheet));
5528
- }
5529
- const css = stripCssUrlRefs(chunks.filter(Boolean).join("\n"), pageOrigin);
5530
- if (!css) return;
5531
- const styleEl = document.createElement("style");
5532
- styleEl.textContent = css;
5533
- (clone.querySelector("head") ?? clone).appendChild(styleEl);
5534
- }
5535
- var FREEZE_MOTION_CSS = "*,*::before,*::after{animation:none!important;transition:none!important}";
5536
- function fillViewport(clone) {
5537
- const clear = (c) => !c || c === "transparent" || /^rgba\(.*,\s*0\)$/.test(c);
5538
- let bg = getComputedStyle(document.documentElement).backgroundColor;
5539
- if (clear(bg) && document.body) bg = getComputedStyle(document.body).backgroundColor;
5540
- const root = clone;
5541
- root.style.setProperty("background-color", clear(bg) ? "Canvas" : bg);
5542
- root.style.setProperty("min-height", `${window.innerHeight}px`);
5543
- }
5544
- function freezeMotion(clone) {
5545
- const styleEl = document.createElement("style");
5546
- styleEl.textContent = FREEZE_MOTION_CSS;
5547
- (clone.querySelector("head") ?? clone).appendChild(styleEl);
5548
- }
5549
- function serializeSheet(sheet) {
5550
- let rules;
5551
- try {
5552
- rules = sheet.cssRules;
5553
- } catch {
5554
- return "";
5555
- }
5556
- let text = "";
5557
- for (const rule of Array.from(rules)) {
5558
- if (rule instanceof CSSImportRule) {
5559
- if (rule.styleSheet) text += serializeSheet(rule.styleSheet);
5560
- continue;
5561
- }
5562
- text += `${rule.cssText}
5563
- `;
5564
- }
5565
- return text;
5566
- }
5567
- function isCanvasBlank(ctx, width, height) {
5568
- try {
5569
- const stepX = Math.max(1, Math.floor(width / 8));
5570
- const stepY = Math.max(1, Math.floor(height / 8));
5571
- for (let y = 0; y < height; y += stepY) {
5572
- for (let x = 0; x < width; x += stepX) {
5573
- if (ctx.getImageData(x, y, 1, 1).data[3] !== 0) return false;
5574
- }
5575
- }
5576
- return true;
5577
- } catch {
5578
- return false;
5579
- }
5580
- }
5581
- function isCrossOriginUrl(raw, pageOrigin) {
5582
- if (!raw || raw.startsWith("data:") || raw.startsWith("blob:")) return false;
5583
- try {
5584
- const resolved = new URL(raw, typeof location !== "undefined" ? location.href : "http://localhost/");
5585
- return Boolean(pageOrigin) && resolved.origin !== pageOrigin;
5586
- } catch {
5587
- return true;
5588
- }
5589
- }
5590
- function maskElement(el) {
5591
- if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) {
5592
- el.value = "";
5593
- el.setAttribute("value", "");
5594
- el.setAttribute("placeholder", "\u2022\u2022\u2022\u2022");
5595
- }
5596
- el.textContent = el.children.length === 0 ? "\u2022\u2022\u2022\u2022" : el.textContent;
5597
- el.setAttribute(
5598
- "style",
5599
- `${el.getAttribute("style") ?? ""};background:#8f8f8f!important;color:transparent!important;text-shadow:none!important;`
5600
- );
5601
- el.setAttribute("data-mushi-masked", "true");
5602
- }
6096
+
6097
+ // src/capture/index.ts
6098
+ init_screenshot();
5603
6099
 
5604
6100
  // src/capture/performance.ts
5605
6101
  var INP_DURATION_THRESHOLD_MS = 40;
@@ -5731,7 +6227,7 @@ function createPerformanceCapture() {
5731
6227
  }
5732
6228
  };
5733
6229
  }
5734
- function createElementSelector() {
6230
+ function createElementSelector(privateSelector = () => "", scrubText = (text) => text) {
5735
6231
  let active = false;
5736
6232
  let overlay = null;
5737
6233
  let captureLayer = null;
@@ -5764,6 +6260,18 @@ function createElementSelector() {
5764
6260
  }
5765
6261
  return "//" + parts.join("/");
5766
6262
  }
6263
+ function elementText(el) {
6264
+ const selector = privateSelector();
6265
+ if (selector) {
6266
+ try {
6267
+ if (el.closest(selector) || el.querySelector(selector)) return void 0;
6268
+ } catch {
6269
+ return void 0;
6270
+ }
6271
+ }
6272
+ const text = el.textContent?.trim().slice(0, 200);
6273
+ return text ? scrubText(text) : void 0;
6274
+ }
5767
6275
  function captureElement(el) {
5768
6276
  const rect = el.getBoundingClientRect();
5769
6277
  const className = typeof el.className === "string" ? el.className : el.getAttribute("class") ?? "";
@@ -5771,7 +6279,7 @@ function createElementSelector() {
5771
6279
  tagName: el.tagName.toLowerCase(),
5772
6280
  id: el.id || void 0,
5773
6281
  className: className || void 0,
5774
- textContent: el.textContent?.trim().slice(0, 200) || void 0,
6282
+ textContent: elementText(el),
5775
6283
  xpath: getXPath(el),
5776
6284
  rect: {
5777
6285
  x: Math.round(rect.x),
@@ -6340,6 +6848,9 @@ async function createReplayCapture(opts) {
6340
6848
  };
6341
6849
  }
6342
6850
 
6851
+ // src/mushi.ts
6852
+ init_screenshot();
6853
+
6343
6854
  // src/sentry.ts
6344
6855
  function getSentryGlobal() {
6345
6856
  try {
@@ -6835,7 +7346,7 @@ function createProactiveManager(config = {}) {
6835
7346
 
6836
7347
  // src/version.ts
6837
7348
  var MUSHI_SDK_PACKAGE = "@mushi-mushi/web";
6838
- var MUSHI_SDK_VERSION = "1.37.0" ;
7349
+ var MUSHI_SDK_VERSION = "1.38.0" ;
6839
7350
  function resolveReportAppVersion(config, environment) {
6840
7351
  if (config.appVersion) return config.appVersion;
6841
7352
  const vercelId = config.integrations?.vercel?.analyticsId;
@@ -7088,7 +7599,18 @@ function createInstance(config) {
7088
7599
  if (!screenshotCap && !activeConfig.capture?.screenshotProvider) pendingScreenshot = null;
7089
7600
  widget.setAllowScreenshotRemove(activeConfig.privacy?.allowUserRemoveScreenshot !== false);
7090
7601
  if (activeConfig.capture?.elementSelector !== false) {
7091
- elementSelector ??= createElementSelector();
7602
+ elementSelector ??= createElementSelector(
7603
+ () => {
7604
+ const p = activeConfig.privacy;
7605
+ return [
7606
+ ALWAYS_REDACT_SELECTORS,
7607
+ ...p?.redactSelectors ?? ["[data-mushi-redact]"],
7608
+ ...p?.maskSelectors ?? [],
7609
+ ...p?.blockSelectors ?? []
7610
+ ].join(",");
7611
+ },
7612
+ (text) => piiScrubber.scrub(text)
7613
+ );
7092
7614
  } else {
7093
7615
  elementSelector?.deactivate();
7094
7616
  elementSelector = null;
@@ -7163,6 +7685,7 @@ function createInstance(config) {
7163
7685
  listeners.get(type)?.forEach((handler) => handler({ type, data }));
7164
7686
  }
7165
7687
  let pendingScreenshot = null;
7688
+ let screenshotDeclined = false;
7166
7689
  let pendingElement = null;
7167
7690
  let pendingProactiveTrigger = null;
7168
7691
  let runtimeConfigLoaded = false;
@@ -7329,28 +7852,58 @@ function createInstance(config) {
7329
7852
  if (panelWasVisible) widget.showPanel();
7330
7853
  }
7331
7854
  }
7332
- async function autoCaptureScreenshot(when) {
7855
+ function automaticScreenshotWanted() {
7333
7856
  const mode = activeConfig.capture?.screenshot;
7334
7857
  const hasCapture = !!screenshotCap || !!activeConfig.capture?.screenshotProvider;
7335
- if (!hasCapture || mode === "off" || pendingScreenshot) return;
7336
- if (when === "open" && mode !== "auto") return;
7337
- if (when === "submit" && mode !== "on-report" && mode !== "auto") return;
7338
- log.debug("Auto-capturing screenshot", { when, mode });
7339
- pendingScreenshot = await takeScreenshotWithoutChrome();
7340
- widget.setScreenshotAttached(pendingScreenshot !== null);
7341
- widget.setScreenshotPreview(pendingScreenshot);
7858
+ return hasCapture && (mode === "auto" || mode === "on-report") && !pendingScreenshot && !screenshotDeclined;
7859
+ }
7860
+ let openCaptureRun = null;
7861
+ let panelSession = 0;
7862
+ function captureOnOpen() {
7863
+ if (activeConfig.capture?.screenshot !== "auto" || !automaticScreenshotWanted()) return;
7864
+ log.debug("Auto-capturing screenshot on open");
7865
+ const session = panelSession;
7866
+ const run = (async () => {
7867
+ const shot = await takeScreenshotWithoutChrome().catch(() => null);
7868
+ if (session !== panelSession || pendingScreenshot || screenshotDeclined || !shot) return;
7869
+ pendingScreenshot = shot;
7870
+ widget.setScreenshotAttached(true);
7871
+ widget.setScreenshotPreview(shot);
7872
+ })();
7873
+ openCaptureRun = run;
7874
+ void run.finally(() => {
7875
+ if (openCaptureRun === run) openCaptureRun = null;
7876
+ });
7877
+ }
7878
+ async function screenshotBeforeSubmit() {
7879
+ if (openCaptureRun) {
7880
+ await openCaptureRun;
7881
+ if (pendingScreenshot) return true;
7882
+ }
7883
+ if (!automaticScreenshotWanted()) return false;
7884
+ log.debug("Capturing screenshot for review before send", { mode: activeConfig.capture?.screenshot });
7885
+ const shot = await takeScreenshotWithoutChrome().catch(() => null);
7886
+ if (!shot) return false;
7887
+ pendingScreenshot = shot;
7888
+ widget.setScreenshotAttached(true);
7889
+ widget.setScreenshotPreview(shot);
7890
+ return true;
7342
7891
  }
7343
7892
  const brandRefReady = core.sha256Hex(projectId).then((hex) => hex.slice(0, 12)).catch(() => null);
7344
7893
  widget = new MushiWidget(bootstrapConfig.widget, {
7345
7894
  onSubmit: async ({ category, userCategory, description, intent }) => {
7346
7895
  log.info("Report submitted", { category, userCategory, intent });
7347
7896
  if (pendingProactiveTrigger) proactiveManager?.recordSubmission();
7348
- await autoCaptureScreenshot("submit");
7349
- return submitReport(category, description, intent, userCategory);
7897
+ const outcome = await submitReport(category, description, intent, userCategory);
7898
+ if (!isNotSentOutcome(outcome)) screenshotDeclined = false;
7899
+ return outcome;
7350
7900
  },
7901
+ onBeforeSubmit: () => screenshotBeforeSubmit(),
7351
7902
  onOpen: () => {
7352
7903
  log.debug("Widget opened");
7353
- void autoCaptureScreenshot("open");
7904
+ panelSession++;
7905
+ screenshotDeclined = false;
7906
+ captureOnOpen();
7354
7907
  replayCap?.start();
7355
7908
  emit("widget:opened");
7356
7909
  },
@@ -7372,7 +7925,9 @@ function createInstance(config) {
7372
7925
  proactiveManager?.recordDismissal();
7373
7926
  emit("proactive:dismissed", { type: pendingProactiveTrigger });
7374
7927
  }
7928
+ panelSession++;
7375
7929
  pendingScreenshot = null;
7930
+ screenshotDeclined = false;
7376
7931
  pendingElement = null;
7377
7932
  pendingProactiveTrigger = null;
7378
7933
  emit("widget:closed");
@@ -7439,6 +7994,7 @@ function createInstance(config) {
7439
7994
  onScreenshotRemove: () => {
7440
7995
  log.debug("Screenshot attachment removed");
7441
7996
  pendingScreenshot = null;
7997
+ screenshotDeclined = true;
7442
7998
  widget.setScreenshotAttached(false);
7443
7999
  },
7444
8000
  onScreenshotAnnotateRequest: async (container) => {