@mushi-mushi/web 1.25.0 → 1.26.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
@@ -118,6 +118,8 @@ var en = {
118
118
  sendAriaLabel: "Send",
119
119
  hubDescription: "Get help using this app",
120
120
  thinking: "Thinking\u2026",
121
+ fileReportCta: "File a report instead",
122
+ stillStuckCta: "Still stuck? File a report",
121
123
  errors: {
122
124
  noResponse: "No response \u2014 check your connection and try again.",
123
125
  generic: "Could not reach the assistant. Try again in a moment."
@@ -196,6 +198,14 @@ var en = {
196
198
  delivering: "Delivering to the team\u2026",
197
199
  queuedOffline: "Queued offline",
198
200
  queuedHint: "We'll send it the moment you're back online.",
201
+ rateLimited: "Sending too fast",
202
+ rateLimitedHint: "Wait about a minute \u2014 we queued this report and will retry automatically.",
203
+ quotaBlocked: "Could not accept this report",
204
+ quotaBlockedHint: "This project's quota or plan blocked the send. Ask the app owner to check Billing.",
205
+ permanentFailed: "Could not send this report",
206
+ permanentFailedHint: "The payload was rejected (often too large). Try again with a shorter note or without a screenshot.",
207
+ retrying: "Queued \u2014 retrying",
208
+ retryingHint: "We could not reach the server just now. We'll keep trying in the background.",
199
209
  trackOnMushi: "Track on Mushi",
200
210
  slaDefault: "We will review your report.",
201
211
  screenshotDropped: "Sent without the screenshot \u2014 it was too large to attach."
@@ -288,6 +298,8 @@ var ja = {
288
298
  sendAriaLabel: "\u9001\u4FE1",
289
299
  hubDescription: "\u3053\u306E\u30A2\u30D7\u30EA\u306E\u4F7F\u3044\u65B9\u3092\u805E\u304F",
290
300
  thinking: "\u8003\u3048\u4E2D\u2026",
301
+ fileReportCta: "\u4EE3\u308F\u308A\u306B\u30D0\u30B0\u3092\u5831\u544A",
302
+ stillStuckCta: "\u89E3\u6C7A\u3057\u306A\u3044\u5834\u5408\u306F\u5831\u544A\u3059\u308B",
291
303
  errors: {
292
304
  noResponse: "\u5FDC\u7B54\u304C\u3042\u308A\u307E\u305B\u3093 \u2014 \u63A5\u7D9A\u3092\u78BA\u8A8D\u3057\u3066\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
293
305
  generic: "\u30A2\u30B7\u30B9\u30BF\u30F3\u30C8\u306B\u63A5\u7D9A\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3057\u3070\u3089\u304F\u3057\u3066\u304B\u3089\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002"
@@ -366,6 +378,14 @@ var ja = {
366
378
  delivering: "\u30C1\u30FC\u30E0\u306B\u9001\u4FE1\u4E2D\u2026",
367
379
  queuedOffline: "\u30AA\u30D5\u30E9\u30A4\u30F3\u5F85\u6A5F\u4E2D",
368
380
  queuedHint: "\u30AA\u30F3\u30E9\u30A4\u30F3\u306B\u623B\u308A\u6B21\u7B2C\u9001\u4FE1\u3057\u307E\u3059\u3002",
381
+ rateLimited: "\u9001\u4FE1\u304C\u65E9\u3059\u304E\u307E\u3059",
382
+ rateLimitedHint: "\u7D041\u5206\u5F85\u3063\u3066\u304F\u3060\u3055\u3044\u3002\u30EC\u30DD\u30FC\u30C8\u306F\u30AD\u30E5\u30FC\u306B\u5165\u308A\u3001\u81EA\u52D5\u3067\u518D\u9001\u3057\u307E\u3059\u3002",
383
+ quotaBlocked: "\u3053\u306E\u30EC\u30DD\u30FC\u30C8\u306F\u53D7\u3051\u4ED8\u3051\u3089\u308C\u307E\u305B\u3093\u3067\u3057\u305F",
384
+ quotaBlockedHint: "\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u67A0\u307E\u305F\u306F\u30D7\u30E9\u30F3\u3067\u62D2\u5426\u3055\u308C\u307E\u3057\u305F\u3002\u30A2\u30D7\u30EA\u7BA1\u7406\u8005\u306B Billing \u3092\u78BA\u8A8D\u3057\u3066\u3082\u3089\u3063\u3066\u304F\u3060\u3055\u3044\u3002",
385
+ permanentFailed: "\u30EC\u30DD\u30FC\u30C8\u3092\u9001\u308C\u307E\u305B\u3093\u3067\u3057\u305F",
386
+ permanentFailedHint: "\u30DA\u30A4\u30ED\u30FC\u30C9\u304C\u62D2\u5426\u3055\u308C\u307E\u3057\u305F\uFF08\u30B5\u30A4\u30BA\u8D85\u904E\u306A\u3069\uFF09\u3002\u77ED\u3044\u6587\u9762\u304B\u30B9\u30AF\u30EA\u30FC\u30F3\u30B7\u30E7\u30C3\u30C8\u306A\u3057\u3067\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
387
+ retrying: "\u30AD\u30E5\u30FC \u2014 \u518D\u8A66\u884C\u4E2D",
388
+ retryingHint: "\u3044\u307E\u30B5\u30FC\u30D0\u30FC\u306B\u5C4A\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u30D0\u30C3\u30AF\u30B0\u30E9\u30A6\u30F3\u30C9\u3067\u518D\u9001\u3057\u307E\u3059\u3002",
369
389
  trackOnMushi: "Mushi\u3067\u8FFD\u8DE1",
370
390
  slaDefault: "\u30EC\u30DD\u30FC\u30C8\u3092\u78BA\u8A8D\u3057\u307E\u3059\u3002",
371
391
  screenshotDropped: "\u30B9\u30AF\u30EA\u30FC\u30F3\u30B7\u30E7\u30C3\u30C8\u306F\u30B5\u30A4\u30BA\u8D85\u904E\u306E\u305F\u3081\u6DFB\u4ED8\u3067\u304D\u305A\u3001\u30EC\u30DD\u30FC\u30C8\u306E\u307F\u9001\u4FE1\u3057\u307E\u3057\u305F\u3002"
@@ -458,6 +478,8 @@ var th = {
458
478
  sendAriaLabel: "\u0E2A\u0E48\u0E07",
459
479
  hubDescription: "\u0E02\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E0A\u0E48\u0E27\u0E22\u0E40\u0E2B\u0E25\u0E37\u0E2D\u0E43\u0E19\u0E01\u0E32\u0E23\u0E43\u0E0A\u0E49\u0E41\u0E2D\u0E1B",
460
480
  thinking: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E04\u0E34\u0E14\u2026",
481
+ fileReportCta: "\u0E2A\u0E48\u0E07\u0E23\u0E32\u0E22\u0E07\u0E32\u0E19\u0E41\u0E17\u0E19",
482
+ stillStuckCta: "\u0E22\u0E31\u0E07\u0E41\u0E01\u0E49\u0E44\u0E21\u0E48\u0E44\u0E14\u0E49? \u0E2A\u0E48\u0E07\u0E23\u0E32\u0E22\u0E07\u0E32\u0E19",
461
483
  errors: {
462
484
  noResponse: "\u0E44\u0E21\u0E48\u0E21\u0E35\u0E01\u0E32\u0E23\u0E15\u0E2D\u0E1A\u0E01\u0E25\u0E31\u0E1A \u2014 \u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E01\u0E32\u0E23\u0E40\u0E0A\u0E37\u0E48\u0E2D\u0E21\u0E15\u0E48\u0E2D\u0E41\u0E25\u0E49\u0E27\u0E25\u0E2D\u0E07\u0E2D\u0E35\u0E01\u0E04\u0E23\u0E31\u0E49\u0E07",
463
485
  generic: "\u0E40\u0E0A\u0E37\u0E48\u0E2D\u0E21\u0E15\u0E48\u0E2D\u0E1C\u0E39\u0E49\u0E0A\u0E48\u0E27\u0E22\u0E44\u0E21\u0E48\u0E44\u0E14\u0E49 \u0E25\u0E2D\u0E07\u0E2D\u0E35\u0E01\u0E04\u0E23\u0E31\u0E49\u0E07\u0E43\u0E19\u0E2D\u0E35\u0E01\u0E2A\u0E31\u0E01\u0E04\u0E23\u0E39\u0E48"
@@ -536,6 +558,14 @@ var th = {
536
558
  delivering: "\u0E01\u0E33\u0E25\u0E31\u0E07\u0E2A\u0E48\u0E07\u0E44\u0E1B\u0E22\u0E31\u0E07\u0E17\u0E35\u0E21\u2026",
537
559
  queuedOffline: "\u0E04\u0E34\u0E27\u0E2D\u0E2D\u0E1F\u0E44\u0E25\u0E19\u0E4C",
538
560
  queuedHint: "\u0E08\u0E30\u0E2A\u0E48\u0E07\u0E17\u0E31\u0E19\u0E17\u0E35\u0E17\u0E35\u0E48\u0E04\u0E38\u0E13\u0E01\u0E25\u0E31\u0E1A\u0E21\u0E32\u0E2D\u0E2D\u0E19\u0E44\u0E25\u0E19\u0E4C",
561
+ rateLimited: "\u0E2A\u0E48\u0E07\u0E16\u0E35\u0E48\u0E40\u0E01\u0E34\u0E19\u0E44\u0E1B",
562
+ rateLimitedHint: "\u0E23\u0E2D\u0E1B\u0E23\u0E30\u0E21\u0E32\u0E13\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E19\u0E32\u0E17\u0E35 \u2014 \u0E40\u0E23\u0E32\u0E08\u0E31\u0E14\u0E04\u0E34\u0E27\u0E23\u0E32\u0E22\u0E07\u0E32\u0E19\u0E19\u0E35\u0E49\u0E44\u0E27\u0E49\u0E41\u0E25\u0E30\u0E08\u0E30\u0E25\u0E2D\u0E07\u0E43\u0E2B\u0E21\u0E48\u0E43\u0E2B\u0E49\u0E2D\u0E31\u0E15\u0E42\u0E19\u0E21\u0E31\u0E15\u0E34",
563
+ quotaBlocked: "\u0E44\u0E21\u0E48\u0E2A\u0E32\u0E21\u0E32\u0E23\u0E16\u0E23\u0E31\u0E1A\u0E23\u0E32\u0E22\u0E07\u0E32\u0E19\u0E19\u0E35\u0E49\u0E44\u0E14\u0E49",
564
+ quotaBlockedHint: "\u0E42\u0E04\u0E27\u0E15\u0E49\u0E32\u0E2B\u0E23\u0E37\u0E2D\u0E41\u0E1E\u0E25\u0E19\u0E02\u0E2D\u0E07\u0E42\u0E1B\u0E23\u0E40\u0E08\u0E01\u0E15\u0E4C\u0E1A\u0E25\u0E47\u0E2D\u0E01\u0E01\u0E32\u0E23\u0E2A\u0E48\u0E07 \u0E02\u0E2D\u0E43\u0E2B\u0E49\u0E40\u0E08\u0E49\u0E32\u0E02\u0E2D\u0E07\u0E41\u0E2D\u0E1B\u0E15\u0E23\u0E27\u0E08 Billing",
565
+ permanentFailed: "\u0E2A\u0E48\u0E07\u0E23\u0E32\u0E22\u0E07\u0E32\u0E19\u0E19\u0E35\u0E49\u0E44\u0E21\u0E48\u0E44\u0E14\u0E49",
566
+ permanentFailedHint: "\u0E40\u0E1E\u0E22\u0E4C\u0E42\u0E2B\u0E25\u0E14\u0E16\u0E39\u0E01\u0E1B\u0E0F\u0E34\u0E40\u0E2A\u0E18 (\u0E21\u0E31\u0E01\u0E40\u0E1E\u0E23\u0E32\u0E30\u0E43\u0E2B\u0E0D\u0E48\u0E40\u0E01\u0E34\u0E19\u0E44\u0E1B) \u0E25\u0E2D\u0E07\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E2A\u0E31\u0E49\u0E19\u0E25\u0E07\u0E2B\u0E23\u0E37\u0E2D\u0E44\u0E21\u0E48\u0E41\u0E19\u0E1A\u0E20\u0E32\u0E1E\u0E2B\u0E19\u0E49\u0E32\u0E08\u0E2D",
567
+ retrying: "\u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E04\u0E34\u0E27 \u2014 \u0E01\u0E33\u0E25\u0E31\u0E07\u0E25\u0E2D\u0E07\u0E43\u0E2B\u0E21\u0E48",
568
+ retryingHint: "\u0E15\u0E2D\u0E19\u0E19\u0E35\u0E49\u0E15\u0E34\u0E14\u0E15\u0E48\u0E2D\u0E40\u0E0B\u0E34\u0E23\u0E4C\u0E1F\u0E40\u0E27\u0E2D\u0E23\u0E4C\u0E44\u0E21\u0E48\u0E44\u0E14\u0E49 \u0E40\u0E23\u0E32\u0E08\u0E30\u0E25\u0E2D\u0E07\u0E43\u0E2B\u0E21\u0E48\u0E43\u0E19\u0E1E\u0E37\u0E49\u0E19\u0E2B\u0E25\u0E31\u0E07",
539
569
  trackOnMushi: "\u0E15\u0E34\u0E14\u0E15\u0E32\u0E21\u0E1A\u0E19 Mushi",
540
570
  slaDefault: "\u0E40\u0E23\u0E32\u0E08\u0E30\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E23\u0E32\u0E22\u0E07\u0E32\u0E19\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13",
541
571
  screenshotDropped: "\u0E2A\u0E48\u0E07\u0E23\u0E32\u0E22\u0E07\u0E32\u0E19\u0E42\u0E14\u0E22\u0E44\u0E21\u0E48\u0E21\u0E35\u0E20\u0E32\u0E1E\u0E2B\u0E19\u0E49\u0E32\u0E08\u0E2D \u2014 \u0E44\u0E1F\u0E25\u0E4C\u0E43\u0E2B\u0E0D\u0E48\u0E40\u0E01\u0E34\u0E19\u0E01\u0E27\u0E48\u0E32\u0E08\u0E30\u0E41\u0E19\u0E1A\u0E44\u0E14\u0E49"
@@ -628,6 +658,8 @@ var es = {
628
658
  sendAriaLabel: "Enviar",
629
659
  hubDescription: "Obt\xE9n ayuda para usar esta app",
630
660
  thinking: "Pensando\u2026",
661
+ fileReportCta: "Enviar un informe en su lugar",
662
+ stillStuckCta: "\xBFSigues atascado? Env\xEDa un informe",
631
663
  errors: {
632
664
  noResponse: "Sin respuesta \u2014 revisa tu conexi\xF3n e int\xE9ntalo de nuevo.",
633
665
  generic: "No se pudo contactar al asistente. Int\xE9ntalo en un momento."
@@ -706,6 +738,14 @@ var es = {
706
738
  delivering: "Enviando al equipo\u2026",
707
739
  queuedOffline: "En cola sin conexi\xF3n",
708
740
  queuedHint: "Lo enviaremos en cuanto vuelvas a estar en l\xEDnea.",
741
+ rateLimited: "Demasiado r\xE1pido",
742
+ rateLimitedHint: "Espera un minuto \u2014 encolamos el reporte y lo reintentaremos autom\xE1ticamente.",
743
+ quotaBlocked: "No se pudo aceptar este reporte",
744
+ quotaBlockedHint: "La cuota o el plan del proyecto bloque\xF3 el env\xEDo. Pide al due\xF1o que revise Billing.",
745
+ permanentFailed: "No se pudo enviar este reporte",
746
+ permanentFailedHint: "El payload fue rechazado (a menudo por tama\xF1o). Intenta con un texto m\xE1s corto o sin captura.",
747
+ retrying: "En cola \u2014 reintentando",
748
+ retryingHint: "No pudimos llegar al servidor ahora. Seguiremos intentando en segundo plano.",
709
749
  trackOnMushi: "Seguir en Mushi",
710
750
  slaDefault: "Revisaremos tu reporte.",
711
751
  screenshotDropped: "Enviado sin la captura de pantalla \u2014 era demasiado grande para adjuntarla."
@@ -729,6 +769,14 @@ function getLocale(code) {
729
769
  function getAvailableLocales() {
730
770
  return Object.keys(locales);
731
771
  }
772
+ function hexToRgbTriplet(hex) {
773
+ const h = hex.replace("#", "");
774
+ const full = h.length === 3 ? h[0] + h[0] + h[1] + h[1] + h[2] + h[2] : h.slice(0, 6);
775
+ const r = parseInt(full.slice(0, 2), 16);
776
+ const g = parseInt(full.slice(2, 4), 16);
777
+ const b = parseInt(full.slice(4, 6), 16);
778
+ return `${r},${g},${b}`;
779
+ }
732
780
  function getWidgetThemeVars(theme, accent = "", accentText = "") {
733
781
  const isDark = theme === "dark";
734
782
  const mode = isDark ? "dark" : "light";
@@ -749,6 +797,8 @@ function getWidgetThemeVars(theme, accent = "", accentText = "") {
749
797
  widgetAccentWash: accentResolved.accentWash,
750
798
  widgetAccentInk: accentResolved.accentInk,
751
799
  widgetAccentShadow: isDark ? core.MUSHI_ACCENT_SHADOW.dark : core.MUSHI_ACCENT_SHADOW.light,
800
+ accentRgb: hexToRgbTriplet(accentResolved.accent),
801
+ shadowInk: isDark ? "0,0,0" : "14,13,11",
752
802
  ok: pal.ok,
753
803
  danger: pal.danger,
754
804
  onAccent: core.MUSHI_ON_ACCENT,
@@ -808,6 +858,8 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
808
858
  widgetAccentWash,
809
859
  widgetAccentInk,
810
860
  widgetAccentShadow,
861
+ accentRgb,
862
+ shadowInk,
811
863
  ok,
812
864
  danger,
813
865
  onAccent,
@@ -828,12 +880,31 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
828
880
  zBanner,
829
881
  fabSize
830
882
  } = v;
831
- const { sizeBody, lineBody } = core.MUSHI_TYPE;
883
+ const { sizeBody, sizeLabel, lineBody } = core.MUSHI_TYPE;
832
884
  const { durationFast } = core.MUSHI_MOTION;
885
+ const {
886
+ instant: durInstant,
887
+ fast: durFast,
888
+ base: durBase,
889
+ panel: durPanel,
890
+ slow: durSlow,
891
+ ring: durRing
892
+ } = core.MUSHI_DURATION;
833
893
  const { bannerHeight, gutter, panelWidth, panelMaxHeight, panelSheetBreakpoint, edgeTabWidth } = core.MUSHI_GEOMETRY;
834
- const panelLauncherGap = fabSize + 12;
894
+ const panelLauncherGap = fabSize + core.MUSHI_SPACING.comfy;
835
895
  const { base: zBase } = core.MUSHI_Z;
836
896
  const controlRadius = core.MUSHI_RADIUS.control;
897
+ const cardRadius = core.MUSHI_RADIUS.card;
898
+ const {
899
+ tight: spaceTight,
900
+ snug: spaceSnug,
901
+ comfy: spaceComfy,
902
+ roomy: spaceRoomy,
903
+ lounge: spaceLounge,
904
+ open: spaceOpen,
905
+ wide: spaceWide
906
+ } = core.MUSHI_SPACING;
907
+ const touchMin = 44;
837
908
  return `
838
909
  :host {
839
910
  all: initial;
@@ -845,6 +916,23 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
845
916
  -moz-osx-font-smoothing: grayscale;
846
917
  font-feature-settings: 'ss01', 'cv11'; /* nicer system-ui glyphs where supported */
847
918
  --mushi-ok: ${ok};
919
+ /* Spacing + radius scales (MUSHI_SPACING / MUSHI_RADIUS) \u2014 prefer these
920
+ over literal px so web + RN stay aligned with brand.tokens.json. */
921
+ --mushi-space-tight: ${spaceTight}px;
922
+ --mushi-space-snug: ${spaceSnug}px;
923
+ --mushi-space-comfy: ${spaceComfy}px;
924
+ --mushi-space-roomy: ${spaceRoomy}px;
925
+ --mushi-space-lounge: ${spaceLounge}px;
926
+ --mushi-space-open: ${spaceOpen}px;
927
+ --mushi-space-wide: ${spaceWide}px;
928
+ --mushi-radius-control: ${controlRadius}px;
929
+ --mushi-radius-card: ${cardRadius}px;
930
+ --mushi-touch-min: ${touchMin}px;
931
+ /* Derived channel vars \u2014 accent RGB triplet + shadow-ink triplet.
932
+ Lets Shadow-DOM CSS compose rgba() values that respect host-accent
933
+ overrides and dark-mode ink without repeating the hex guard. */
934
+ --mushi-accent-rgb: ${accentRgb};
935
+ --mushi-shadow-ink: ${shadowInk};
848
936
  /* SDK contract: the host element is always pass-through. Only the
849
937
  interactive surfaces (.mushi-trigger, .mushi-banner, .mushi-panel)
850
938
  opt back into pointer events so the widget never creates an
@@ -864,6 +952,8 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
864
952
  position: fixed;
865
953
  width: ${fabSize}px;
866
954
  height: ${fabSize}px;
955
+ min-width: var(--mushi-touch-min);
956
+ min-height: var(--mushi-touch-min);
867
957
  border: 1px solid ${ruleStrong};
868
958
  border-radius: ${controlRadius}px;
869
959
  background: ${paper};
@@ -877,9 +967,9 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
877
967
  line-height: 1;
878
968
  box-shadow:
879
969
  0 1px 0 ${rule},
880
- 0 6px 14px -8px rgba(14,13,11,0.35),
970
+ 0 6px 14px -8px rgba(${shadowInk},0.35),
881
971
  inset 0 -3px 0 ${widgetAccent};
882
- transition: transform ${durationFast}ms ${easeStamp}, box-shadow ${durationFast}ms ${easeStamp};
972
+ transition: transform ${durationFast}ms ${easeStamp}, opacity ${durationFast}ms ${easeStamp};
883
973
  overflow: visible;
884
974
  isolation: isolate;
885
975
  }
@@ -899,14 +989,15 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
899
989
  transform: translateY(-2px) rotate(-1.5deg);
900
990
  box-shadow:
901
991
  0 1px 0 ${rule},
902
- 0 14px 24px -10px rgba(14,13,11,0.45),
992
+ 0 14px 24px -10px rgba(${shadowInk},0.45),
993
+ 0 0 20px -6px rgba(${accentRgb},0.22),
903
994
  inset 0 -3px 0 ${widgetAccent};
904
995
  }
905
996
  .mushi-trigger:active {
906
997
  transform: translateY(0) rotate(0);
907
998
  box-shadow:
908
999
  0 1px 0 ${rule},
909
- 0 2px 4px -2px rgba(14,13,11,0.35),
1000
+ 0 2px 4px -2px rgba(${shadowInk},0.35),
910
1001
  inset 0 -2px 0 ${widgetAccent};
911
1002
  }
912
1003
  .mushi-trigger:focus-visible {
@@ -918,9 +1009,9 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
918
1009
  can compose with the hover transform without fighting it. Respects
919
1010
  prefers-reduced-motion. */
920
1011
  @keyframes mushi-trigger-pulse {
921
- 0% { box-shadow: 0 0 0 0 rgba(212, 67, 50, 0.55), 0 1px 0 ${rule}, 0 10px 24px -14px rgba(14,13,11,0.45); }
922
- 70% { box-shadow: 0 0 0 16px rgba(212, 67, 50, 0), 0 1px 0 ${rule}, 0 10px 24px -14px rgba(14,13,11,0.45); }
923
- 100% { box-shadow: 0 0 0 0 rgba(212, 67, 50, 0), 0 1px 0 ${rule}, 0 10px 24px -14px rgba(14,13,11,0.45); }
1012
+ 0% { box-shadow: 0 0 0 0 rgba(${accentRgb},0.55), 0 1px 0 ${rule}, 0 10px 24px -14px rgba(${shadowInk},0.45); }
1013
+ 70% { box-shadow: 0 0 0 16px rgba(${accentRgb},0), 0 1px 0 ${rule}, 0 10px 24px -14px rgba(${shadowInk},0.45); }
1014
+ 100% { box-shadow: 0 0 0 0 rgba(${accentRgb},0), 0 1px 0 ${rule}, 0 10px 24px -14px rgba(${shadowInk},0.45); }
924
1015
  }
925
1016
  .mushi-trigger-pulse {
926
1017
  animation: mushi-trigger-pulse 800ms ${easeStamp} 3;
@@ -947,13 +1038,13 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
947
1038
  .mushi-trigger.edge-tab {
948
1039
  width: ${edgeTabWidth}px;
949
1040
  height: 88px;
950
- border-radius: 4px 0 0 4px;
1041
+ border-radius: ${controlRadius}px 0 0 ${controlRadius}px;
951
1042
  writing-mode: vertical-rl;
952
1043
  text-orientation: upright;
953
1044
  font-size: 16px;
954
1045
  box-shadow:
955
1046
  0 1px 0 ${rule},
956
- 0 10px 24px -14px rgba(14,13,11,0.45),
1047
+ 0 10px 24px -14px rgba(${shadowInk},0.45),
957
1048
  inset -3px 0 0 ${widgetAccent};
958
1049
  }
959
1050
  .mushi-trigger.edge-tab.bottom-right,
@@ -963,10 +1054,10 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
963
1054
  .mushi-trigger.edge-tab.bottom-left,
964
1055
  .mushi-trigger.edge-tab.top-left {
965
1056
  left: var(--mushi-left, 0);
966
- border-radius: 0 4px 4px 0;
1057
+ border-radius: 0 ${controlRadius}px ${controlRadius}px 0;
967
1058
  box-shadow:
968
1059
  0 1px 0 ${rule},
969
- 0 10px 24px -14px rgba(14,13,11,0.45),
1060
+ 0 10px 24px -14px rgba(${shadowInk},0.45),
970
1061
  inset 3px 0 0 ${widgetAccent};
971
1062
  }
972
1063
  .mushi-trigger.shrunk {
@@ -995,7 +1086,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
995
1086
  transition: none !important;
996
1087
  box-shadow:
997
1088
  0 1px 0 ${rule},
998
- 0 20px 40px -12px rgba(14,13,11,0.55),
1089
+ 0 20px 40px -12px rgba(${shadowInk},0.55),
999
1090
  inset 0 -3px 0 ${widgetAccent};
1000
1091
  opacity: 0.92;
1001
1092
  }
@@ -1019,13 +1110,14 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
1019
1110
  border-radius: 6px;
1020
1111
  box-shadow:
1021
1112
  0 1px 0 ${rule},
1022
- 0 24px 56px -20px rgba(14,13,11,0.30),
1023
- 0 8px 16px -8px rgba(14,13,11,0.20);
1113
+ 0 24px 56px -20px rgba(${shadowInk},0.30),
1114
+ 0 8px 16px -8px rgba(${shadowInk},0.20);
1024
1115
  overflow: hidden;
1025
1116
  display: flex;
1026
1117
  flex-direction: column;
1027
1118
  transform-origin: var(--mushi-origin, bottom right);
1028
- transition: bottom 120ms ease, top 120ms ease, max-height 120ms ease;
1119
+ /* Keyboard inset \u2014 layout exception (IME), not decorative (docs/MOTION.md) */
1120
+ transition: bottom ${durInstant}ms ease, top ${durInstant}ms ease, max-height ${durInstant}ms ease;
1029
1121
  }
1030
1122
  /* Keyboard-safe: on narrow viewports lift above the keyboard */
1031
1123
  .mushi-panel.keyboard-open {
@@ -1046,7 +1138,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
1046
1138
  bottom: calc(var(--mushi-keyboard-inset, 0px) + 4px) !important;
1047
1139
  }
1048
1140
  }
1049
- .mushi-panel.open { animation: mushi-stamp-in 320ms ${easeStamp} both; }
1141
+ .mushi-panel.open { animation: mushi-stamp-in ${durPanel}ms ${easeStamp} both; }
1050
1142
  .mushi-panel.closed { display: none; }
1051
1143
  .mushi-panel.bottom-right {
1052
1144
  bottom: var(--mushi-panel-bottom, calc(var(--mushi-bottom, ${gutter}px) + ${panelLauncherGap}px));
@@ -1172,7 +1264,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
1172
1264
  font-size: 16px;
1173
1265
  line-height: 1;
1174
1266
  border-radius: 0;
1175
- transition: color 150ms ${easeStamp};
1267
+ transition: opacity ${durInstant}ms ${easeStamp};
1176
1268
  }
1177
1269
  .mushi-back {
1178
1270
  align-self: flex-start;
@@ -1193,7 +1285,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
1193
1285
  display: inline-flex;
1194
1286
  align-items: center;
1195
1287
  gap: 4px;
1196
- transition: color 150ms ${easeStamp};
1288
+ transition: opacity ${durInstant}ms ${easeStamp};
1197
1289
  white-space: nowrap;
1198
1290
  }
1199
1291
  .mushi-close:hover { color: ${widgetAccent}; }
@@ -1227,24 +1319,29 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
1227
1319
  display: grid;
1228
1320
  grid-template-columns: auto 1fr auto;
1229
1321
  align-items: center;
1230
- gap: 12px;
1322
+ gap: ${spaceComfy}px;
1231
1323
  width: 100%;
1232
- padding: 11px 0;
1324
+ min-height: var(--mushi-touch-min);
1325
+ padding: ${spaceComfy}px 0;
1233
1326
  border: none;
1234
1327
  border-bottom: 1px solid ${rule};
1235
1328
  background: transparent;
1236
1329
  cursor: pointer;
1237
1330
  color: inherit;
1238
1331
  text-align: left;
1239
- transition: padding 220ms ${easeStamp}, color 220ms ${easeStamp};
1332
+ transition: transform ${durBase}ms ${easeStamp}, opacity ${durBase}ms ${easeStamp};
1240
1333
  position: relative;
1241
1334
  }
1242
1335
  .mushi-option-btn:last-child { border-bottom: none; }
1243
- .mushi-option-btn:hover { padding-left: 6px; color: ${widgetAccent}; }
1336
+ .mushi-option-btn:hover {
1337
+ transform: translateX(6px);
1338
+ color: ${widgetAccent};
1339
+ background: linear-gradient(90deg, rgba(${accentRgb},0.07), transparent 55%);
1340
+ }
1244
1341
  .mushi-option-btn:hover .mushi-option-arrow { opacity: 1; transform: translateX(0); color: ${widgetAccent}; }
1245
1342
  .mushi-option-btn:focus-visible {
1246
1343
  outline: none;
1247
- padding-left: 6px;
1344
+ transform: translateX(6px);
1248
1345
  box-shadow: inset 2px 0 0 ${widgetAccent};
1249
1346
  }
1250
1347
  .mushi-option-icon {
@@ -1272,7 +1369,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
1272
1369
  color: ${inkFaint};
1273
1370
  opacity: 0;
1274
1371
  transform: translateX(-4px);
1275
- transition: opacity 220ms ${easeStamp}, transform 220ms ${easeStamp}, color 220ms ${easeStamp};
1372
+ transition: opacity ${durBase}ms ${easeStamp}, transform ${durBase}ms ${easeStamp};
1276
1373
  }
1277
1374
  /* Feature-request and Reports-inbox entries sit above the five
1278
1375
  category cards as discoverable shortcuts. We give them a subtle
@@ -1283,7 +1380,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
1283
1380
  .mushi-reports-entry {
1284
1381
  padding-left: 10px;
1285
1382
  border-left: 2px solid ${inkFaint};
1286
- transition: padding 220ms ${easeStamp}, color 220ms ${easeStamp}, border-color 220ms ${easeStamp};
1383
+ transition: opacity ${durBase}ms ${easeStamp}, transform ${durBase}ms ${easeStamp};
1287
1384
  }
1288
1385
  .mushi-feature-entry:hover,
1289
1386
  .mushi-reports-entry:hover {
@@ -1306,7 +1403,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
1306
1403
  color: ${ink};
1307
1404
  cursor: pointer;
1308
1405
  text-align: left;
1309
- transition: background 180ms ${easeStamp}, padding-left 180ms ${easeStamp};
1406
+ transition: opacity ${durFast}ms ${easeStamp}, transform ${durFast}ms ${easeStamp};
1310
1407
  }
1311
1408
  .mushi-report-row:hover,
1312
1409
  .mushi-report-row:focus-visible {
@@ -1393,7 +1490,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
1393
1490
  font-size: 18px;
1394
1491
  line-height: 1;
1395
1492
  color: ${inkFaint};
1396
- transition: color 180ms ${easeStamp}, transform 180ms ${easeStamp};
1493
+ transition: opacity ${durFast}ms ${easeStamp}, transform ${durFast}ms ${easeStamp};
1397
1494
  }
1398
1495
  .mushi-report-row:hover .mushi-report-chevron,
1399
1496
  .mushi-report-row:focus-visible .mushi-report-chevron {
@@ -1483,7 +1580,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
1483
1580
  font-family: ${fontBody};
1484
1581
  font-size: 11px;
1485
1582
  cursor: pointer;
1486
- transition: color 150ms ${easeStamp}, border-color 150ms ${easeStamp}, background 150ms ${easeStamp};
1583
+ transition: opacity ${durInstant}ms ${easeStamp}, transform ${durInstant}ms ${easeStamp};
1487
1584
  white-space: nowrap;
1488
1585
  }
1489
1586
  .mushi-example-chip:hover {
@@ -1509,7 +1606,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
1509
1606
  letter-spacing: 0.04em;
1510
1607
  color: ${inkFaint};
1511
1608
  pointer-events: none;
1512
- transition: color 200ms ${easeStamp};
1609
+ transition: opacity ${durFast}ms ${easeStamp};
1513
1610
  }
1514
1611
 
1515
1612
  .mushi-textarea {
@@ -1525,7 +1622,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
1525
1622
  line-height: 1.5;
1526
1623
  resize: vertical;
1527
1624
  outline: none;
1528
- transition: border-color 200ms ${easeStamp};
1625
+ transition: opacity ${durFast}ms ${easeStamp}, transform ${durFast}ms ${easeStamp};
1529
1626
  }
1530
1627
  .mushi-textarea::placeholder {
1531
1628
  color: ${inkFaint};
@@ -1553,7 +1650,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
1553
1650
  letter-spacing: 0.04em;
1554
1651
  text-transform: uppercase;
1555
1652
  cursor: pointer;
1556
- transition: color 180ms ${easeStamp}, border-color 180ms ${easeStamp}, background 180ms ${easeStamp};
1653
+ transition: opacity ${durFast}ms ${easeStamp}, transform ${durFast}ms ${easeStamp};
1557
1654
  }
1558
1655
  .mushi-attach-btn:hover {
1559
1656
  color: ${ink};
@@ -1647,7 +1744,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
1647
1744
  border: 1.5px solid currentColor;
1648
1745
  border-top-color: transparent;
1649
1746
  border-radius: 50%;
1650
- animation: mushi-spin 0.7s linear infinite;
1747
+ animation: mushi-spin ${durRing}ms linear infinite;
1651
1748
  }
1652
1749
 
1653
1750
  .mushi-footer {
@@ -1669,19 +1766,20 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
1669
1766
  position: relative;
1670
1767
  display: inline-flex;
1671
1768
  align-items: center;
1672
- gap: 8px;
1673
- padding: 10px 18px;
1769
+ gap: ${spaceSnug}px;
1770
+ min-height: var(--mushi-touch-min);
1771
+ padding: ${spaceComfy}px ${spaceLounge}px;
1674
1772
  border: 1px solid ${widgetAccent};
1675
- border-radius: 3px;
1676
- background: ${widgetAccent};
1773
+ border-radius: ${controlRadius}px;
1774
+ background: linear-gradient(160deg, ${widgetAccent} 0%, ${widgetAccentShadow} 100%);
1677
1775
  color: ${onAccent};
1678
1776
  font-family: ${fontMono};
1679
- font-size: 11px;
1777
+ font-size: ${sizeLabel}px;
1680
1778
  letter-spacing: 0.16em;
1681
1779
  text-transform: uppercase;
1682
1780
  cursor: pointer;
1683
1781
  overflow: hidden;
1684
- transition: transform 180ms ${easeStamp}, box-shadow 180ms ${easeStamp};
1782
+ transition: transform ${durFast}ms ${easeStamp}, opacity ${durFast}ms ${easeStamp};
1685
1783
  box-shadow: 0 2px 0 ${widgetAccentShadow};
1686
1784
  }
1687
1785
  .mushi-submit::after {
@@ -1691,12 +1789,15 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
1691
1789
  background: radial-gradient(circle at center, rgba(255,255,255,0.35) 0%, transparent 60%);
1692
1790
  opacity: 0;
1693
1791
  transform: scale(0.4);
1694
- transition: opacity 280ms ${easeStamp}, transform 380ms ${easeStamp};
1792
+ transition: opacity ${durPanel}ms ${easeStamp}, transform ${durSlow}ms ${easeStamp};
1695
1793
  pointer-events: none;
1696
1794
  }
1697
1795
  .mushi-submit:hover {
1698
1796
  transform: translateY(-1px);
1699
- box-shadow: 0 3px 0 ${widgetAccentShadow};
1797
+ box-shadow:
1798
+ 0 3px 0 ${widgetAccentShadow},
1799
+ 0 0 0 3px rgba(${accentRgb},0.18),
1800
+ 0 4px 16px -4px rgba(${accentRgb},0.35);
1700
1801
  }
1701
1802
  .mushi-submit:hover::after { opacity: 1; transform: scale(1.4); }
1702
1803
  .mushi-submit:active { transform: translateY(1px); box-shadow: 0 1px 0 ${widgetAccentShadow}; }
@@ -1710,7 +1811,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
1710
1811
  }
1711
1812
  .mushi-submit-arrow {
1712
1813
  display: inline-block;
1713
- transition: transform 220ms ${easeStamp};
1814
+ transition: transform ${durBase}ms ${easeStamp};
1714
1815
  }
1715
1816
  .mushi-submit:hover .mushi-submit-arrow { transform: translateX(3px); }
1716
1817
 
@@ -1740,7 +1841,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
1740
1841
  display: inline-flex;
1741
1842
  align-items: baseline;
1742
1843
  gap: 4px;
1743
- transition: color 200ms ${easeStamp};
1844
+ transition: opacity ${durFast}ms ${easeStamp};
1744
1845
  }
1745
1846
  .mushi-step-num.done { color: ${inkMuted}; text-decoration: line-through; text-decoration-color: ${inkFaint}; }
1746
1847
  .mushi-step-num.active {
@@ -1780,6 +1881,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
1780
1881
  transform: rotate(-90deg);
1781
1882
  transform-origin: center;
1782
1883
  animation: mushi-stamp-ring 700ms ${easeStamp} 80ms forwards;
1884
+ filter: drop-shadow(0 0 6px rgba(${accentRgb},0.5));
1783
1885
  }
1784
1886
  .mushi-success-stamp-label {
1785
1887
  font-family: ${fontDisplay};
@@ -1848,11 +1950,11 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
1848
1950
  font-size: 12px;
1849
1951
  letter-spacing: 0.02em;
1850
1952
  cursor: pointer;
1851
- transition: background 120ms ease, border-color 120ms ease;
1953
+ transition: opacity ${durInstant}ms ${easeStamp};
1852
1954
  }
1853
1955
  .mushi-success-receipt-id:hover,
1854
1956
  .mushi-success-receipt-id:focus-visible {
1855
- background: rgba(217, 65, 47, 0.06);
1957
+ background: rgba(${accentRgb},0.06);
1856
1958
  border-color: ${widgetAccent};
1857
1959
  color: ${widgetAccent};
1858
1960
  outline: none;
@@ -1875,7 +1977,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
1875
1977
  letter-spacing: 0.10em;
1876
1978
  text-transform: uppercase;
1877
1979
  text-decoration: none;
1878
- transition: filter 120ms ease;
1980
+ transition: filter ${durInstant}ms ease;
1879
1981
  }
1880
1982
  .mushi-success-receipt-track:hover,
1881
1983
  .mushi-success-receipt-track:focus-visible {
@@ -1993,9 +2095,13 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
1993
2095
  }
1994
2096
  .mushi-tier-bar-fill {
1995
2097
  height: 100%;
2098
+ width: 100%;
1996
2099
  background: ${widgetAccent};
1997
2100
  border-radius: 2px;
1998
- transition: width 600ms ${easeStamp};
2101
+ /* Meter fill \u2014 scaleX keeps compositor-friendly motion (docs/MOTION.md). */
2102
+ transform-origin: left center;
2103
+ transform: scaleX(var(--mushi-tier-pct, 0));
2104
+ transition: transform ${durSlow}ms ${easeStamp};
1999
2105
  }
2000
2106
  .mushi-rewards-next-label {
2001
2107
  font-family: ${fontMono};
@@ -2021,7 +2127,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
2021
2127
  letter-spacing: 0.06em;
2022
2128
  margin-bottom: 10px;
2023
2129
  opacity: 0;
2024
- animation: mushi-pts-pop 420ms ${easeStamp} 900ms forwards;
2130
+ animation: mushi-pts-pop ${durSlow}ms ${easeStamp} 900ms forwards;
2025
2131
  }
2026
2132
  .success-bar { margin: 0 0 5px; }
2027
2133
 
@@ -2040,7 +2146,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
2040
2146
  margin: 0 16px 2px;
2041
2147
  padding: 9px 12px;
2042
2148
  background: ${widgetAccentWash};
2043
- border: 1px solid ${isDark ? "rgba(255,90,71,0.22)" : "rgba(224,60,44,0.16)"};
2149
+ border: 1px solid rgba(${accentRgb},${isDark ? "0.22" : "0.16"});
2044
2150
  border-radius: 4px;
2045
2151
  display: flex;
2046
2152
  flex-direction: column;
@@ -2119,7 +2225,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
2119
2225
  content: '\u25B6';
2120
2226
  font-size: 7px;
2121
2227
  opacity: 0.6;
2122
- transition: transform 0.15s ease;
2228
+ transition: transform ${durInstant}ms ${easeStamp};
2123
2229
  }
2124
2230
 
2125
2231
  .mushi-changelog[open] .mushi-changelog-summary::before {
@@ -2147,7 +2253,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
2147
2253
  margin-top: 14px;
2148
2254
  padding: 10px 14px;
2149
2255
  background: ${widgetAccentWash};
2150
- border: 1px solid ${isDark ? "rgba(255,90,71,0.18)" : "rgba(224,60,44,0.14)"};
2256
+ border: 1px solid rgba(${accentRgb},${isDark ? "0.18" : "0.14"});
2151
2257
  border-radius: 4px;
2152
2258
  display: flex;
2153
2259
  flex-direction: column;
@@ -2190,7 +2296,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
2190
2296
  white-space: nowrap;
2191
2297
  overflow: hidden;
2192
2298
  z-index: var(--mushi-banner-z, ${zBanner});
2193
- animation: mushi-banner-slide-in 0.3s ${easeStamp} both;
2299
+ animation: mushi-banner-slide-in ${durPanel}ms ${easeStamp} both;
2194
2300
  }
2195
2301
 
2196
2302
  .mushi-banner.top { top: 0; padding-top: env(safe-area-inset-top, 0px); }
@@ -2347,7 +2453,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
2347
2453
  letter-spacing: inherit;
2348
2454
  text-decoration: none;
2349
2455
  opacity: 0.88;
2350
- transition: opacity 0.15s ease;
2456
+ transition: opacity ${durInstant}ms ${easeStamp};
2351
2457
  flex-shrink: 0;
2352
2458
  }
2353
2459
  .mushi-banner-link:hover { opacity: 1; }
@@ -2375,7 +2481,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
2375
2481
  cursor: pointer;
2376
2482
  font: inherit;
2377
2483
  letter-spacing: inherit;
2378
- transition: background 0.15s ease, opacity 0.15s ease;
2484
+ transition: opacity ${durInstant}ms ${easeStamp};
2379
2485
  flex-shrink: 0;
2380
2486
  height: 24px;
2381
2487
  line-height: 1;
@@ -2397,7 +2503,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
2397
2503
  flex-shrink: 0;
2398
2504
  color: inherit;
2399
2505
  border-radius: 3px;
2400
- transition: opacity 0.15s, background 0.15s;
2506
+ transition: opacity ${durInstant}ms ${easeStamp};
2401
2507
  }
2402
2508
  .mushi-banner-dismiss:hover {
2403
2509
  opacity: 1;
@@ -2418,7 +2524,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
2418
2524
  border-radius: 3px;
2419
2525
  white-space: nowrap;
2420
2526
  flex-shrink: 0;
2421
- transition: opacity 0.15s, background 0.15s;
2527
+ transition: opacity ${durInstant}ms ${easeStamp};
2422
2528
  margin-left: 4px;
2423
2529
  }
2424
2530
  .mushi-banner-my-reports:hover {
@@ -2480,7 +2586,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
2480
2586
  font-family: ${fontBody};
2481
2587
  font-size: 13px;
2482
2588
  text-align: left;
2483
- transition: color 180ms ${easeStamp};
2589
+ transition: opacity ${durFast}ms ${easeStamp};
2484
2590
  }
2485
2591
  .mushi-more-toggle:hover { color: ${widgetAccent}; }
2486
2592
  .mushi-more-toggle:hover .mushi-more-toggle-arrow { transform: translateX(3px); }
@@ -2498,7 +2604,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
2498
2604
  .mushi-more-toggle-arrow {
2499
2605
  font-size: 14px;
2500
2606
  opacity: 0.5;
2501
- transition: transform 180ms ${easeStamp};
2607
+ transition: transform ${durFast}ms ${easeStamp};
2502
2608
  }
2503
2609
  /* \u2500\u2500 Step slide-in \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
2504
2610
  @keyframes mushi-step-in {
@@ -2513,12 +2619,12 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
2513
2619
  }
2514
2620
  /* Expanded secondary categories animate in */
2515
2621
  .mushi-categories-expanded {
2516
- animation: mushi-step-in 180ms ease both;
2622
+ animation: mushi-step-in ${durFast}ms ${easeStamp} both;
2517
2623
  }
2518
2624
  .mushi-link-btn{background:none;border:none;padding:4px 2px;cursor:pointer;color:${widgetAccent};font-size:12px;font-family:${fontMono};text-decoration:underline;text-underline-offset:2px}
2519
2625
  .mushi-link-btn:hover{opacity:0.8}
2520
2626
  .mushi-link-btn:focus-visible,.mushi-nav-item:focus-visible{outline:2px solid ${widgetAccent};outline-offset:2px;border-radius:2px}
2521
- .mushi-nav-item{display:block;width:100%;text-align:left;background:${isDark ? "rgba(255,255,255,0.05)" : "rgba(0,0,0,0.04)"};border:1px solid ${isDark ? "rgba(255,255,255,0.08)" : "rgba(0,0,0,0.08)"};border-radius:8px;padding:10px 14px;margin-bottom:8px;cursor:pointer;font-size:13px;color:${ink};transition:background .15s,border-color .15s}
2627
+ .mushi-nav-item{display:block;width:100%;text-align:left;background:${isDark ? "rgba(255,255,255,0.05)" : "rgba(0,0,0,0.04)"};border:1px solid ${isDark ? "rgba(255,255,255,0.08)" : "rgba(0,0,0,0.08)"};border-radius:8px;padding:10px 14px;margin-bottom:8px;cursor:pointer;font-size:13px;color:${ink};transition:opacity ${durInstant}ms ${easeStamp}}
2522
2628
  .mushi-nav-item:hover{background:${isDark ? "rgba(255,255,255,0.09)" : "rgba(0,0,0,0.07)"}}
2523
2629
  .mushi-account-card{display:flex;align-items:center;gap:12px;background:${isDark ? "rgba(255,255,255,0.06)" : "rgba(0,0,0,0.04)"};border-radius:10px;padding:12px 14px;margin-bottom:14px}
2524
2630
  .mushi-account-avatar{width:40px;height:40px;border-radius:50%;background:${widgetAccentWash};color:${widgetAccentInk};display:flex;align-items:center;justify-content:center;font-size:16px;font-weight:700;flex-shrink:0}
@@ -2541,14 +2647,22 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
2541
2647
  .mushi-assistant-log{flex:1;min-height:120px;overflow-y:auto;display:flex;flex-direction:column;gap:8px;padding:4px 2px 8px}
2542
2648
  .mushi-assistant-greeting{font:400 14px/1.5 ${fontBody};color:${inkMuted};padding:6px 2px}
2543
2649
  .mushi-assistant-suggestions{display:flex;flex-wrap:wrap;gap:6px;margin-top:4px}
2544
- .mushi-assistant-chip{background:${widgetAccentWash};color:${widgetAccentInk};border:1px solid ${ruleStrong};border-radius:999px;padding:5px 12px;font-size:12px;cursor:pointer;font-family:${fontBody};transition:background .15s}
2545
- .mushi-assistant-chip:hover{background:${isDark ? "rgba(255,90,71,0.22)" : "rgba(224,60,44,0.14)"}}
2650
+ .mushi-assistant-chip{background:${widgetAccentWash};color:${widgetAccentInk};border:1px solid ${ruleStrong};border-radius:999px;padding:5px 12px;font-size:12px;cursor:pointer;font-family:${fontBody};transition:opacity ${durInstant}ms ${easeStamp},transform ${durInstant}ms ${easeStamp}}
2651
+ .mushi-assistant-chip:hover{background:rgba(${accentRgb},${isDark ? "0.22" : "0.14"})}
2546
2652
  .mushi-assistant-chip:focus-visible{outline:2px solid ${widgetAccent};outline-offset:2px}
2547
2653
  .mushi-assistant-msg{max-width:85%;padding:8px 12px;border-radius:12px;font:400 14px/1.45 ${fontBody};white-space:pre-wrap;word-break:break-word}
2548
2654
  .mushi-assistant-msg-user{align-self:flex-end;background:${widgetAccent};color:${inverse};border-bottom-right-radius:4px}
2549
2655
  .mushi-assistant-msg-bot{align-self:flex-start;background:${isDark ? "rgba(255,255,255,0.06)" : "rgba(0,0,0,0.05)"};color:${ink};border-bottom-left-radius:4px}
2550
2656
  .mushi-assistant-thinking{opacity:0.6;font-size:18px;letter-spacing:2px}
2551
- .mushi-assistant-error{align-self:flex-start;color:${danger};font-size:12px;padding:4px 2px}
2657
+ .mushi-assistant-error{align-self:flex-start;color:${danger};font-size:12px;padding:4px 2px;display:flex;flex-direction:column;align-items:flex-start;gap:6px}
2658
+ .mushi-assistant-recovery{display:flex;flex-wrap:wrap;gap:6px;margin-top:2px}
2659
+ .mushi-assistant-recovery-footer{margin-top:4px;padding-top:4px}
2660
+ .mushi-assistant-report-cta{background:${widgetAccent};color:${inverse};border:none;border-radius:999px;padding:6px 14px;font-size:12px;cursor:pointer;font-family:${fontBody};font-weight:600}
2661
+ .mushi-assistant-report-cta:hover{opacity:0.92}
2662
+ .mushi-assistant-report-cta:focus-visible{outline:2px solid ${widgetAccent};outline-offset:2px}
2663
+ .mushi-assistant-report-link{background:transparent;color:${widgetAccentInk};border:none;padding:0;font-size:12px;cursor:pointer;font-family:${fontBody};text-decoration:underline;text-underline-offset:2px}
2664
+ .mushi-assistant-report-link:hover{opacity:0.85}
2665
+ .mushi-assistant-report-link:focus-visible{outline:2px solid ${widgetAccent};outline-offset:2px}
2552
2666
  .mushi-assistant-form{display:flex;align-items:flex-end;gap:8px;border-top:1px solid ${rule};padding-top:8px}
2553
2667
  .mushi-assistant-input{flex:1;resize:none;max-height:120px;border:1px solid ${ruleStrong};border-radius:10px;padding:8px 12px;font:400 14px/1.4 ${fontBody};background:${paper};color:${ink}}
2554
2668
  .mushi-assistant-input:focus-visible{outline:2px solid ${widgetAccent};outline-offset:1px}
@@ -2561,7 +2675,56 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
2561
2675
 
2562
2676
  // src/version.ts
2563
2677
  var MUSHI_SDK_PACKAGE = "@mushi-mushi/web";
2564
- var MUSHI_SDK_VERSION = "1.25.0" ;
2678
+ var MUSHI_SDK_VERSION = "1.26.0" ;
2679
+ var ASSISTANT_SESSION_STORAGE_KEY = "mushi-assistant-session-v1";
2680
+ function loadAssistantSession() {
2681
+ try {
2682
+ if (typeof sessionStorage === "undefined") return null;
2683
+ const raw = sessionStorage.getItem(ASSISTANT_SESSION_STORAGE_KEY);
2684
+ if (!raw) return null;
2685
+ const parsed = JSON.parse(raw);
2686
+ if (!parsed || typeof parsed !== "object") return null;
2687
+ const record = parsed;
2688
+ const turns = Array.isArray(record.turns) ? record.turns : null;
2689
+ if (!turns) return null;
2690
+ const normalized = [];
2691
+ for (const item of turns) {
2692
+ if (!item || typeof item !== "object") continue;
2693
+ const t = item;
2694
+ if (t.role !== "user" && t.role !== "assistant") continue;
2695
+ if (typeof t.text !== "string") continue;
2696
+ const turn = { role: t.role, text: t.text };
2697
+ if (Array.isArray(t.options)) {
2698
+ const options = t.options.filter((o) => typeof o === "string");
2699
+ if (options.length) turn.options = options;
2700
+ }
2701
+ if (t.offerReport === true) turn.offerReport = true;
2702
+ normalized.push(turn);
2703
+ }
2704
+ const threadId = typeof record.threadId === "string" && record.threadId.length > 0 ? record.threadId : null;
2705
+ return { turns: normalized, threadId };
2706
+ } catch {
2707
+ return null;
2708
+ }
2709
+ }
2710
+ function saveAssistantSession(snapshot) {
2711
+ try {
2712
+ if (typeof sessionStorage === "undefined") return;
2713
+ if (!snapshot.turns.length && !snapshot.threadId) {
2714
+ sessionStorage.removeItem(ASSISTANT_SESSION_STORAGE_KEY);
2715
+ return;
2716
+ }
2717
+ sessionStorage.setItem(ASSISTANT_SESSION_STORAGE_KEY, JSON.stringify(snapshot));
2718
+ } catch {
2719
+ }
2720
+ }
2721
+ function clearAssistantSession() {
2722
+ try {
2723
+ if (typeof sessionStorage === "undefined") return;
2724
+ sessionStorage.removeItem(ASSISTANT_SESSION_STORAGE_KEY);
2725
+ } catch {
2726
+ }
2727
+ }
2565
2728
  var CATEGORY_ICONS = {
2566
2729
  bug: "\u26A0\uFE0F",
2567
2730
  slow: "\u{1F40C}",
@@ -2769,10 +2932,18 @@ function renderAssistantStep(ctx) {
2769
2932
  ${suggestions.length ? `<div class="mushi-assistant-suggestions">${suggestions.map((s) => `<button type="button" class="mushi-assistant-chip" data-action="assistant-suggest" data-value="${escapeHtml(s)}">${escapeHtml(s)}</button>`).join("")}</div>` : ""}` : ctx.assistantTurns.map((turn) => {
2770
2933
  const cls = turn.role === "user" ? "mushi-assistant-msg-user" : "mushi-assistant-msg-bot";
2771
2934
  const opts = turn.options && turn.options.length ? `<div class="mushi-assistant-suggestions">${turn.options.map((o) => `<button type="button" class="mushi-assistant-chip" data-action="assistant-suggest" data-value="${escapeHtml(o)}">${escapeHtml(o)}</button>`).join("")}</div>` : "";
2772
- return `<div class="mushi-assistant-msg ${cls}">${escapeHtml(turn.text)}</div>${opts}`;
2935
+ const reportCta = turn.offerReport ? `<div class="mushi-assistant-recovery">
2936
+ <button type="button" class="mushi-assistant-report-cta" data-action="assistant-report">${escapeHtml(t.assistant.fileReportCta)}</button>
2937
+ </div>` : "";
2938
+ return `<div class="mushi-assistant-msg ${cls}">${escapeHtml(turn.text)}</div>${opts}${reportCta}`;
2773
2939
  }).join("");
2774
2940
  const thinking = ctx.assistantSending ? `<div class="mushi-assistant-msg mushi-assistant-msg-bot mushi-assistant-thinking" role="status" aria-live="polite">${escapeHtml(t.assistant.thinking)}</div>` : "";
2775
- const error = ctx.assistantError ? `<div class="mushi-assistant-error" role="alert">${escapeHtml(ctx.assistantError)}</div>` : "";
2941
+ const error = ctx.assistantError ? `<div class="mushi-assistant-error" role="alert">${escapeHtml(ctx.assistantError)}
2942
+ <button type="button" class="mushi-assistant-report-cta" data-action="assistant-report">${escapeHtml(t.assistant.fileReportCta)}</button>
2943
+ </div>` : "";
2944
+ const stillStuck = !empty && !ctx.assistantSending && !ctx.assistantError ? `<div class="mushi-assistant-recovery mushi-assistant-recovery-footer">
2945
+ <button type="button" class="mushi-assistant-report-link" data-action="assistant-report">${escapeHtml(t.assistant.stillStuckCta)}</button>
2946
+ </div>` : "";
2776
2947
  return `
2777
2948
  ${renderHeader(ctx, { title: label, showBack: true })}
2778
2949
  <div class="mushi-assistant">
@@ -2780,6 +2951,7 @@ function renderAssistantStep(ctx) {
2780
2951
  ${transcript}
2781
2952
  ${thinking}
2782
2953
  ${error}
2954
+ ${stillStuck}
2783
2955
  </div>
2784
2956
  <form class="mushi-assistant-form" data-action="assistant-send">
2785
2957
  <textarea
@@ -3307,6 +3479,7 @@ function renderDetailsStep(ctx) {
3307
3479
  class="mushi-textarea"
3308
3480
  placeholder="${escapeHtml(t.step3.descriptionPlaceholder)}"
3309
3481
  rows="4"
3482
+ maxlength="4000"
3310
3483
  aria-label="${escapeHtml(t.step3.heading)}"
3311
3484
  autofocus
3312
3485
  ></textarea>
@@ -3376,12 +3549,15 @@ function renderSuccessStep(ctx) {
3376
3549
  }
3377
3550
  function renderSuccessReceipt(ctx) {
3378
3551
  const s = ctx.locale.flows.success;
3379
- if (ctx.lastSubmitQueuedOffline) {
3552
+ const failureKind = ctx.lastSubmitFailureKind;
3553
+ if (failureKind === "rate_limited" || failureKind === "quota" || failureKind === "permanent" || failureKind === "retrying" || ctx.lastSubmitQueuedOffline) {
3554
+ const label = failureKind === "rate_limited" ? s.rateLimited : failureKind === "quota" ? s.quotaBlocked : failureKind === "permanent" ? s.permanentFailed : failureKind === "retrying" ? s.retrying : s.queuedOffline;
3555
+ const hint = failureKind === "rate_limited" ? s.rateLimitedHint : failureKind === "quota" ? s.quotaBlockedHint : failureKind === "permanent" ? s.permanentFailedHint : failureKind === "retrying" ? s.retryingHint : s.queuedHint;
3380
3556
  return `
3381
3557
  <div class="mushi-success-receipt" role="status">
3382
3558
  <div class="mushi-success-receipt-row mushi-success-receipt-warn">
3383
- <span class="mushi-success-receipt-label">${escapeHtml(s.queuedOffline)}</span>
3384
- <span class="mushi-success-receipt-hint">${escapeHtml(s.queuedHint)}</span>
3559
+ <span class="mushi-success-receipt-label">${escapeHtml(label)}</span>
3560
+ <span class="mushi-success-receipt-hint">${escapeHtml(hint)}</span>
3385
3561
  </div>
3386
3562
  </div>
3387
3563
  `;
@@ -3472,7 +3648,7 @@ function renderRewardsNudge(ctx) {
3472
3648
  </div>
3473
3649
  ${nextTier ? `
3474
3650
  <div class="mushi-tier-bar-track" role="progressbar" aria-valuenow="${pct}" aria-valuemin="0" aria-valuemax="100" aria-label="Progress to ${escapeHtml(nextTier.displayName)}">
3475
- <div class="mushi-tier-bar-fill" style="width:${pct}%"></div>
3651
+ <div class="mushi-tier-bar-fill" style="--mushi-tier-pct:${pct / 100}"></div>
3476
3652
  </div>
3477
3653
  <div class="mushi-rewards-next-label">${nextLabel}</div>
3478
3654
  ` : ""}
@@ -3496,7 +3672,7 @@ function renderSuccessRewards(ctx) {
3496
3672
  <div class="mushi-success-pts-award">+${pointsForReport} pts</div>
3497
3673
  ${nextTier ? `
3498
3674
  <div class="mushi-tier-bar-track success-bar" role="progressbar" aria-valuenow="${pctAfter}" aria-valuemin="0" aria-valuemax="100" aria-label="Progress to ${escapeHtml(nextTier.displayName)}">
3499
- <div class="mushi-tier-bar-fill" style="width:${pctAfter}%"></div>
3675
+ <div class="mushi-tier-bar-fill" style="--mushi-tier-pct:${pctAfter / 100}"></div>
3500
3676
  </div>
3501
3677
  <div class="mushi-rewards-next-label">${nextLabel}</div>
3502
3678
  ` : ""}
@@ -3505,6 +3681,12 @@ function renderSuccessRewards(ctx) {
3505
3681
  }
3506
3682
 
3507
3683
  // src/widget.ts
3684
+ function looksUnsureAssistantAnswer(text) {
3685
+ const lower = text.toLowerCase();
3686
+ return /i('m| am) not sure|i don't know|not sure|cannot help|can't help|unable to|don't have enough|outside (my|of) (scope|knowledge)|file a (bug )?report|報告/.test(
3687
+ lower
3688
+ ) || /わかりません|分かりません|不明|報告して/.test(text);
3689
+ }
3508
3690
  var MushiWidget = class _MushiWidget {
3509
3691
  constructor(config = {}, callbacks, sdkVersion = MUSHI_SDK_VERSION) {
3510
3692
  this.sdkVersion = sdkVersion;
@@ -3551,6 +3733,11 @@ var MushiWidget = class _MushiWidget {
3551
3733
  };
3552
3734
  this.callbacks = callbacks;
3553
3735
  this.locale = getLocale(this.config.locale === "auto" ? void 0 : this.config.locale);
3736
+ const saved = loadAssistantSession();
3737
+ if (saved?.turns.length) {
3738
+ this.assistantTurns = saved.turns;
3739
+ this.assistantThreadId = saved.threadId;
3740
+ }
3554
3741
  this.host = document.createElement("div");
3555
3742
  this.host.id = "mushi-mushi-widget";
3556
3743
  this.shadow = this.host.attachShadow({ mode: "open" });
@@ -3558,6 +3745,9 @@ var MushiWidget = class _MushiWidget {
3558
3745
  sdkVersion;
3559
3746
  host;
3560
3747
  shadow;
3748
+ /** Re-inject styles when OS light/dark flips while theme=auto|inherit. */
3749
+ colorSchemeMq = null;
3750
+ onColorSchemeChange = null;
3561
3751
  config;
3562
3752
  callbacks;
3563
3753
  locale;
@@ -3656,6 +3846,7 @@ var MushiWidget = class _MushiWidget {
3656
3846
  * Drives a different success copy so the user knows the report
3657
3847
  * hasn't actually reached the console yet. */
3658
3848
  lastSubmitQueuedOffline = false;
3849
+ lastSubmitFailureKind;
3659
3850
  lastSubmitScreenshotDropped = false;
3660
3851
  /** Whether the user has clicked ✕ on the header banner this session. */
3661
3852
  bannerDismissed = false;
@@ -3700,6 +3891,7 @@ var MushiWidget = class _MushiWidget {
3700
3891
  document.body.appendChild(this.host);
3701
3892
  this.syncAttachedLaunchers();
3702
3893
  this.syncSmartHide();
3894
+ this.bindColorSchemeListener();
3703
3895
  this.render();
3704
3896
  this.mountedAt = Date.now();
3705
3897
  }
@@ -3800,6 +3992,7 @@ var MushiWidget = class _MushiWidget {
3800
3992
  this.removeSelectorHint();
3801
3993
  this.lastReportId = null;
3802
3994
  this.lastSubmitQueuedOffline = false;
3995
+ this.lastSubmitFailureKind = void 0;
3803
3996
  this.lastSubmitScreenshotDropped = false;
3804
3997
  this.viaFeatureRequest = false;
3805
3998
  this.clearFormDrafts();
@@ -3861,6 +4054,7 @@ var MushiWidget = class _MushiWidget {
3861
4054
  this.assistantSending = true;
3862
4055
  this.assistantError = null;
3863
4056
  this.assistantTurns.push({ role: "user", text });
4057
+ this.persistAssistantSession();
3864
4058
  this.render();
3865
4059
  try {
3866
4060
  const reply = await this.callbacks.onAssistantAsk(text, this.assistantThreadId);
@@ -3870,11 +4064,19 @@ var MushiWidget = class _MushiWidget {
3870
4064
  this.assistantTurns.push({
3871
4065
  role: "assistant",
3872
4066
  text: reply.question ?? "Could you tell me a bit more?",
3873
- ...reply.options && reply.options.length ? { options: reply.options } : {}
4067
+ ...reply.options && reply.options.length ? { options: reply.options } : {},
4068
+ offerReport: true
3874
4069
  });
3875
4070
  } else {
3876
- this.assistantTurns.push({ role: "assistant", text: reply.text ?? "\u2026" });
4071
+ const answerText = reply.text ?? "\u2026";
4072
+ const unsure = looksUnsureAssistantAnswer(answerText);
4073
+ this.assistantTurns.push({
4074
+ role: "assistant",
4075
+ text: answerText,
4076
+ ...unsure ? { offerReport: true } : {}
4077
+ });
3877
4078
  }
4079
+ this.persistAssistantSession();
3878
4080
  } else {
3879
4081
  this.assistantError = this.locale.assistant.errors.noResponse;
3880
4082
  }
@@ -3889,6 +4091,33 @@ var MushiWidget = class _MushiWidget {
3889
4091
  }, 0);
3890
4092
  }
3891
4093
  }
4094
+ /** Persist Ask turns for same-tab reload survival (UX only). */
4095
+ persistAssistantSession() {
4096
+ saveAssistantSession({
4097
+ turns: this.assistantTurns,
4098
+ threadId: this.assistantThreadId
4099
+ });
4100
+ }
4101
+ /** Clear Ask transcript (e.g. host reset). Keeps Ask login-free. */
4102
+ clearAssistantTranscript() {
4103
+ this.assistantTurns = [];
4104
+ this.assistantThreadId = null;
4105
+ this.assistantError = null;
4106
+ clearAssistantSession();
4107
+ if (this.step === "assistant") this.render();
4108
+ }
4109
+ /** Escape hatch from Ask → report category picker (no login required). */
4110
+ openReportFromAssistant() {
4111
+ this.selectedCategory = null;
4112
+ this.selectedIntent = null;
4113
+ this.viaFeatureRequest = false;
4114
+ this.step = "category";
4115
+ if (!this.isOpen) {
4116
+ this.isOpen = true;
4117
+ this.callbacks.onOpen();
4118
+ }
4119
+ this.render();
4120
+ }
3892
4121
  /**
3893
4122
  * Briefly highlight the trigger button (a soft pulse + tooltip) without
3894
4123
  * opening the full reporter panel. Use for first-session welcome nudges
@@ -4138,6 +4367,7 @@ var MushiWidget = class _MushiWidget {
4138
4367
  clearTimeout(this.smartHideTimer);
4139
4368
  this.smartHideTimer = null;
4140
4369
  }
4370
+ this.unbindColorSchemeListener();
4141
4371
  this.smartHideCleanup?.();
4142
4372
  this.smartHideCleanup = null;
4143
4373
  this.teardownViewportHandlers();
@@ -4148,6 +4378,33 @@ var MushiWidget = class _MushiWidget {
4148
4378
  this.removeBodyNudge();
4149
4379
  this.host.remove();
4150
4380
  }
4381
+ /** Live-restyle when OS prefers-color-scheme changes (theme auto/inherit only). */
4382
+ bindColorSchemeListener() {
4383
+ this.unbindColorSchemeListener();
4384
+ if (typeof window === "undefined" || !window.matchMedia) return;
4385
+ const theme = this.config.theme;
4386
+ if (theme !== "auto" && theme !== "inherit") return;
4387
+ this.colorSchemeMq = window.matchMedia("(prefers-color-scheme: dark)");
4388
+ this.onColorSchemeChange = () => {
4389
+ if (this.host.isConnected) this.render();
4390
+ };
4391
+ if (typeof this.colorSchemeMq.addEventListener === "function") {
4392
+ this.colorSchemeMq.addEventListener("change", this.onColorSchemeChange);
4393
+ } else if (typeof this.colorSchemeMq.addListener === "function") {
4394
+ this.colorSchemeMq.addListener(this.onColorSchemeChange);
4395
+ }
4396
+ }
4397
+ unbindColorSchemeListener() {
4398
+ if (this.colorSchemeMq && this.onColorSchemeChange) {
4399
+ if (typeof this.colorSchemeMq.removeEventListener === "function") {
4400
+ this.colorSchemeMq.removeEventListener("change", this.onColorSchemeChange);
4401
+ } else if (typeof this.colorSchemeMq.removeListener === "function") {
4402
+ this.colorSchemeMq.removeListener(this.onColorSchemeChange);
4403
+ }
4404
+ }
4405
+ this.colorSchemeMq = null;
4406
+ this.onColorSchemeChange = null;
4407
+ }
4151
4408
  /* ── Host chrome contract ────────────────────────────────────────────────
4152
4409
  The host element must never create an invisible full-screen touch blocker.
4153
4410
  We own these inline styles — consumer CSS can only win with `!important`,
@@ -4933,6 +5190,7 @@ var MushiWidget = class _MushiWidget {
4933
5190
  leaderboardLoading: this.leaderboardLoading,
4934
5191
  leaderboardEntries: this.leaderboardEntries,
4935
5192
  lastSubmitQueuedOffline: this.lastSubmitQueuedOffline,
5193
+ lastSubmitFailureKind: this.lastSubmitFailureKind,
4936
5194
  lastSubmitScreenshotDropped: this.lastSubmitScreenshotDropped,
4937
5195
  featureBoard: this.featureBoard,
4938
5196
  crossAppReports: this.crossAppReports,
@@ -5013,6 +5271,11 @@ var MushiWidget = class _MushiWidget {
5013
5271
  if (value) void this.sendAssistantMessage(value);
5014
5272
  });
5015
5273
  });
5274
+ panel.querySelectorAll('[data-action="assistant-report"]').forEach((btn) => {
5275
+ btn.addEventListener("click", () => {
5276
+ this.openReportFromAssistant();
5277
+ });
5278
+ });
5016
5279
  {
5017
5280
  const form = panel.querySelector('[data-action="assistant-send"]');
5018
5281
  if (form) {
@@ -5217,6 +5480,7 @@ var MushiWidget = class _MushiWidget {
5217
5480
  this.submittedAt = /* @__PURE__ */ new Date();
5218
5481
  this.lastReportId = null;
5219
5482
  this.lastSubmitQueuedOffline = false;
5483
+ this.lastSubmitFailureKind = void 0;
5220
5484
  this.lastSubmitScreenshotDropped = false;
5221
5485
  this.render();
5222
5486
  const outcomeP = (async () => {
@@ -5250,6 +5514,7 @@ var MushiWidget = class _MushiWidget {
5250
5514
  if (outcome) {
5251
5515
  this.lastReportId = outcome.reportId ?? null;
5252
5516
  this.lastSubmitQueuedOffline = Boolean(outcome.queuedOffline);
5517
+ this.lastSubmitFailureKind = outcome.failureKind;
5253
5518
  this.lastSubmitScreenshotDropped = Boolean(outcome.screenshotDropped);
5254
5519
  this.render();
5255
5520
  }
@@ -8698,7 +8963,7 @@ function createInstance(config) {
8698
8963
  await offlineQueue.enqueue(finalReport);
8699
8964
  log.info("Offline \u2014 report queued", { reportId: finalReport.id });
8700
8965
  emit("report:queued", { reportId: finalReport.id });
8701
- return { reportId: null, queuedOffline: true };
8966
+ return { reportId: null, queuedOffline: true, failureKind: "offline" };
8702
8967
  }
8703
8968
  let result = await apiClient2.submitReport(finalReport);
8704
8969
  if (!result.ok && result.error?.code === "PAYLOAD_TOO_LARGE") {
@@ -8752,7 +9017,32 @@ function createInstance(config) {
8752
9017
  level: "error",
8753
9018
  message: `Mushi report dropped \u2014 payload too large (${finalReport.id})`
8754
9019
  });
9020
+ pendingScreenshot = null;
9021
+ pendingElement = null;
9022
+ pendingProactiveTrigger = null;
9023
+ return { reportId: null, queuedOffline: false, failureKind: "permanent", screenshotDropped };
8755
9024
  } else {
9025
+ const code = result.error?.code ?? "";
9026
+ const isRateLimited = code === "HTTP_429" || code.includes("RATE_LIMIT");
9027
+ const isAuth = code === "HTTP_401" || code.includes("UNAUTHORIZED") || code.includes("INVALID_API_KEY") || code.includes("MISSING_API_KEY");
9028
+ const isQuota = code === "HTTP_403" || code.includes("QUOTA") || code.includes("FORBIDDEN") || code === "feature_not_in_plan";
9029
+ if (isAuth || isQuota) {
9030
+ log.warn("Report rejected \u2014 credentials/quota", { reportId: finalReport.id, error: result.error });
9031
+ emit("report:failed", { reportId: finalReport.id, error: result.error });
9032
+ pendingScreenshot = null;
9033
+ pendingElement = null;
9034
+ pendingProactiveTrigger = null;
9035
+ return { reportId: null, queuedOffline: false, failureKind: "quota" };
9036
+ }
9037
+ if (isRateLimited) {
9038
+ log.warn("Report rate-limited \u2014 queued for retry", { reportId: finalReport.id, error: result.error });
9039
+ await offlineQueue.enqueue(finalReport);
9040
+ emit("report:failed", { reportId: finalReport.id, error: result.error });
9041
+ pendingScreenshot = null;
9042
+ pendingElement = null;
9043
+ pendingProactiveTrigger = null;
9044
+ return { reportId: null, queuedOffline: true, failureKind: "rate_limited" };
9045
+ }
8756
9046
  log.warn("Report failed, queuing for retry", { reportId: finalReport.id, error: result.error });
8757
9047
  await offlineQueue.enqueue(finalReport);
8758
9048
  emit("report:failed", { reportId: finalReport.id, error: result.error });
@@ -8769,7 +9059,7 @@ function createInstance(config) {
8769
9059
  const serverId = result.data?.reportId ?? report.id;
8770
9060
  return { reportId: serverId, queuedOffline: false, screenshotDropped };
8771
9061
  }
8772
- return { reportId: null, queuedOffline: true };
9062
+ return { reportId: null, queuedOffline: true, failureKind: "retrying" };
8773
9063
  }
8774
9064
  const sdk = {
8775
9065
  report(options) {