create-pmos 0.448.0 → 0.450.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.
Files changed (125) hide show
  1. package/package.json +25 -25
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/adler-seasons-art-test.js +9 -2
  7. package/workspace/adler-seasons-test.js +1 -1
  8. package/workspace/changelog.json +24 -0
  9. package/workspace/guide/adler.md +15 -15
  10. package/workspace/lib/grill-api.js +146 -0
  11. package/workspace/lib/grill-runs.js +14 -2
  12. package/workspace/lib/grill.js +3 -0
  13. package/workspace/lib/page-build.js +8 -0
  14. package/workspace/package-lock.json +84 -2
  15. package/workspace/package.json +2 -1
  16. package/workspace/public/pm/adler/01_expressions/celebrating.png +0 -0
  17. package/workspace/public/pm/adler/01_expressions/handled.png +0 -0
  18. package/workspace/public/pm/adler/01_expressions/honest.png +0 -0
  19. package/workspace/public/pm/adler/01_expressions/needs_you.png +0 -0
  20. package/workspace/public/pm/adler/01_expressions/resting.png +0 -0
  21. package/workspace/public/pm/adler/01_expressions/thinking.png +0 -0
  22. package/workspace/public/pm/adler/02_moments/headphones_honest.png +0 -0
  23. package/workspace/public/pm/adler/02_moments/headphones_listening.png +0 -0
  24. package/workspace/public/pm/adler/02_moments/headphones_resting.png +0 -0
  25. package/workspace/public/pm/adler/02_moments/hello_wave.png +0 -0
  26. package/workspace/public/pm/adler/02_moments/honest_full_figure.png +0 -0
  27. package/workspace/public/pm/adler/02_moments/leaf_tips_peeking.png +0 -0
  28. package/workspace/public/pm/adler/02_moments/morning_stretch.png +0 -0
  29. package/workspace/public/pm/adler/02_moments/peeking_up.png +0 -0
  30. package/workspace/public/pm/adler/02_moments/tea_mug.png +0 -0
  31. package/workspace/public/pm/adler/03_growth_activity/clipboard.png +0 -0
  32. package/workspace/public/pm/adler/03_growth_activity/laptop_alert.png +0 -0
  33. package/workspace/public/pm/adler/03_growth_activity/laptop_resting.png +0 -0
  34. package/workspace/public/pm/adler/03_growth_activity/sprout_large.png +0 -0
  35. package/workspace/public/pm/adler/03_growth_activity/sprout_medium.png +0 -0
  36. package/workspace/public/pm/adler/03_growth_activity/sprout_none.png +0 -0
  37. package/workspace/public/pm/adler/03_growth_activity/sprout_small.png +0 -0
  38. package/workspace/public/pm/adler/03_growth_activity/telescope.png +0 -0
  39. package/workspace/public/pm/adler/04_weather_leaves/cloud_large.png +0 -0
  40. package/workspace/public/pm/adler/04_weather_leaves/cloud_medium.png +0 -0
  41. package/workspace/public/pm/adler/04_weather_leaves/cloud_small.png +0 -0
  42. package/workspace/public/pm/adler/04_weather_leaves/crescent_stars.png +0 -0
  43. package/workspace/public/pm/adler/04_weather_leaves/leaf_green.png +0 -0
  44. package/workspace/public/pm/adler/04_weather_leaves/leaf_orange.png +0 -0
  45. package/workspace/public/pm/adler/04_weather_leaves/leaf_pink.png +0 -0
  46. package/workspace/public/pm/adler/04_weather_leaves/rain_cloud.png +0 -0
  47. package/workspace/public/pm/adler/04_weather_leaves/sun.png +0 -0
  48. package/workspace/public/pm/adler/05_space/lunar_ground.png +0 -0
  49. package/workspace/public/pm/adler/05_space/planet_cloud.png +0 -0
  50. package/workspace/public/pm/adler/05_space/planet_crater.png +0 -0
  51. package/workspace/public/pm/adler/05_space/planet_glass.png +0 -0
  52. package/workspace/public/pm/adler/05_space/planet_smooth.png +0 -0
  53. package/workspace/public/pm/adler/05_space/rocket_flying.png +0 -0
  54. package/workspace/public/pm/adler/05_space/rocket_idle.png +0 -0
  55. package/workspace/public/pm/adler/05_space/rocket_liftoff.png +0 -0
  56. package/workspace/public/pm/adler/05_space/satellite.png +0 -0
  57. package/workspace/public/pm/adler/05_space/satellite_dish.png +0 -0
  58. package/workspace/public/pm/adler/06_landscapes/beach.png +0 -0
  59. package/workspace/public/pm/adler/06_landscapes/deciduous_forest.png +0 -0
  60. package/workspace/public/pm/adler/06_landscapes/desert_large.png +0 -0
  61. package/workspace/public/pm/adler/06_landscapes/desert_small.png +0 -0
  62. package/workspace/public/pm/adler/06_landscapes/floating_island_large.png +0 -0
  63. package/workspace/public/pm/adler/06_landscapes/floating_island_small.png +0 -0
  64. package/workspace/public/pm/adler/06_landscapes/lake.png +0 -0
  65. package/workspace/public/pm/adler/06_landscapes/pine_forest.png +0 -0
  66. package/workspace/public/pm/adler/06_landscapes/snow_forest.png +0 -0
  67. package/workspace/public/pm/adler/06_landscapes/snow_mountains.png +0 -0
  68. package/workspace/public/pm/adler/07_wearables/astronaut_helmet.png +0 -0
  69. package/workspace/public/pm/adler/07_wearables/beanie_blue.png +0 -0
  70. package/workspace/public/pm/adler/07_wearables/beanie_red.png +0 -0
  71. package/workspace/public/pm/adler/07_wearables/hard_hat.png +0 -0
  72. package/workspace/public/pm/adler/07_wearables/headband.png +0 -0
  73. package/workspace/public/pm/adler/07_wearables/party_hat_blue.png +0 -0
  74. package/workspace/public/pm/adler/07_wearables/party_hat_multicolor.png +0 -0
  75. package/workspace/public/pm/adler/07_wearables/pencil.png +0 -0
  76. package/workspace/public/pm/adler/07_wearables/scarf_black_white.png +0 -0
  77. package/workspace/public/pm/adler/07_wearables/scarf_blue.png +0 -0
  78. package/workspace/public/pm/adler/07_wearables/scarf_blue_white.png +0 -0
  79. package/workspace/public/pm/adler/07_wearables/scarf_green_red.png +0 -0
  80. package/workspace/public/pm/adler/07_wearables/scarf_green_white.png +0 -0
  81. package/workspace/public/pm/adler/07_wearables/scarf_red_white.png +0 -0
  82. package/workspace/public/pm/adler/07_wearables/scarf_yellow.png +0 -0
  83. package/workspace/public/pm/adler/07_wearables/straw_hat.png +0 -0
  84. package/workspace/public/pm/adler/07_wearables/yellow_flowers.png +0 -0
  85. package/workspace/public/pm/adler/08_food_festival/apple.png +0 -0
  86. package/workspace/public/pm/adler/08_food_festival/cooking_pot.png +0 -0
  87. package/workspace/public/pm/adler/08_food_festival/cupcake.png +0 -0
  88. package/workspace/public/pm/adler/08_food_festival/diya.png +0 -0
  89. package/workspace/public/pm/adler/08_food_festival/egg.png +0 -0
  90. package/workspace/public/pm/adler/08_food_festival/heart_mug.png +0 -0
  91. package/workspace/public/pm/adler/08_food_festival/ketupat.png +0 -0
  92. package/workspace/public/pm/adler/08_food_festival/lotus.png +0 -0
  93. package/workspace/public/pm/adler/08_food_festival/mandarins.png +0 -0
  94. package/workspace/public/pm/adler/08_food_festival/mooncake.png +0 -0
  95. package/workspace/public/pm/adler/08_food_festival/pie.png +0 -0
  96. package/workspace/public/pm/adler/08_food_festival/pinwheel.png +0 -0
  97. package/workspace/public/pm/adler/08_food_festival/popcorn.png +0 -0
  98. package/workspace/public/pm/adler/08_food_festival/red_lantern.png +0 -0
  99. package/workspace/public/pm/adler/08_food_festival/tangyuan.png +0 -0
  100. package/workspace/public/pm/adler/08_food_festival/watering_can.png +0 -0
  101. package/workspace/public/pm/adler/08_food_festival/zongzi.png +0 -0
  102. package/workspace/public/pm/adler/09_celebration/bunting.png +0 -0
  103. package/workspace/public/pm/adler/09_celebration/clapperboard.png +0 -0
  104. package/workspace/public/pm/adler/09_celebration/fireworks.png +0 -0
  105. package/workspace/public/pm/adler/09_celebration/flower_garland.png +0 -0
  106. package/workspace/public/pm/adler/09_celebration/gift.png +0 -0
  107. package/workspace/public/pm/adler/09_celebration/lantern_pair.png +0 -0
  108. package/workspace/public/pm/adler/09_celebration/moon_cloud.png +0 -0
  109. package/workspace/public/pm/adler/09_celebration/pumpkin.png +0 -0
  110. package/workspace/public/pm/adler/09_celebration/soccer_ball.png +0 -0
  111. package/workspace/public/pm/adler/09_celebration/string_lights.png +0 -0
  112. package/workspace/public/pm/adler/09_celebration/umbrella.png +0 -0
  113. package/workspace/public/pm/adler/10_marks/attention_marks.png +0 -0
  114. package/workspace/public/pm/adler/10_marks/gold_heart.png +0 -0
  115. package/workspace/public/pm/adler/10_marks/gold_sparkles.png +0 -0
  116. package/workspace/public/pm/adler/10_marks/gold_star.png +0 -0
  117. package/workspace/public/pm/adler/10_marks/question_mark.png +0 -0
  118. package/workspace/public/pm/adler/10_marks/sleep_curls.png +0 -0
  119. package/workspace/public/pm/adler/manifest.json +2668 -0
  120. package/workspace/public/pm/cozy-adler.css +5 -5
  121. package/workspace/public/pm/cozy-adler.js +194 -414
  122. package/workspace/public/pm/cozy-settings.js +2 -2
  123. package/workspace/run-tests.js +47 -5
  124. package/workspace/server.js +5 -2
  125. package/workspace/test-lists/adler-png-art.json +10 -0
@@ -1,11 +1,12 @@
1
- /* pm/cozy-adler.js — Adler, Claude's face in PMOS (feedback batch 16 item 2; canvas "Adler · Claude's face in PMOS", frames AdSystem, AdSheet,
2
- * AdSoft, AdMotion, AdB1-3, AdP1-6, AdH1-8, AdU1-9, AdM1-5; spec adler-character/ADLER-SYSTEM.md). Wawan's own art: a Shiba in a green hoodie
3
- * with a sprout, drawn soft 3D (SVG gradients) with slow, small motion.
1
+ /* pm/cozy-adler.js — Adler, Claude's face in PMOS (feedback batch 16 item 2; spec adler-character/ADLER-SYSTEM.md). Wawan's own art, since
2
+ * 2026-10-29 the blue Adler: 103 PNGs (512 px, RGBA) in pm/adler/<category>/<name>.png, listed in pm/adler/manifest.json. Each drawing is still
3
+ * an inline <svg class="ad-svg ...">, so every page's CSS and every selector keeps working; the SVG now holds <image>s of the PNGs, and a
4
+ * charm is a PNG placed over the figure.
4
5
  *
5
6
  * One module draws him everywhere, so every surface shows the same Adler:
6
- * adler(mood, size, o) the S face (24 px), the M face (36-48 px, default 40) or the L figure (110-170 px, default 140) as inline SVG
7
- * adlerScene(kind, mood, o) the XL scene: morning, tea, win, think, rain, night (first run, after 22:00, start-up, errors)
8
- * adlerPeek() his ears over the floating button when one call needs the PM (AdP6)
7
+ * adler(mood, size, o) the S face (24 px), the M face (36-48 px, default 40) or the L figure (110-170 px, default 140)
8
+ * adlerScene(kind, mood, o) the XL scene: morning, tea, win, think, rain, night, plain (first run, after 22:00, start-up, errors)
9
+ * adlerPeek() his top over the floating button when one call needs the PM (AdP6)
9
10
  * moodOfText(t) the mood of a sentence Claude already says: honest when it failed, handled otherwise (AdM1-4 toasts)
10
11
  * mountToastFaces(doc) every #toast gets the S face in the mood of its words
11
12
  * prefs(), loadPrefs(), savePref(key, value) Settings > Adler (AdM5): adler.amount, adler.motion, adler.celebrate, adler.quiet
@@ -17,8 +18,7 @@
17
18
  * one Adler per screen; never inside data (rows, bars, charts, KR rows, reports, connector lists); he never replaces a row's dot or box;
18
19
  * Adlerian words (thanks for contribution, no praise, no points, no streaks, no blame); the mood is never happier than the data. All motion
19
20
  * stops under prefers-reduced-motion and under Settings > Adler > Motion: Still. Off draws the plain mood dot; Face only drops the figures
20
- * and scenes. Colours are the --ad-* tokens in cozy.css: this file names classes, never a colour. Each drawing has its own id prefix, so
21
- * two Adlers on one page never share a gradient. Pure string builders, so a unit test can read them. */
21
+ * and scenes. Pure string builders, so a unit test can read them. */
22
22
 
23
23
  const CSS = new URL('./cozy-adler.css', import.meta.url).href;
24
24
  const TOKENS = new URL('./cozy.css', import.meta.url).href;
@@ -31,401 +31,176 @@ const moodOf = (m) => (INNER[m] ? m : 'handled');
31
31
  let seq = 0;
32
32
  const nextId = () => 'ad' + (++seq).toString(36);
33
33
 
34
- /* ── the art (ported from adler-character/adler.py and soft.py) ── */
35
- const F = (k) => `adf-${k}`, S = (k) => `ads-${k}`;
36
- const L_FUR = 'rgba(170,100,30,.22)', L_CREAM = 'rgba(170,130,80,.18)', L_HOOD = 'rgba(50,75,25,.35)', L_LEAF = 'rgba(80,120,40,.35)';
37
-
38
- function defs(p) {
39
- const rg = (id, cx, cy, r, stops) => `<radialGradient id="${p}${id}" gradientUnits="userSpaceOnUse" cx="${cx}" cy="${cy}" r="${r}">${stops.map(([o, k]) => `<stop offset="${o}" class="adg-${k}"/>`).join('')}</radialGradient>`;
40
- return '<defs>' + rg('f', 78, 58, 190, [[0, 'f0'], [0.45, 'f1'], [1, 'f2']]) + rg('c', 86, 104, 80, [[0, 'c0'], [0.7, 'c1'], [1, 'c2']])
41
- + rg('h', 78, 166, 100, [[0, 'h0'], [0.55, 'h1'], [1, 'h2']]) + rg('l', 96, 4, 44, [[0, 'l0'], [1, 'l1']])
42
- + `<filter id="${p}b" x="-50%" y="-50%" width="200%" height="200%"><feGaussianBlur stdDeviation="3.5"/></filter></defs>`;
43
- }
44
- /* Your impact (batch 16 item 7, GmA1Home, GmA2Board): the leaves on the sprout are the ONLY leaf in PMOS. grow is the word GET /api/impact/week
45
- * gives (rest, bud, leaf, full): the stem grows taller and carries more leaves. No number is drawn or said. o.growNew plays one grow on the
46
- * newest leaf (a real event, once). */
47
- const GROW = { rest: { top: 22, side: [] }, bud: { top: 16, side: [[24, 'l']] }, leaf: { top: 8, side: [[14, 'l']] }, full: { top: -20, side: [[14, 'l'], [0, 'r'], [-14, 'l']] } };
48
- export const GROWS = Object.freeze(Object.keys(GROW));
49
- function sprout(m, p, grow, growNew) {
50
- const rot = { calm: 0, joy: -8, think: 10, ask: -4, worry: 30, rest: 16 }[m];
51
- const g = m === 'worry' ? GROW.rest : GROW[grow] || GROW.rest, T = g.top;
52
- let l1 = `M100 ${T} C 88 ${T - 16}, 70 ${T - 14}, 66 ${T - 4} C 74 ${T + 4}, 90 ${T + 6}, 100 ${T}Z`, l2 = `M100 ${T} C 112 ${T - 18}, 132 ${T - 16}, 136 ${T - 6} C 128 ${T + 4}, 110 ${T + 6}, 100 ${T}Z`;
53
- if (m === 'worry') { l1 = 'M100 22 C 90 12, 74 14, 70 24 C 80 30, 94 30, 100 22Z'; l2 = 'M100 22 C 106 30, 118 40, 130 38 C 130 28, 116 18, 100 22Z'; }
54
- const leaf = (d, c = '') => `<path d="${d}" fill="url(#${p}l)" stroke="${L_LEAF}" stroke-width="2" stroke-linejoin="round"${c ? ` class="${c}"` : ''}/>`;
55
- const side = ([y, s], i, all) => leaf(s === 'l' ? `M100 ${y} C 90 ${y - 12}, 76 ${y - 10}, 74 ${y - 4} C 82 ${y + 2}, 92 ${y + 2}, 100 ${y}Z` : `M100 ${y} C 110 ${y - 12}, 124 ${y - 10}, 126 ${y - 4} C 118 ${y + 2}, 108 ${y + 2}, 100 ${y}Z`, growNew && i === all.length - 1 ? 'ad-gw' : '');
56
- return `<g class="ad-sp"><g transform="rotate(${rot} 100 36)"><path d="M100 38 L100 ${T}" fill="none" stroke="${L_LEAF}" stroke-width="4" stroke-linecap="round"/>${g.side.map(side).join('')}${leaf(l1)}${leaf(l2)}`
57
- + `<path d="M100 ${T} C 92 ${T - 4}, 82 17, 74 18" fill="none" stroke="${L_LEAF}" stroke-width="1.2" opacity=".6"/><path d="M100 ${T} C 110 ${T - 5}, 120 15, 128 16" fill="none" stroke="${L_LEAF}" stroke-width="1.2" opacity=".6"/></g></g>`;
58
- }
59
- const mirror = (d) => { let x = true; return d.replace(/[MCZ]|-?\d+\.?\d*/g, (t) => { if (/[MCZ]/.test(t)) { x = true; return t; } const v = Number(t); const o = x ? String(200 - v) : String(v); x = !x; return ' ' + o; }); };
60
- function ears(m, p) {
61
- const down = m === 'worry' || m === 'rest';
62
- const L = down ? 'M46 70 C 34 50, 34 34, 40 26 C 56 30, 72 44, 82 56Z' : 'M44 66 C 38 44, 40 24, 50 12 C 64 20, 78 36, 86 50Z';
63
- const Li = down ? 'M50 64 C 44 50, 44 40, 47 35 C 58 40, 66 48, 72 55Z' : 'M50 60 C 46 44, 48 32, 53 24 C 62 32, 70 40, 76 50Z';
64
- return [[L, Li], [mirror(L), mirror(Li)]].map(([a, b]) => `<path d="${a}" fill="url(#${p}f)" stroke="${L_FUR}" stroke-width="3" stroke-linejoin="round"/><path d="${b}" class="${F('pink')}"/>`).join('');
65
- }
66
- function face(m, p) {
67
- let s = '';
68
- const brow = (x) => `<ellipse cx="${x}" cy="${m === 'ask' ? 66 : 72}" rx="8" ry="5" fill="url(#${p}c)"/>`;
69
- s += m === 'worry' ? `<path d="M66 72 L82 68" class="${S('cream')}" stroke-width="7" stroke-linecap="round"/><path d="M134 72 L118 68" class="${S('cream')}" stroke-width="7" stroke-linecap="round"/>` : brow(76) + brow(124);
70
- s += '<g class="ad-ey">';
71
- if (m === 'joy') s += `<path d="M66 96 Q76 84 86 96" fill="none" class="${S('ink')}" stroke-width="4.5" stroke-linecap="round"/><path d="M114 96 Q124 84 134 96" fill="none" class="${S('ink')}" stroke-width="4.5" stroke-linecap="round"/>`;
72
- else if (m === 'rest') s += `<path d="M67 94 Q76 100 85 94" fill="none" class="${S('ink')}" stroke-width="4" stroke-linecap="round"/><path d="M115 94 Q124 100 133 94" fill="none" class="${S('ink')}" stroke-width="4" stroke-linecap="round"/>`;
73
- else {
74
- const [dx, dy] = { think: [3, -3], worry: [0, 1] }[m] || [0, 0], r = m === 'worry' ? 10 : 11;
75
- for (const cx of [76, 124]) s += `<circle cx="${cx + dx}" cy="${93 + dy}" r="${r}" class="${F('ink')}"/><circle cx="${cx + dx + 3}" cy="${89 + dy}" r="3.6" class="${F('white')}"/><circle cx="${cx + dx - 3}" cy="${97 + dy}" r="1.6" class="${F('white')}" opacity=".8"/>`;
76
- }
77
- if (m === 'think') s += `<circle cx="78" cy="92" r="17" fill="none" class="${S('glass')}" stroke-width="3"/><circle cx="122" cy="92" r="17" fill="none" class="${S('glass')}" stroke-width="3"/><path d="M95 92 Q100 88 105 92" fill="none" class="${S('glass')}" stroke-width="3"/>`;
78
- s += '</g>';
79
- const op = m === 'worry' ? '.35' : '.75';
80
- s += `<ellipse cx="58" cy="114" rx="11" ry="7" class="${F('blush')}" opacity="${op}" filter="url(#${p}b)"/><ellipse cx="142" cy="114" rx="11" ry="7" class="${F('blush')}" opacity="${op}" filter="url(#${p}b)"/>`;
81
- s += `<path d="M93 106 Q100 102 107 106 Q106 112 100 113 Q94 112 93 106Z" class="${F('ink')}"/>`;
82
- if (m === 'joy') s += `<path d="M88 117 Q100 113 112 117 Q112 134 100 135 Q88 134 88 117Z" class="${F('mouth')}"/><path d="M92 128 Q100 122 108 128 Q106 135 100 135 Q94 135 92 128Z" class="${F('tongue')}"/>`;
83
- else if (m === 'ask') s += `<path d="M91 117 Q100 115 109 117 Q108 128 100 129 Q92 128 91 117Z" class="${F('mouth')}"/><path d="M94 125 Q100 121 106 125 Q104 129 100 129 Q96 129 94 125Z" class="${F('tongue')}"/>`;
84
- else if (m === 'think') s += `<path d="M100 113 L100 118" class="${S('ink')}" stroke-width="2.6" stroke-linecap="round"/><ellipse cx="100" cy="122" rx="3.5" ry="3" class="${F('mouth')}"/>`;
85
- else if (m === 'worry') s += `<path d="M100 113 L100 118" class="${S('ink')}" stroke-width="2.6" stroke-linecap="round"/><path d="M89 125 Q100 119 111 125" fill="none" class="${S('ink')}" stroke-width="2.8" stroke-linecap="round"/>`;
86
- else s += `<path d="M100 113 L100 118 M100 118 Q94 124 88 119 M100 118 Q106 124 112 119" fill="none" class="${S('ink')}" stroke-width="2.8" stroke-linecap="round" stroke-linejoin="round"/>`;
87
- return s;
88
- }
89
- function head(m, p, prop, grow, growNew) {
90
- let h = sprout(m, p, grow, growNew) + ears(m, p);
91
- h += `<path d="M28 98 C 28 54, 60 32, 100 32 C 140 32, 172 54, 172 98 C 172 138, 140 156, 100 156 C 60 156, 28 138, 28 98Z" fill="url(#${p}f)" stroke="${L_FUR}" stroke-width="3"/>`;
92
- h += `<ellipse cx="74" cy="56" rx="30" ry="14" class="${F('white')}" opacity=".35" filter="url(#${p}b)"/><path d="M40 120 C 50 150, 150 150, 160 120 C 150 160, 50 160, 40 120Z" class="${F('shade')}" opacity=".12" filter="url(#${p}b)"/>`;
93
- h += `<path d="M36 108 C 44 92, 70 92, 100 102 C 130 92, 156 92, 164 108 C 162 140, 136 154, 100 154 C 64 154, 38 140, 36 108Z" fill="url(#${p}c)"/>`;
94
- h += face(m, p);
95
- // AdH5: headphones while a meeting records
96
- if (prop === 'headphones') h += `<path d="M34 96 C 30 36, 170 36, 166 96" fill="none" class="${S('hp')}" stroke-width="8" stroke-linecap="round"/><rect x="20" y="82" width="20" height="34" rx="9" class="${F('hp')}"/><rect x="160" y="82" width="20" height="34" rx="9" class="${F('hp')}"/>`;
97
- return h;
98
- }
99
- const capsule = (x1, y1, x2, y2, w, p) => `<path d="M${x1} ${y1} L${x2} ${y2}" stroke="${L_HOOD}" stroke-width="${w + 5}" stroke-linecap="round" fill="none"/><path d="M${x1} ${y1} L${x2} ${y2}" stroke="url(#${p}h)" stroke-width="${w}" stroke-linecap="round" fill="none"/>`;
100
- const paw = (x, y, p, r = 12) => `<circle cx="${x}" cy="${y}" r="${r}" fill="url(#${p}c)" stroke="${L_CREAM}" stroke-width="2.5"/>`;
101
- const POSES = {
102
- joy: [[[62, 172], [30, 124]], [[138, 172], [170, 124]]], think: [[[62, 176], [54, 214]], [[136, 174], [118, 140]]],
103
- ask: [[[62, 176], [54, 214]], [[138, 172], [162, 128]]], worry: [[[64, 178], [86, 206]], [[136, 178], [114, 206]]],
34
+ /* ── the art: PNGs from pm/adler/ ──
35
+ * ART lists every PNG as name: [category folder, x0, y0, x1, y1], the box of its solid pixels in the 512 px file (from manifest.json's
36
+ * strong_alpha_bbox). put() places a PNG by that box, so a charm lands where it is meant to whatever the empty margin of its file. */
37
+ const BASE = new URL('./adler/manifest.json', import.meta.url).href.slice(0, -'manifest.json'.length); // the folder, named by a file the packed app serves
38
+ const ART = {
39
+ handled:['01_expressions',30,41,501,485],celebrating:['01_expressions',42,43,486,477],thinking:['01_expressions',36,40,498,475],
40
+ needs_you:['01_expressions',32,44,495,483],honest:['01_expressions',36,43,495,478],resting:['01_expressions',50,54,486,469],
41
+ honest_full_figure:['02_moments',54,54,480,462],headphones_listening:['02_moments',51,55,492,463],headphones_resting:['02_moments',44,46,486,467],
42
+ headphones_honest:['02_moments',28,34,501,486],hello_wave:['02_moments',50,55,502,462],tea_mug:['02_moments',46,45,485,459],
43
+ morning_stretch:['02_moments',14,54,503,461],peeking_up:['02_moments',37,179,503,512],leaf_tips_peeking:['02_moments',28,337,488,512],
44
+ sprout_none:['03_growth_activity',35,38,501,480],sprout_small:['03_growth_activity',42,51,492,483],sprout_medium:['03_growth_activity',61,30,474,484],
45
+ sprout_large:['03_growth_activity',48,34,490,482],clipboard:['03_growth_activity',53,52,477,462],telescope:['03_growth_activity',46,92,492,447],
46
+ laptop_alert:['03_growth_activity',55,57,478,469],laptop_resting:['03_growth_activity',50,53,479,472],sun:['04_weather_leaves',42,46,469,467],
47
+ cloud_large:['04_weather_leaves',25,105,488,422],cloud_medium:['04_weather_leaves',37,118,487,422],cloud_small:['04_weather_leaves',44,106,476,417],
48
+ crescent_stars:['04_weather_leaves',70,94,475,424],rain_cloud:['04_weather_leaves',58,67,454,471],leaf_green:['04_weather_leaves',73,57,474,467],
49
+ leaf_orange:['04_weather_leaves',88,61,424,451],leaf_pink:['04_weather_leaves',77,66,435,446],planet_smooth:['05_space',45,106,482,416],
50
+ planet_cloud:['05_space',52,104,479,409],planet_crater:['05_space',41,99,484,428],planet_glass:['05_space',43,90,486,421],
51
+ satellite:['05_space',32,120,495,416],rocket_idle:['05_space',92,47,427,471],rocket_liftoff:['05_space',134,30,381,481],
52
+ rocket_flying:['05_space',40,52,473,474],lunar_ground:['05_space',46,109,477,412],satellite_dish:['05_space',101,43,440,479],
53
+ deciduous_forest:['06_landscapes',54,85,459,459],pine_forest:['06_landscapes',49,66,468,473],snow_mountains:['06_landscapes',34,93,479,457],
54
+ desert_large:['06_landscapes',37,114,485,439],beach:['06_landscapes',15,90,497,446],lake:['06_landscapes',31,94,482,435],
55
+ snow_forest:['06_landscapes',31,87,485,459],desert_small:['06_landscapes',40,134,472,413],floating_island_large:['06_landscapes',35,115,480,424],
56
+ floating_island_small:['06_landscapes',64,126,448,437],party_hat_multicolor:['07_wearables',90,62,426,471],
57
+ party_hat_blue:['07_wearables',94,41,436,482],beanie_red:['07_wearables',61,35,451,480],beanie_blue:['07_wearables',74,49,440,471],
58
+ hard_hat:['07_wearables',37,81,483,414],astronaut_helmet:['07_wearables',52,62,459,442],straw_hat:['07_wearables',25,103,490,432],
59
+ pencil:['07_wearables',80,63,461,479],yellow_flowers:['07_wearables',68,33,464,478],headband:['07_wearables',44,150,469,391],
60
+ scarf_blue_white:['07_wearables',78,97,457,455],scarf_red_white:['07_wearables',45,65,477,475],scarf_yellow:['07_wearables',61,67,480,462],
61
+ scarf_blue:['07_wearables',46,66,475,483],scarf_black_white:['07_wearables',69,104,454,452],scarf_green_white:['07_wearables',44,82,487,469],
62
+ scarf_green_red:['07_wearables',45,89,492,476],mandarins:['08_food_festival',54,118,472,425],red_lantern:['08_food_festival',87,18,421,491],
63
+ heart_mug:['08_food_festival',80,106,461,416],ketupat:['08_food_festival',147,21,365,491],pie:['08_food_festival',46,110,469,419],
64
+ egg:['08_food_festival',113,83,398,442],watering_can:['08_food_festival',27,128,488,428],lotus:['08_food_festival',31,68,486,448],
65
+ zongzi:['08_food_festival',62,73,457,444],apple:['08_food_festival',71,42,446,466],mooncake:['08_food_festival',34,55,478,457],
66
+ pinwheel:['08_food_festival',81,32,437,484],diya:['08_food_festival',72,101,443,436],tangyuan:['08_food_festival',48,109,464,440],
67
+ cooking_pot:['08_food_festival',45,93,467,443],popcorn:['08_food_festival',75,52,442,470],cupcake:['08_food_festival',94,38,424,473],
68
+ pumpkin:['09_celebration',53,68,459,436],gift:['09_celebration',51,61,462,467],soccer_ball:['09_celebration',62,62,450,450],
69
+ clapperboard:['09_celebration',62,53,467,483],umbrella:['09_celebration',56,54,468,458],bunting:['09_celebration',9,164,503,340],
70
+ string_lights:['09_celebration',18,163,494,364],flower_garland:['09_celebration',7,146,506,375],fireworks:['09_celebration',48,46,471,466],
71
+ lantern_pair:['09_celebration',53,28,470,486],moon_cloud:['09_celebration',70,84,456,466],gold_star:['10_marks',61,75,451,440],
72
+ gold_heart:['10_marks',56,96,456,419],question_mark:['10_marks',106,49,407,478],attention_marks:['10_marks',77,89,430,403],
73
+ sleep_curls:['10_marks',135,105,394,436],gold_sparkles:['10_marks',82,105,460,430],
104
74
  };
105
- function body(p) {
106
- let s = `<g class="ad-tl"><path d="M140 222 C 172 226, 186 196, 172 182 C 160 172, 146 186, 156 196 C 164 204, 152 214, 140 210Z" fill="url(#${p}f)" stroke="${L_FUR}" stroke-width="3" stroke-linejoin="round"/><path d="M168 186 C 176 194, 172 206, 164 210" fill="none" class="${S('creamhi')}" stroke-width="6" stroke-linecap="round"/></g>`;
107
- for (const x of [78, 122]) s += `<rect x="${x - 14}" y="214" width="28" height="26" rx="12" fill="url(#${p}f)" stroke="${L_FUR}" stroke-width="3"/><ellipse cx="${x}" cy="240" rx="17" ry="8" fill="url(#${p}c)" stroke="${L_CREAM}" stroke-width="2.5"/>`;
108
- s += `<path d="M58 160 C 50 182, 50 210, 56 224 C 70 232, 130 232, 144 224 C 150 210, 150 182, 142 160 Z" fill="url(#${p}h)" stroke="${L_HOOD}" stroke-width="3" stroke-linejoin="round"/>`;
109
- s += `<path d="M74 198 C 74 192, 126 192, 126 198 L 128 218 C 110 222, 90 222, 72 218Z" class="${F('hoodd')}" opacity=".45"/><path d="M100 186 C 94 180, 94 172, 100 168 C 106 172, 106 180, 100 186Z" class="${F('hoodl')}"/>`;
110
- s += `<path d="M50 150 C 60 170, 140 170, 150 150 C 140 160, 60 160, 50 150Z" class="${F('hoodd')}"/>`;
111
- return s;
112
- }
113
- const strings = (p) => `<path d="M90 160 L88 182" class="${S('creamhi')}" stroke-width="3" stroke-linecap="round"/><circle cx="88" cy="184" r="3" fill="url(#${p}c)"/><path d="M110 160 L112 182" class="${S('creamhi')}" stroke-width="3" stroke-linecap="round"/><circle cx="112" cy="184" r="3" fill="url(#${p}c)"/>`;
114
- const mug = () => `<rect x="86" y="190" width="30" height="30" rx="7" class="${F('mug')}" stroke="${L_HOOD}" stroke-width="2.5"/><path d="M116 197 C 125 197, 125 212, 116 212" fill="none" stroke="${L_HOOD}" stroke-width="3"/><path d="M101 198 C 95 204, 97 212, 101 214 C 105 212, 107 204, 101 198Z" class="${F('mugleaf')}"/>`;
115
- const sparkles = () => [[26, 60, 7], [176, 52, 6], [20, 150, 5], [182, 150, 5]].map(([x, y, r]) => `<path d="M${x} ${y - r} L${x + r * 0.3} ${y - r * 0.3} L${x + r} ${y} L${x + r * 0.3} ${y + r * 0.3} L${x} ${y + r} L${x - r * 0.3} ${y + r * 0.3} L${x - r} ${y} L${x - r * 0.3} ${y - r * 0.3}Z" class="${F('gold')}"/>`).join('');
116
- // c: the charm he wears ({ ch, colors }, dressed() below), or nothing
117
- function full(m, p, prop, c) {
118
- let g = body(p);
119
- if (m === 'calm' || m === 'rest') {
120
- const held = c && c.ch.held ? c.ch.held(c.colors) : '';
121
- g += head(m, p, prop) + strings(p) + capsule(64, 176, 80, 206, 22, p) + capsule(136, 176, 122, 206, 22, p) + paw(82, 210, p, 9) + paw(120, 210, p, 9) + (held || mug());
122
- return g + wear(m, prop, c);
123
- }
124
- if (m === 'joy') g += sparkles();
125
- g += head(m, p, prop) + strings(p) + POSES[m].map(([a, b]) => capsule(a[0], a[1], b[0], b[1], 22, p) + paw(b[0], b[1], p)).join('');
126
- // AdU4: a magnifier in the raised paw when nothing is found; otherwise "needs you" holds up one card with a tick
127
- if (m === 'ask' && prop === 'magnifier') g += `<path d="M150 118 L140 132" class="${S('glass')}" stroke-width="6" stroke-linecap="round"/><circle cx="162" cy="104" r="17" class="${F('lens')} ${S('glass')}" stroke-width="5"/>` + paw(146, 128, p);
128
- else if (m === 'ask') g += `<g transform="rotate(10 168 110)"><rect x="152" y="88" width="34" height="40" rx="6" class="${F('white')} ${S('cardline')}" stroke-width="2"/><path d="M160 106 l5 5 l10 -11" fill="none" class="${S('tick')}" stroke-width="3.2" stroke-linecap="round" stroke-linejoin="round"/></g>` + paw(162, 128, p);
129
- return g + wear(m, prop, c);
130
- }
131
-
132
- /* ── Adler dressed for the season (feedback batch 18 item 8-B; canvas frames AsMoods, AsPlaces, AsSet2Tap, AsC_*; ported from
133
- * adler-character/seasons-b/charms.py). A charm is what he wears or holds on a festival, a season or a day of his own: a head charm, a neck
134
- * charm, a held charm (in place of the mug when he is handled or resting), one at his feet, and the scene around him. A festival changes what
135
- * he wears, never his mood. The rules by mood: honest takes the charm off and the scene goes plain; needs you keeps the charm on a plain
136
- * scene, so the ask leads; resting wears it in the night scene. By size: the S face never wears one, the M face wears head charms only, the
137
- * L figure and the XL scene wear all of it. A charm never covers his eyes, mouth or sprout. Colours are the --ad-k-* tokens in cozy.css
138
- * (adk- a fill, adks- a stroke); a scene's sky and ground are --ad-<key>0, --ad-<key>1 and --ad-<key>g. No flags, no religious dress, no
139
- * team, league, film or brand marks. ── */
140
- const K = (k) => `adk-${k}`, KS = (k) => `adks-${k}`;
75
+ /** The PNG's own address, or '' for a name PMOS does not have. */
76
+ export const artUrl = (name) => (ART[name] ? `${BASE}${ART[name][0]}/${name}.png` : '');
77
+ export const ART_NAMES = Object.freeze(Object.keys(ART));
141
78
  const r1 = (v) => Math.round(v * 10) / 10;
142
79
  const tw = (i) => (i % 3 ? ' d' + (i % 3 + 1) : '');
80
+ /* One PNG in an SVG. (x, y): where its anchor lands. w (or o.h): the width (height) its solid pixels get. o: { ax, ay (the anchor inside the
81
+ * solid pixels, 0-1, default the middle), rot (degrees about the anchor), op, cls } */
82
+ function put(name, x, y, w, o = {}) {
83
+ const a = ART[name]; if (!a) return '';
84
+ const bw = a[3] - a[1], bh = a[4] - a[2], s = o.h ? o.h / bh : w / bw, ax = o.ax == null ? 0.5 : o.ax, ay = o.ay == null ? 0.5 : o.ay;
85
+ return `<image href="${artUrl(name)}" x="${r1(x - (a[1] + ax * bw) * s)}" y="${r1(y - (a[2] + ay * bh) * s)}" width="${r1(512 * s)}" height="${r1(512 * s)}" decoding="async"`
86
+ + `${o.rot ? ` transform="rotate(${o.rot} ${r1(x)} ${r1(y)})"` : ''}${o.op ? ` opacity="${o.op}"` : ''}${o.cls ? ` class="${o.cls}"` : ''}/>`;
87
+ }
88
+ /** A whole PNG file, edge to edge, in a 512 square (the figure and the face). */
89
+ const whole = (name, cls) => `<image href="${artUrl(name)}" x="0" y="0" width="512" height="512" decoding="async"${cls ? ` class="${cls}"` : ''}/>`;
90
+ const F = (k) => `adf-${k}`, S = (k) => `ads-${k}`;
143
91
 
144
- // head charms (head coordinates: the same on the M face and the L figure)
145
- const partyHat = (c1 = 'gold15', c2 = 'orange1') => `<g transform="rotate(24 128 40)"><path d="M114 46 L128 4 L142 46 Z" class="${K(c1)}"/><path d="M118 34 L138 34 M121 24 L135 24 M124 14 L132 14" class="${KS(c2)}" stroke-width="3.2" stroke-linecap="round"/>`
146
- + `<path d="M114 46 L128 4 L124 46Z" class="${K('white')}" opacity=".18"/><ellipse cx="128" cy="46" rx="15" ry="4" class="${K('gold18')}"/><circle cx="128" cy="4" r="5.5" class="${K(c2)}"/></g>`;
147
- const beanie = (c = 'red7', band = 'paper2', pom = 'paper2') => `<path d="M40 66 C 42 30, 158 30, 160 66 Z" class="${K(c)}"/><path d="M58 44 C 70 36, 86 33, 96 33" class="${KS('white')}" stroke-width="5" opacity=".22" fill="none" stroke-linecap="round"/>`
148
- + `<path d="M70 42 L70 60 M86 37 L86 60 M114 37 L114 60 M130 42 L130 60" stroke="rgba(0,0,0,.08)" stroke-width="3"/><rect x="36" y="56" width="128" height="14" rx="7" class="${K(band)}"/><circle cx="146" cy="34" r="10" class="${K(pom)}"/>`;
149
- const helmet = () => `<circle cx="100" cy="92" r="88" class="${K('paper3')}" opacity=".16"/><circle cx="100" cy="92" r="88" fill="none" class="${KS('blue1')}" stroke-width="5"/>`
150
- + `<path d="M38 52 C 52 26, 80 12, 108 12" class="${KS('white')}" stroke-width="7" fill="none" stroke-linecap="round" opacity=".7"/><path d="M150 150 C 160 140, 168 126, 172 112" class="${KS('white')}" stroke-width="4" fill="none" stroke-linecap="round" opacity=".45"/>`
151
- + `<path d="M36 156 C 70 176, 130 176, 164 156 L 160 170 C 128 188, 72 188, 40 170Z" class="${K('paper7')} ${KS('blue4')}" stroke-width="2"/>`;
152
- const sunHat = () => `<ellipse cx="100" cy="50" rx="86" ry="15" class="${K('gold12')}"/><path d="M58 50 C 60 22, 140 22, 142 50 Z" class="${K('gold9')}"/><path d="M58 46 C 80 52, 120 52, 142 46 L142 50 C 120 56, 80 56, 58 50Z" class="${K('green3')}"/>`
153
- + `<path d="M24 52 C 60 62, 140 62, 176 52" class="${KS('gold16')}" stroke-width="2" fill="none" opacity=".6"/>`;
154
- const hardHat = () => `<path d="M46 62 C 48 30, 152 30, 154 62 Z" class="${K('gold14')}"/><path d="M96 32 L104 32 L104 62 L96 62Z" class="${K('gold17')}"/><rect x="36" y="58" width="128" height="10" rx="5" class="${K('gold17')}"/>`
155
- + `<path d="M62 44 C 70 38, 82 35, 90 35" class="${KS('white')}" stroke-width="4" opacity=".35" fill="none" stroke-linecap="round"/>`;
156
- const headband = (c = 'blue10') => `<path d="M34 64 C 60 50, 140 50, 166 64 L 166 76 C 140 62, 60 62, 34 76Z" class="${K(c)}"/><path d="M40 66 C 64 56, 136 56, 160 66" class="${KS('white')}" stroke-width="2" opacity=".5" fill="none"/>`;
157
- const pencil = () => `<g transform="rotate(-38 150 62)"><rect x="128" y="57" width="44" height="9" rx="2" class="${K('gold14')}"/><path d="M172 57 L182 61.5 L172 66Z" class="${K('gold9')}"/><path d="M178 59.6 L182 61.5 L178 63.4Z" class="${K('brown4')}"/>`
158
- + `<rect x="122" y="57" width="7" height="9" rx="2" class="${K('orange1')}"/></g>`;
159
- const mimosa = () => `<path d="M52 58 C 42 46, 36 36, 34 26" class="${KS('green3')}" stroke-width="2.5" fill="none"/>` + [[34, 26], [40, 32], [31, 34], [44, 40], [37, 44], [47, 48]].map(([x, y]) => `<circle cx="${x}" cy="${y}" r="4.5" class="${K('gold14')}"/>`).join('');
160
-
161
- // neck charms
162
- function scarf(c1, c2, chequer) {
163
- let s = `<path d="M46 148 C 70 170, 130 170, 154 148 L 156 162 C 130 186, 70 186, 44 162Z" class="${K(c1)}"/><path d="M62 166 L 58 206 C 64 208, 72 208, 78 206 L 80 170Z" class="${K(c1)}"/>`;
164
- if (c2 && !chequer) s += `<path d="M48 154 C 72 174, 128 174, 152 154" class="${KS(c2)}" stroke-width="4" fill="none"/><path d="M60 190 L 79 190 M59 198 L 78 198" class="${KS(c2)}" stroke-width="3.5"/>`;
165
- if (chequer) {
166
- for (let i = 0; i < 5; i++) for (let j = 0; j < 3; j++) if ((i + j) % 2 === 0) s += `<rect x="${r1(59 + j * 6.5)}" y="${172 + i * 7}" width="6.5" height="7" class="${K(c2)}"/>`;
167
- for (let i = 0; i < 12; i += 2) s += `<rect x="${52 + i * 8}" y="${r1(160 + Math.abs(6 - i) * 0.6)}" width="8" height="7" class="${K(c2)}" opacity=".9"/>`;
168
- }
169
- return s + `<path d="M58 206 L 57 212 M64 207 L 64 213 M71 207 L 71 213 M77 206 L 78 212" class="${KS(c1)}" stroke-width="2.5" stroke-linecap="round"/>`;
170
- }
171
-
172
- // held charms (figure coordinates: in the paws, where the mug is)
173
- const diya = () => `<ellipse class="env-glow ${K('amber1')}" cx="101" cy="192" rx="16" ry="18" opacity=".55"/><path d="M82 206 C 85 222, 117 222, 120 206 Z" class="${K('orange4')}"/><ellipse cx="101" cy="206" rx="19" ry="5" class="${K('brown1')}"/>`
174
- + `<path d="M118 205 L127 201 L121 208Z" class="${K('orange4')}"/><path d="M88 214 C 96 217, 106 217, 114 214" class="${KS('gold14')}" stroke-width="2" fill="none"/>`
175
- + `<path d="M101 184 C 95 193, 96 201, 101 204 C 106 201, 107 193, 101 184Z" class="${K('amber3')}"/><path d="M101 191 C 99 196, 99 200, 101 202 C 103 200, 103 196, 101 191Z" class="${K('gold1')}"/>`;
176
- const mooncake = () => Array.from({ length: 10 }, (_, a) => `<circle cx="${r1(101 + 16 * Math.cos(a * Math.PI / 5))}" cy="${r1(205 + 16 * Math.sin(a * Math.PI / 5))}" r="4" class="${K('amber9')}"/>`).join('')
177
- + `<circle cx="101" cy="205" r="16" class="${K('amber6')}"/><circle cx="101" cy="205" r="11" fill="none" class="${KS('amber10')}" stroke-width="2"/>`
178
- + `<path d="M95 205 C 98 199, 104 199, 107 205 C 104 211, 98 211, 95 205Z" class="${K('amber10')}" opacity=".7"/><ellipse cx="95" cy="198" rx="6" ry="3" class="${K('white')}" opacity=".25"/>`;
179
- const mandarins = () => [[90, 208], [112, 210]].map(([cx, cy]) => `<circle cx="${cx}" cy="${cy}" r="11.5" class="${K('amber4')}"/><ellipse cx="${cx - 4}" cy="${cy - 5}" rx="4" ry="2.5" class="${K('white')}" opacity=".35"/>`
180
- + `<path d="M${cx} ${cy - 11} c 4 -6 10 -6 12 -3 c -4 3 -8 4 -12 3z" class="${K('green7')}"/>`).join('');
181
- const stickLantern = (c = 'red6') => `<path d="M118 212 L150 148" class="${KS('brown2')}" stroke-width="3" stroke-linecap="round"/><path d="M150 148 L156 140" class="${KS('brown2')}" stroke-width="2"/>`
182
- + `<ellipse class="env-glow ${K('amber1')}" cx="158" cy="152" rx="22" ry="20" opacity=".45"/><ellipse cx="158" cy="152" rx="16" ry="14" class="${K(c)}"/><path d="M146 146 C 154 142, 162 142, 170 146" class="${KS('gold14')}" stroke-width="1.6" fill="none" opacity=".8"/>`
183
- + `<path d="M158 138 L158 166 M150 140 C 146 150, 146 156, 150 164 M166 140 C 170 150, 170 156, 166 164" class="${KS('red10')}" stroke-width="1.4" fill="none"/>`
184
- + `<rect x="152" y="136" width="12" height="4" rx="1" class="${K('gold15')}"/><rect x="152" y="164" width="12" height="4" rx="1" class="${K('gold15')}"/><path d="M158 168 L158 178" class="${KS('gold15')}" stroke-width="2"/>`;
185
- const ketupat = (x = 101, y = 204, s = 1) => `<g transform="translate(${x} ${y}) scale(${s}) rotate(45)"><rect x="-13" y="-13" width="26" height="26" rx="3" class="${K('green1')}"/>`
186
- + `<path d="M-13 -4 L13 -4 M-13 5 L13 5 M-4 -13 L-4 13 M5 -13 L5 13" class="${KS('green6')}" stroke-width="2.4"/><path d="M-13 -13 L-6 -13 L-13 -6Z" class="${K('white')}" opacity=".25"/></g>`
187
- + `<path d="M${r1(x + 14 * s)} ${r1(y + 12 * s)} q 6 10 2 18 M${r1(x + 10 * s)} ${r1(y + 16 * s)} q 2 10 -4 16" class="${KS('green1')}" stroke-width="${r1(3 * s)}" fill="none" stroke-linecap="round"/>`;
188
- function lotus(x = 101, y = 206, s = 1, glow = true) {
189
- let g = glow ? `<ellipse class="env-glow ${K('gold6')}" cx="${x}" cy="${r1(y - 6 * s)}" rx="${r1(20 * s)}" ry="${r1(16 * s)}" opacity=".5"/>` : '';
190
- g += `<ellipse cx="${x}" cy="${r1(y + 8 * s)}" rx="${r1(19 * s)}" ry="${r1(5 * s)}" class="${K('green3')}"/>`;
191
- const b = r1(y + 6 * s);
192
- for (const a of [-60, -30, 0, 30, 60]) g += `<path transform="rotate(${a} ${x} ${b})" d="M${x} ${b} C ${r1(x - 8 * s)} ${r1(y - 4 * s)}, ${r1(x - 5 * s)} ${r1(y - 14 * s)}, ${x} ${r1(y - 18 * s)} C ${r1(x + 5 * s)} ${r1(y - 14 * s)}, ${r1(x + 8 * s)} ${r1(y - 4 * s)}, ${x} ${b}Z" class="${K(a ? 'red1' : 'red2')} ${KS('red3')}" stroke-width="1"/>`;
193
- return g;
194
- }
195
- const popcorn = () => [[90, 192], [100, 187], [110, 191], [95, 182], [106, 181], [86, 186], [115, 185]].map(([x, y]) => `<circle cx="${x}" cy="${y}" r="7" class="${K('paper8')}"/>`).join('')
196
- + `<path d="M85 196 L117 196 L112 224 L90 224 Z" class="${K('white')}"/>` + [88, 98.5, 109].map((x) => `<path d="M${x} 196 L${r1(x + 1.2)} 224 L${r1(x + 6.5)} 224 L${r1(x + 5.6)} 196Z" class="${K('red6')}"/>`).join('');
197
- const egg = () => `<ellipse cx="101" cy="204" rx="13" ry="16" class="${K('blue3')}"/><path d="M88 204 l5 -5 l5 5 l5 -5 l5 5 l5 -5 l1 2" class="${KS('red2')}" stroke-width="3" fill="none" stroke-linejoin="round"/>`
198
- + `<path d="M89 211 C 96 214, 106 214, 113 211" class="${KS('gold14')}" stroke-width="2.4" fill="none"/><ellipse cx="96" cy="196" rx="4" ry="6" class="${K('white')}" opacity=".35"/>`;
199
- const zongzi = () => `<path d="M86 218 L101 188 L116 218 Z" class="${K('green4')} ${KS('green8')}" stroke-width="2" stroke-linejoin="round"/>`
200
- + `<path d="M94 202 L108 202 M90 210 L112 210" class="${KS('amber7')}" stroke-width="2.4"/><path d="M101 188 L96 218" class="${KS('green8')}" stroke-width="1.4" opacity=".6"/>`;
201
- const pie = (x = 101, y = 206) => `<path d="M${x - 18} ${y + 8} L${x + 16} ${y + 8} L${x + 12} ${y - 6} Z" class="${K('amber2')}"/><path d="M${x - 18} ${y + 8} L${x + 12} ${y - 6} L${x + 16} ${y + 8}" fill="none" class="${KS('amber8')}" stroke-width="3" stroke-linejoin="round"/>`
202
- + `<path d="M${x - 14} ${y + 6} L${x + 12} ${y - 3}" class="${KS('orange6')}" stroke-width="2" opacity=".6"/>`;
203
- const wateringCan = () => `<path d="M84 196 L112 196 L114 222 L82 222Z" class="${K('blue8')}"/><path d="M112 200 L132 186 L134 190 L114 208Z" class="${K('blue8')}"/>`
204
- + `<ellipse cx="134" cy="187" rx="4" ry="5" class="${K('blue11')}"/><path d="M86 196 C 86 182, 110 182, 110 196" class="${KS('blue11')}" stroke-width="4" fill="none"/><ellipse cx="92" cy="203" rx="4" ry="6" class="${K('white')}" opacity=".3"/>`;
205
- const pinwheel = () => `<path d="M101 222 L101 182" class="${KS('brown2')}" stroke-width="3" stroke-linecap="round"/>`
206
- + [[0, 'orange1'], [90, 'green2'], [180, 'blue10'], [270, 'gold14']].map(([a, c]) => `<path transform="rotate(${a} 101 178)" d="M101 178 L101 160 L115 172 Z" class="${K(c)}"/>`).join('') + `<circle cx="101" cy="178" r="3" class="${K('white')}"/>`;
207
- const apple = () => `<path d="M101 194 C 90 186, 82 196, 85 208 C 88 220, 96 222, 101 218 C 106 222, 114 220, 117 208 C 120 196, 112 186, 101 194Z" class="${K('red6')}"/>`
208
- + `<path d="M101 194 L103 184" class="${KS('brown3')}" stroke-width="2.4" stroke-linecap="round"/><path d="M103 188 c 6 -6 12 -4 13 -1 c -5 3 -9 3 -13 1z" class="${K('green3')}"/><ellipse cx="92" cy="200" rx="3.5" ry="5" class="${K('white')}" opacity=".3"/>`;
209
- const cupcake = () => `<path d="M88 206 L114 206 L110 222 L92 222Z" class="${K('red2')}"/><path d="M92 206 L93 222 M98 206 L98.5 222 M104 206 L103.5 222 M110 206 L109 222" class="${KS('red3')}" stroke-width="1.6"/>`
210
- + `<path d="M86 207 C 84 196, 94 192, 101 194 C 108 192, 118 196, 116 207 Z" class="${K('paper2')}"/><rect x="99.5" y="182" width="3" height="12" rx="1" class="${K('blue10')}"/>`
211
- + `<ellipse class="env-glow ${K('amber1')}" cx="101" cy="178" rx="6" ry="7" opacity=".6"/><path d="M101 172 C 98 176, 99 180, 101 181 C 103 180, 104 176, 101 172Z" class="${K('amber3')}"/>`;
212
- const heartMug = () => `<rect x="86" y="190" width="30" height="30" rx="7" class="${K('red3')}"/><path d="M116 197 C 125 197, 125 212, 116 212" fill="none" class="${KS('red4')}" stroke-width="3"/>`
213
- + `<path d="M101 213 C 92 206, 93 199, 97 199 C 99 199, 100.5 200.5, 101 202 C 101.5 200.5, 103 199, 105 199 C 109 199, 110 206, 101 213Z" class="${K('white')}"/>`;
214
- const ricePot = () => `<path d="M84 202 C 82 222, 120 222, 118 202 Z" class="${K('orange4')}"/><ellipse cx="101" cy="202" rx="17" ry="5" class="${K('brown1')}"/>`
215
- + `<path d="M86 200 C 88 188, 96 192, 98 196 C 100 186, 110 188, 110 196 C 114 190, 120 196, 116 202Z" class="${K('paper1')}"/><path d="M86 210 C 96 214, 106 214, 116 210" class="${KS('gold14')}" stroke-width="2.4" fill="none"/>`;
216
- const tangyuan = () => `<path d="M84 204 C 86 222, 116 222, 118 204 Z" class="${K('white')} ${KS('gold10')}" stroke-width="2"/><ellipse cx="101" cy="204" rx="17" ry="4.5" class="${K('gold2')}"/>`
217
- + `<circle cx="94" cy="203" r="5" class="${K('white')}"/><circle cx="104" cy="202" r="5" class="${K('red1')}"/><circle cx="110" cy="205" r="4" class="${K('white')}"/><path d="M90 212 L112 212" class="${KS('blue10')}" stroke-width="1.6" opacity=".6"/>`;
218
-
219
- // charms at his feet (any mood that keeps the charm)
220
- const football = (x = 162, y = 232, r = 13) => `<circle cx="${x}" cy="${y}" r="${r}" class="${K('white')} ${KS('paper11')}" stroke-width="1.5"/><path d="M${x} ${y - 5} l5 3.6 l-1.9 5.9 h-6.2 l-1.9 -5.9z" class="${K('ink1')}"/>`
221
- + `<path d="M${x} ${y - 5} L${x} ${y - r} M${x + 5} ${r1(y - 1.4)} L${x + r - 1} ${y - 4} M${r1(x + 3.1)} ${r1(y + 4.5)} L${x + 7} ${y + r - 3} M${r1(x - 3.1)} ${r1(y + 4.5)} L${x - 7} ${y + r - 3} M${x - 5} ${r1(y - 1.4)} L${x - r + 1} ${y - 4}" class="${KS('ink1')}" stroke-width="1.3"/>`
222
- + `<ellipse cx="${x - 4}" cy="${y - 6}" rx="4" ry="2.5" class="${K('white')}" opacity=".7"/>`;
223
- const gift = (x = 36, y = 222) => `<rect x="${x - 14}" y="${y}" width="28" height="22" rx="4" class="${K('red7')}"/><rect x="${x - 16}" y="${y - 6}" width="32" height="8" rx="3" class="${K('red5')}"/>`
224
- + `<rect x="${x - 3}" y="${y - 6}" width="6" height="28" class="${K('gold14')}"/><path d="M${x} ${y - 6} c -10 -10 -16 -2 -10 1 M${x} ${y - 6} c 10 -10 16 -2 10 1" class="${KS('gold14')}" stroke-width="3" fill="none" stroke-linecap="round"/>`;
225
- const pumpkin = (x = 36, y = 228) => `<ellipse class="env-glow ${K('amber1')}" cx="${x}" cy="${y}" rx="22" ry="18" opacity=".35"/><ellipse cx="${x}" cy="${y}" rx="18" ry="14" class="${K('orange2')}"/>`
226
- + `<path d="M${x - 7} ${y - 13} C ${x - 12} ${y - 4}, ${x - 12} ${y + 6}, ${x - 7} ${y + 13} M${x + 7} ${y - 13} C ${x + 12} ${y - 4}, ${x + 12} ${y + 6}, ${x + 7} ${y + 13}" class="${KS('orange5')}" stroke-width="2" fill="none"/>`
227
- + `<path d="M${x} ${y - 14} L${x + 2} ${y - 20}" class="${KS('green7')}" stroke-width="3" stroke-linecap="round"/><circle cx="${x - 6}" cy="${y - 3}" r="2.6" class="${K('gold7')}"/><circle cx="${x + 6}" cy="${y - 3}" r="2.6" class="${K('gold7')}"/>`
228
- + `<path d="M${x - 7} ${y + 4} Q${x} ${y + 10} ${x + 7} ${y + 4}" class="${KS('gold7')}" stroke-width="2.4" fill="none" stroke-linecap="round"/>`;
229
- const umbrella = (x = 30, y = 244) => `<g transform="rotate(-12 ${x} ${y})"><path d="M${x} ${y} L${x} ${y - 74}" class="${KS('grey3')}" stroke-width="3"/>`
230
- + `<path d="M${x - 7} ${y - 20} C ${x - 6} ${y - 50}, ${x - 3} ${y - 66}, ${x} ${y - 74} C ${x + 3} ${y - 66}, ${x + 6} ${y - 50}, ${x + 7} ${y - 20} Z" class="${K('blue10')}"/><path d="M${x} ${y - 74} L${x + 1} ${y - 20}" class="${KS('blue13')}" stroke-width="1.4" opacity=".6"/>`
231
- + `<path d="M${x} ${y} q 0 8 -7 8 q -6 0 -6 -6" class="${KS('grey3')}" stroke-width="3" fill="none" stroke-linecap="round"/></g>`;
232
- const clapper = (x = 34, y = 224) => `<rect x="${x - 16}" y="${y}" width="32" height="22" rx="3" class="${K('ink1')}"/><g transform="rotate(-16 ${x - 16} ${y})"><rect x="${x - 16}" y="${y - 8}" width="32" height="8" rx="2" class="${K('ink1')}"/>`
233
- + Array.from({ length: 4 }, (_, i) => `<path d="M${x - 12 + i * 8} ${y - 8} l5 0 l-3 8 l-5 0z" class="${K('white')}"/>`).join('') + '</g>'
234
- + `<path d="M${x - 12} ${y + 8} L${x + 12} ${y + 8} M${x - 12} ${y + 14} L${x + 6} ${y + 14}" class="${KS('white')}" stroke-width="1.6" opacity=".7"/>`;
235
-
236
- // the scenes' parts (scene coordinates: W wide, H high, the ground line at gy)
237
- const grassS = (x, y, s = 1, d = '') => `<g class="env-sway${d}"><path d="M${r1(x)} ${y} q -3 -${r1(14 * s)} -9 -${r1(20 * s)} M${r1(x)} ${y} q 1 -${r1(18 * s)} 4 -${r1(24 * s)} M${r1(x)} ${y} q 4 -${r1(10 * s)} 11 -${r1(15 * s)}" class="${S('grass')}" stroke-width="2.4" fill="none" stroke-linecap="round"/></g>`;
238
- const hang = (x, top, len, inner) => `<g class="env-hang"><path d="M${r1(x)} ${top} L${r1(x)} ${top + len}" class="${KS('brown2')}" stroke-width="1.6"/>${inner}</g>`;
239
- const lanternRound = (x, y, r = 14, c = 'red6') => `<ellipse class="env-glow ${K('amber1')}" cx="${r1(x)}" cy="${y}" rx="${r1(r * 1.5)}" ry="${r1(r * 1.4)}" opacity=".35"/><ellipse cx="${r1(x)}" cy="${y}" rx="${r}" ry="${r1(r * 0.88)}" class="${K(c)}"/>`
240
- + `<rect x="${r1(x - r * 0.45)}" y="${r1(y - r * 0.98)}" width="${r1(r * 0.9)}" height="${r1(r * 0.24)}" rx="1" class="${K('gold15')}"/><rect x="${r1(x - r * 0.45)}" y="${r1(y + r * 0.75)}" width="${r1(r * 0.9)}" height="${r1(r * 0.24)}" rx="1" class="${K('gold15')}"/>`
241
- + `<path d="M${r1(x)} ${y + r} L${r1(x)} ${r1(y + r * 1.6)}" class="${KS('gold15')}" stroke-width="2"/>`
242
- + `<path d="M${r1(x - r * 0.55)} ${r1(y - r * 0.7)} C ${r1(x - r * 0.85)} ${r1(y - r * 0.2)}, ${r1(x - r * 0.85)} ${r1(y + r * 0.2)}, ${r1(x - r * 0.55)} ${r1(y + r * 0.7)} M${r1(x + r * 0.55)} ${r1(y - r * 0.7)} C ${r1(x + r * 0.85)} ${r1(y - r * 0.2)}, ${r1(x + r * 0.85)} ${r1(y + r * 0.2)}, ${r1(x + r * 0.55)} ${r1(y + r * 0.7)}" stroke="rgba(0,0,0,.15)" stroke-width="1.2" fill="none"/>`;
243
- const lanternCny = (x, y, s = 1) => { x = r1(x); return `<ellipse class="env-glow ${K('amber1')}" cx="${x}" cy="${y}" rx="${r1(30 * s)}" ry="${r1(24 * s)}" opacity=".3"/><rect x="${r1(x - 8 * s)}" y="${r1(y - 22 * s)}" width="${r1(16 * s)}" height="${r1(5 * s)}" rx="1" class="${K('gold18')}"/><ellipse cx="${x}" cy="${y}" rx="${r1(22 * s)}" ry="${r1(18 * s)}" class="${K('red6')}"/>`
244
- + `<path d="M${r1(x - 10 * s)} ${r1(y - 16 * s)} C ${r1(x - 18 * s)} ${r1(y - 6 * s)}, ${r1(x - 18 * s)} ${r1(y + 6 * s)}, ${r1(x - 10 * s)} ${r1(y + 16 * s)} M${r1(x + 10 * s)} ${r1(y - 16 * s)} C ${r1(x + 18 * s)} ${r1(y - 6 * s)}, ${r1(x + 18 * s)} ${r1(y + 6 * s)}, ${r1(x + 10 * s)} ${r1(y + 16 * s)} M${x} ${r1(y - 18 * s)} L${x} ${r1(y + 18 * s)}" class="${KS('red8')}" stroke-width="${r1(1.6 * s)}" fill="none"/>`
245
- + `<rect x="${r1(x - 8 * s)}" y="${r1(y + 16 * s)}" width="${r1(16 * s)}" height="${r1(5 * s)}" rx="1" class="${K('gold18')}"/>`
246
- + `<path d="M${r1(x - 4 * s)} ${r1(y + 21 * s)} L${r1(x - 5 * s)} ${r1(y + 34 * s)} M${x} ${r1(y + 21 * s)} L${x} ${r1(y + 36 * s)} M${r1(x + 4 * s)} ${r1(y + 21 * s)} L${r1(x + 5 * s)} ${r1(y + 34 * s)}" class="${KS('gold15')}" stroke-width="${r1(1.6 * s)}"/>`; };
247
- const blossom = (x, y, r = 5, c = 'red1') => Array.from({ length: 5 }, (_, a) => `<circle cx="${r1(x + r * Math.cos(a * 2 * Math.PI / 5))}" cy="${r1(y + r * Math.sin(a * 2 * Math.PI / 5))}" r="${r1(r * 0.75)}" class="${K(c)}"/>`).join('') + `<circle cx="${r1(x)}" cy="${r1(y)}" r="${r1(r * 0.45)}" class="${K('gold15')}"/>`;
248
- const pelita = (x, y, s = 1) => { x = r1(x); y = r1(y); return `<ellipse class="env-glow ${K('amber1')}" cx="${x}" cy="${r1(y - 8 * s)}" rx="${r1(9 * s)}" ry="${r1(11 * s)}" opacity=".55"/><path d="M${r1(x - 6 * s)} ${y} L${r1(x + 6 * s)} ${y} L${r1(x + 4 * s)} ${r1(y - 6 * s)} L${r1(x - 4 * s)} ${r1(y - 6 * s)}Z" class="${K('amber7')}"/>`
249
- + `<path d="M${x} ${r1(y - 15 * s)} C ${r1(x - 3 * s)} ${r1(y - 10 * s)}, ${r1(x - 3 * s)} ${r1(y - 7 * s)}, ${x} ${r1(y - 6 * s)} C ${r1(x + 3 * s)} ${r1(y - 7 * s)}, ${r1(x + 3 * s)} ${r1(y - 10 * s)}, ${x} ${r1(y - 15 * s)}Z" class="${K('amber3')}"/>`; };
250
- const smallDiya = (x, y, s = 1) => { x = r1(x); y = r1(y); return `<ellipse class="env-glow ${K('amber1')}" cx="${x}" cy="${r1(y - 9 * s)}" rx="${r1(10 * s)}" ry="${r1(12 * s)}" opacity=".55"/><path d="M${r1(x - 9 * s)} ${r1(y - 3 * s)} C ${r1(x - 7 * s)} ${r1(y + 4 * s)}, ${r1(x + 7 * s)} ${r1(y + 4 * s)}, ${r1(x + 9 * s)} ${r1(y - 3 * s)}Z" class="${K('orange4')}"/>`
251
- + `<path d="M${x} ${r1(y - 14 * s)} C ${r1(x - 3 * s)} ${r1(y - 9 * s)}, ${r1(x - 3 * s)} ${r1(y - 5 * s)}, ${x} ${r1(y - 4 * s)} C ${r1(x + 3 * s)} ${r1(y - 5 * s)}, ${r1(x + 3 * s)} ${r1(y - 9 * s)}, ${x} ${r1(y - 14 * s)}Z" class="${K('amber3')}"/>`; };
252
- // the crescent is a moon with the sky's own colour laid over it (bg: the sky's top colour)
253
- const crescent = (x, y, r, bg) => `<circle cx="${r1(x)}" cy="${y}" r="${r}" class="${K('gold4')}"/><circle cx="${r1(x + r * 0.45)}" cy="${r1(y - r * 0.25)}" r="${r1(r * 0.9)}" class="${K(bg)}"/>`;
254
- const stars = (pts, c = 'gold4') => pts.map(([x, y, r], i) => `<circle class="env-tw${tw(i)} ${K(c)}" cx="${r1(x)}" cy="${r1(y)}" r="${r}"/>`).join('');
255
- function stringLights(W, y, cols, sag = 16) {
256
- let s = `<path d="M0 ${y} Q ${r1(W / 4)} ${y + sag} ${r1(W / 2)} ${y} Q ${r1(3 * W / 4)} ${y + sag} ${r1(W)} ${y}" class="${KS('grey3')}" stroke-width="1.4" fill="none" opacity=".6"/>`;
257
- for (let i = 1; i < 14; i++) { const t = i / 14, l = (t * 2) % 1; s += `<circle class="env-tw${tw(i)} ${K(cols[i % cols.length])}" cx="${r1(W * t)}" cy="${r1(y + sag * 4 * l * (1 - l) * 0.5 + 4)}" r="4"/>`; }
258
- return s;
259
- }
260
- function bunting(W, y, cols, sag = 14) {
261
- let s = `<path d="M0 ${y} Q ${r1(W / 2)} ${y + sag * 2} ${r1(W)} ${y}" class="${KS('brown2')}" stroke-width="1.2" fill="none" opacity=".5"/>`;
262
- for (let i = 0; i < 16; i++) { const t = (i + 0.5) / 16, x = W * t, yy = y + sag * 4 * t * (1 - t); s += `<path d="M${r1(x - 9)} ${r1(yy)} L${r1(x + 9)} ${r1(yy)} L${r1(x)} ${r1(yy + 16)}Z" class="${K(cols[i % cols.length])}"/>`; }
263
- return s;
264
- }
265
- const burst = (x, y, r, c, d = '') => `<g class="env-tw${d}">` + Array.from({ length: 12 }, (_, a) => { const an = a * Math.PI / 6; return `<path d="M${r1(x + r * 0.35 * Math.cos(an))} ${r1(y + r * 0.35 * Math.sin(an))} L${r1(x + r * Math.cos(an))} ${r1(y + r * Math.sin(an))}" class="${KS(c)}" stroke-width="2.4" stroke-linecap="round"/>`; }).join('') + '</g>';
266
- function marigoldGarland(W, y) {
267
- let s = '';
268
- for (let k = 0; k < 4; k++) for (let i = 0; i < 9; i++) { const t = i / 8, x = W * k / 4 + (W / 4) * t; s += `<circle cx="${r1(x)}" cy="${r1(y + 72 * t * (1 - t))}" r="5" class="${K(i % 2 ? 'amber4' : 'gold14')}"/>`; }
269
- return s;
270
- }
271
- function rangoli(x, y, r = 40) {
272
- x = r1(x);
273
- let s = `<ellipse cx="${x}" cy="${y}" rx="${r}" ry="${r1(r * 0.32)}" class="${K('red2')}" opacity=".85"/><ellipse cx="${x}" cy="${y}" rx="${r1(r * 0.75)}" ry="${r1(r * 0.24)}" class="${K('gold14')}"/>`
274
- + `<ellipse cx="${x}" cy="${y}" rx="${r1(r * 0.5)}" ry="${r1(r * 0.16)}" class="${K('blue10')}" opacity=".8"/><ellipse cx="${x}" cy="${y}" rx="${r1(r * 0.22)}" ry="${r1(r * 0.07)}" class="${K('white')}"/>`;
275
- for (let a = 0; a < 8; a++) { const an = a * Math.PI / 4; s += `<ellipse cx="${r1(x + r * 0.88 * Math.cos(an))}" cy="${r1(y + r * 0.28 * Math.sin(an))}" rx="${r1(r * 0.09)}" ry="${r1(r * 0.05)}" class="${K('green2')}"/>`; }
276
- return s;
277
- }
278
- const tree = (x, gy, c = 'amber5', c2 = 'orange5') => `<path d="M${r1(x)} ${gy} L${r1(x)} ${gy - 70}" class="${KS('brown2')}" stroke-width="8" stroke-linecap="round"/><circle cx="${r1(x)}" cy="${gy - 86}" r="34" class="${K(c)}"/><circle cx="${r1(x - 24)}" cy="${gy - 70}" r="22" class="${K(c2)}"/><circle cx="${r1(x + 24)}" cy="${gy - 72}" r="22" class="${K(c)}"/>`;
279
- const maple = (x, y, c, rot = 0, s = 1) => `<g transform="translate(${r1(x)} ${r1(y)}) rotate(${r1(rot)}) scale(${s})"><path d="M0 -10 L3 -4 L9 -6 L6 0 L10 3 L3 3 L2 9 L0 6 L-2 9 L-3 3 L-10 3 L-6 0 L-9 -6 L-3 -4Z" class="${K(c)}"/></g>`;
280
- const evergreen = (x, gy, s = 1) => { x = r1(x); return `<rect x="${r1(x - 4 * s)}" y="${r1(gy - 14 * s)}" width="${r1(8 * s)}" height="${r1(14 * s)}" class="${K('brown2')}"/>`
281
- + `<path d="M${x} ${r1(gy - 94 * s)} L${r1(x + 26 * s)} ${r1(gy - 50 * s)} L${r1(x + 14 * s)} ${r1(gy - 50 * s)} L${r1(x + 34 * s)} ${r1(gy - 14 * s)} L${r1(x - 34 * s)} ${r1(gy - 14 * s)} L${r1(x - 14 * s)} ${r1(gy - 50 * s)} L${r1(x - 26 * s)} ${r1(gy - 50 * s)}Z" class="${K('grey4')}"/>`
282
- + `<path d="M${x} ${r1(gy - 104 * s)} l3 7 l7 0 l-6 4 l2 7 l-6 -4 l-6 4 l2 -7 l-6 -4 l7 0z" class="${K('gold14')}"/>`
283
- + stars([[x - 10 * s, gy - 40 * s, 2.6], [x + 12 * s, gy - 30 * s, 2.6], [x + 2 * s, gy - 62 * s, 2.6], [x - 18 * s, gy - 22 * s, 2.6]], 'orange1'); };
284
- const note = (x, y, d = '', c = 'violet1') => { x = r1(x); return `<g class="env-tw${d}"><path d="M${x} ${y} L${x} ${y - 18} L${r1(x + 12)} ${y - 22} L${r1(x + 12)} ${y - 4}" class="${KS(c)}" stroke-width="2.4" fill="none"/><ellipse cx="${r1(x - 3)}" cy="${y}" rx="4.5" ry="3.5" class="${K(c)}"/><ellipse cx="${r1(x + 9)}" cy="${y - 4}" rx="4.5" ry="3.5" class="${K(c)}"/></g>`; };
285
- function goal(x, gy, w = 90, h = 56) {
286
- x = r1(x);
287
- let s = `<path d="M${x} ${gy} L${x} ${gy - h} L${r1(x + w)} ${gy - h} L${r1(x + w)} ${gy}" class="${KS('white')}" stroke-width="5" fill="none" stroke-linejoin="round"/>`;
288
- for (let i = 1; i < 6; i++) s += `<path d="M${r1(x + w * i / 6)} ${gy - h} L${r1(x + w * i / 6)} ${gy}" class="${KS('white')}" stroke-width="1" opacity=".55"/>`;
289
- for (let i = 1; i < 4; i++) s += `<path d="M${x} ${r1(gy - h * i / 4)} L${r1(x + w)} ${r1(gy - h * i / 4)}" class="${KS('white')}" stroke-width="1" opacity=".55"/>`;
290
- return s;
291
- }
292
- const curtains = (W, H) => `<path d="M0 0 L${r1(W * 0.16)} 0 C ${r1(W * 0.12)} ${r1(H * 0.3)}, ${r1(W * 0.14)} ${r1(H * 0.6)}, ${r1(W * 0.1)} ${H} L0 ${H}Z" class="${K('red9')}"/>`
293
- + `<path d="M${W} 0 L${r1(W * 0.84)} 0 C ${r1(W * 0.88)} ${r1(H * 0.3)}, ${r1(W * 0.86)} ${r1(H * 0.6)}, ${r1(W * 0.9)} ${H} L${W} ${H}Z" class="${K('red9')}"/>`
294
- + [0.05, 0.1, 0.9, 0.95].map((f) => `<path d="M${r1(W * f)} 0 C ${r1(W * f - 6)} ${r1(H * 0.4)}, ${r1(W * f + 4)} ${r1(H * 0.7)}, ${r1(W * f - 4)} ${H}" class="${KS('red11')}" stroke-width="2" fill="none"/>`).join('');
295
- const CONF = ['gold15', 'orange1', 'blue10', 'green2'];
296
- const confetti = (W, gy, n = 26) => Array.from({ length: n }, (_, i) => { const x = Math.round((i * 97) % Math.floor(W * 0.9) + W * 0.05), y = Math.round(gy + 4 + (i * 37) % 22); return `<rect x="${x}" y="${y}" width="6" height="3" rx="1" class="${K(CONF[i % 4])}" transform="rotate(${(i * 53) % 180} ${x} ${y})"/>`; }).join('');
297
- const streamers = (W) => ['gold15', 'orange1', 'blue10'].map((c, k) => { const y = 18 + k * 10; return `<path d="M0 ${y} Q ${r1(W * 0.25)} ${y + 24} ${r1(W * 0.5)} ${y + 4} T ${W} ${y + 8}" class="${KS(c)}" stroke-width="3" fill="none" opacity=".8"/>`; }).join('');
298
- const waves = (W, y, c = 'teal1') => [0, 1, 2].map((i) => `<path d="M0 ${y + i * 12} q ${r1(W / 16)} -8 ${r1(W / 8)} 0` + ` t ${r1(W / 8)} 0`.repeat(7) + `" class="${KS(c)}" stroke-width="2.4" fill="none" opacity="${r1(0.9 - i * 0.25)}"/>`).join('');
299
- const boat = (x, y, s = 1) => { x = r1(x); return `<path d="M${r1(x - 46 * s)} ${y} L${r1(x + 46 * s)} ${y} L${r1(x + 36 * s)} ${r1(y + 8 * s)} L${r1(x - 36 * s)} ${r1(y + 8 * s)}Z" class="${K('red7')}" opacity=".8"/>`
300
- + `<path d="M${r1(x + 46 * s)} ${y} q 8 -6 6 -14" class="${KS('red7')}" stroke-width="${r1(3 * s)}" fill="none" opacity=".8"/>`
301
- + Array.from({ length: 7 }, (_, i) => `<circle cx="${r1(x - 34 * s + i * 11 * s)}" cy="${r1(y - 4 * s)}" r="${r1(3 * s)}" class="${K('grey3')}" opacity=".7"/>`).join(''); };
302
- const earth = (x, y, r) => { x = r1(x); return `<circle class="env-glow ${K('blue7')}" cx="${x}" cy="${y}" r="${r1(r * 1.4)}" opacity=".25"/><circle cx="${x}" cy="${y}" r="${r}" class="${K('blue10')}"/>`
303
- + `<path d="M${r1(x - r * 0.6)} ${r1(y - r * 0.3)} c ${r1(r * 0.3)} -${r1(r * 0.3)} ${r1(r * 0.6)} 0 ${r1(r * 0.5)} ${r1(r * 0.3)} c -${r1(r * 0.2)} ${r1(r * 0.3)} -${r1(r * 0.6)} ${r1(r * 0.2)} -${r1(r * 0.5)} -${r1(r * 0.3)}z M${r1(x + r * 0.1)} ${r1(y + r * 0.2)} c ${r1(r * 0.4)} -${r1(r * 0.1)} ${r1(r * 0.6)} ${r1(r * 0.2)} ${r1(r * 0.4)} ${r1(r * 0.5)} c -${r1(r * 0.3)} ${r1(r * 0.1)} -${r1(r * 0.5)} 0 -${r1(r * 0.4)} -${r1(r * 0.5)}z" class="${K('green2')}"/>`; };
304
- const craters = (W, gy) => [[W * 0.12, gy + 16, 16], [W * 0.78, gy + 20, 22], [W * 0.62, gy + 8, 9]].map(([x, y, rx]) => `<ellipse cx="${r1(x)}" cy="${y}" rx="${rx}" ry="${r1(rx * 0.3)}" class="${K('grey1')}"/>`).join('');
305
- const footprints = (x, y) => Array.from({ length: 5 }, (_, i) => `<ellipse cx="${r1(x + i * 16)}" cy="${y + (i % 2 ? 4 : 0)}" rx="5" ry="2.6" class="${K('grey2')}"/>`).join('');
306
- const clouds = (W, c = 'blue2') => `<g class="env-cloud"><ellipse cx="${r1(W * 0.22)}" cy="44" rx="48" ry="16" class="${K(c)}"/><ellipse cx="${r1(W * 0.26)}" cy="34" rx="28" ry="16" class="${K(c)}"/></g><g class="env-cloud"><ellipse cx="${r1(W * 0.74)}" cy="56" rx="40" ry="13" class="${K(c)}" opacity=".8"/></g>`;
307
- const puddle = (x, y) => { x = r1(x); return `<ellipse cx="${x}" cy="${y}" rx="70" ry="9" class="${K('blue5')}" opacity=".7"/><path d="M${r1(x - 40)} ${y} L${r1(x - 20)} ${y} M${r1(x + 6)} ${y + 2} L${r1(x + 30)} ${y + 2}" class="${KS('white')}" stroke-width="2" opacity=".6"/>`; };
308
- const kites = (W) => `<path d="M${r1(W * 0.18)} 40 l14 16 l-14 16 l-14 -16z" class="${K('orange1')}"/><path d="M${r1(W * 0.18)} 72 q 6 16 -2 30" class="${KS('brown2')}" stroke-width="1.4" fill="none"/>`
309
- + `<path d="M${r1(W * 0.82)} 30 l12 14 l-12 14 l-12 -14z" class="${K('blue10')}"/><path d="M${r1(W * 0.82)} 58 q -6 16 2 28" class="${KS('brown2')}" stroke-width="1.4" fill="none"/>`;
310
- const chalkboard = (x, y) => { x = r1(x); return `<rect x="${x}" y="${y}" width="80" height="54" rx="6" class="${K('grey5')} ${KS('amber7')}" stroke-width="5"/><path d="M${r1(x + 14)} ${y + 20} q 14 -8 26 0 M${r1(x + 14)} ${y + 34} L${r1(x + 56)} ${y + 34}" class="${KS('white')}" stroke-width="2" opacity=".6" fill="none"/>`; };
311
- const deskLamp = (x, gy) => { x = r1(x); return `<ellipse class="env-glow ${K('gold6')}" cx="${r1(x + 20)}" cy="${gy - 30}" rx="40" ry="30" opacity=".45"/><path d="M${x} ${gy} L${r1(x + 30)} ${gy}" class="${KS('grey3')}" stroke-width="4" stroke-linecap="round"/>`
312
- + `<path d="M${r1(x + 15)} ${gy} L${r1(x + 5)} ${gy - 34} L${r1(x + 30)} ${gy - 56}" class="${KS('grey3')}" stroke-width="3" fill="none"/><path d="M${r1(x + 22)} ${gy - 62} L${r1(x + 44)} ${gy - 54} L${r1(x + 36)} ${gy - 40}Z" class="${K('blue10')}"/>`; };
313
- function city(W, gy) {
314
- let s = '';
315
- [[30, 60], [22, 90], [36, 50], [26, 110], [40, 70], [24, 84], [34, 56], [28, 100], [38, 64]].forEach(([w, h], i) => {
316
- const x = Math.round(i * W / 9);
317
- s += `<rect x="${x}" y="${gy - h}" width="${w}" height="${h}" class="${K('ink2')}"/>`;
318
- for (let j = 0; j < 3; j++) s += `<rect x="${x + 6}" y="${gy - h + 10 + j * 16}" width="5" height="5" class="${K('gold4')}" opacity=".6"/>`;
319
- });
320
- return s + `<path d="M0 ${gy + 8} Q ${r1(W / 2)} ${gy - 6} ${W} ${gy + 8}" class="${KS('gold14')}" stroke-width="2.5" fill="none" opacity=".6"/><path d="M0 ${gy + 14} Q ${r1(W / 2)} ${gy} ${W} ${gy + 14}" class="${KS('orange1')}" stroke-width="2" fill="none" opacity=".5"/>`;
321
- }
322
- const track = (W, gy) => [0, 1, 2].map((i) => `<path d="M0 ${gy + 6 + i * 9} L${W} ${gy + 6 + i * 9}" class="${KS('white')}" stroke-width="2" opacity=".7"/>`).join('');
323
- function menorahWindow(x, y, lit = 4) {
324
- x = r1(x);
325
- let s = `<rect x="${x}" y="${y}" width="96" height="72" rx="8" class="${K('paper10')} ${KS('blue6')}" stroke-width="3"/><path d="M${r1(x + 16)} ${y + 56} L${r1(x + 80)} ${y + 56} M${r1(x + 48)} ${y + 56} L${r1(x + 48)} ${y + 64} M${r1(x + 38)} ${y + 64} L${r1(x + 58)} ${y + 64}" class="${KS('blue9')}" stroke-width="2.4"/>`;
326
- for (let i = 0; i < 9; i++) {
327
- const cx = r1(x + 16 + i * 8), top = i !== 4 ? y + 36 : y + 30;
328
- s += `<path d="M${cx} ${y + 56} L${cx} ${top}" class="${KS('blue9')}" stroke-width="2.4"/>`;
329
- if (i === 4 || (i < 4 && i >= 4 - Math.floor(lit / 2)) || (i > 4 && i <= 4 + (lit - Math.floor(lit / 2)))) s += `<ellipse cx="${cx}" cy="${top - 4}" rx="2" ry="3.4" class="${K('amber3')}"/>`;
330
- }
331
- return s;
92
+ /* Which PNG is him, by mood (the inner words of INNER), prop and growth. The headphones mean a meeting records; the telescope is the
93
+ * "nothing found" search; a growth word (Your impact's sprout) shows the sprout stage, the face only. */
94
+ const EXPR = { calm: 'handled', joy: 'celebrating', think: 'thinking', ask: 'needs_you', worry: 'honest', rest: 'resting' };
95
+ const GROW = { rest: 'sprout_none', bud: 'sprout_small', leaf: 'sprout_medium', full: 'sprout_large' };
96
+ export const GROWS = Object.freeze(Object.keys(GROW));
97
+ function pose(m, prop, grow) {
98
+ if (prop === 'headphones') return m === 'worry' ? 'headphones_honest' : m === 'rest' ? 'headphones_resting' : 'headphones_listening';
99
+ if (prop === 'magnifier') return 'telescope';
100
+ if (grow && grow !== 'rest' && GROW[grow] && m !== 'worry') return GROW[grow];
101
+ return EXPR[m];
332
102
  }
333
- const sugarcane = (x, gy) => [0, 1].map((i) => { const b = r1(x + i * 8); return `<path d="M${b} ${gy} L${r1(b + 4)} ${gy - 90}" class="${KS('green3')}" stroke-width="5"/><path d="M${r1(b + 4)} ${gy - 90} q -10 -10 -18 -8 M${r1(b + 4)} ${gy - 90} q 10 -12 18 -8" class="${KS('green2')}" stroke-width="3" fill="none"/>`; }).join('');
334
- const petals = (W, gy) => Array.from({ length: 13 }, (_, i) => { const x = Math.round(W * (i + 1) / 14), y = gy + 8 + (i * 7) % 16; return `<ellipse cx="${x}" cy="${y}" rx="4" ry="2.4" class="${K('red1')}" transform="rotate(${(i * 41) % 180} ${x} ${y})"/>`; }).join('');
335
- // snow falls gently in winter only: rain never falls (rain means a source failed), and leaves never fall (falling leaves mean a real win)
336
- const flakes = (pts) => pts.map(([x, y], i) => `<g class="env-snow${i ? ' d' + (i + 1) : ''}"><circle cx="${r1(x)}" cy="${y}" r="3" class="${K('white')}"/></g>`).join('');
337
- const sun = (W, cy, r, glow) => `<circle class="env-glow ${K('amber1')}" cx="${r1(W * 0.84)}" cy="${cy}" r="${glow}" opacity=".7"/><circle cx="${r1(W * 0.84)}" cy="${cy}" r="${r}" class="${K('gold13')}"/>`;
103
+ const sparkles = () => put('gold_sparkles', 92, 96, 150) + put('gold_sparkles', 432, 112, 120, { rot: 12 });
338
104
 
339
- /* the sports colours (Settings › Big sports, two picks): token names, never a hex */
340
- const TEAM = { blue: 'blue10', red: 'red6', white: 'white', gold: 'gold14', green: 'green2', ink: 'ink1' };
341
- const team = (c, i, d) => TEAM[(c || [])[i]] || d;
105
+ /* ── Adler dressed for the season (feedback batch 18 item 8-B; canvas frames AsMoods, AsPlaces, AsSet2Tap, AsC_*). A charm is what he wears or
106
+ * holds on a festival, a season or a day of his own: a head charm, a neck charm, a held charm (in place of nothing when he is handled or resting),
107
+ * one at his feet, and the scene around him. A festival changes what he wears, never his mood. The rules by mood: honest takes the charm off
108
+ * and the scene goes plain; needs you keeps the charm on a plain scene, so the ask leads; resting wears it in the night scene. By size: the S
109
+ * face never wears one, the M face wears head charms only, the L figure and the XL scene wear all of it. A charm never covers his eyes or mouth.
110
+ * A scene's sky and ground are --ad-<key>0, --ad-<key>1 and --ad-<key>g in cozy.css. No flags, no religious dress, no team, league, film or
111
+ * brand marks. ── */
112
+ /* Where a charm sits on the 512 figure, by slot, and per PNG where it needs its own place. */
113
+ const SLOT = {
114
+ head: { x: 272, y: 206, w: 176, ay: 0.9, rot: -4 }, neck: { x: 262, y: 404, w: 250 }, held: { x: 268, y: 414, w: 128 }, feet: { x: 448, y: 440, w: 112, ay: 0.6 },
115
+ aside: { x: 448, y: 436, w: 100, ay: 0.6 },
116
+ };
117
+ const OV = {
118
+ party_hat_blue: { x: 366, y: 176, w: 132, ay: 0.94, rot: 20 }, party_hat_multicolor: { x: 366, y: 176, w: 132, ay: 0.94, rot: 20 },
119
+ pencil: { x: 398, y: 150, w: 138, rot: 38 }, headband: { x: 272, y: 190, w: 210, ay: 0.5, rot: -6 }, yellow_flowers: { x: 372, y: 170, w: 156, ay: 0.6, rot: 0 },
120
+ straw_hat: { y: 172, w: 270, ay: 0.62 }, astronaut_helmet: { x: 268, y: 262, w: 360, ay: 0.5, rot: 0 }, hard_hat: { y: 206, w: 190 },
121
+ beanie_red: { y: 206, w: 176 }, beanie_blue: { y: 206, w: 176 }, umbrella: { x: 452, y: 420, w: 128, ay: 0.6 }, soccer_ball: { x: 446, y: 442, w: 96, ay: 0.6 },
122
+ gift: { x: 446, y: 442, w: 104, ay: 0.6 }, pumpkin: { x: 446, y: 444, w: 108, ay: 0.6 }, clapperboard: { x: 446, y: 438, w: 108, ay: 0.6 },
123
+ };
124
+ const SCARF = { blue: 'scarf_blue_white', red: 'scarf_red_white', white: 'scarf_blue_white', gold: 'scarf_yellow', green: 'scarf_green_white', ink: 'scarf_black_white' };
125
+ const place = (slot, name, extra = {}) => { const d = { ...SLOT[slot], ...OV[name], ...extra }; return put(name, d.x, d.y, d.w, d); };
126
+ /* a scene's things: [name, x as a share of the width, y as a share of the height, solid width, { rot, d (a motion delay), cls }] */
127
+ const things = (W, H, list) => (list || []).map(([n, xf, yf, w, o = {}], i) => { const g = put(n, W * xf, H * yf, w, { rot: o.rot, ay: o.ay, op: o.op }); return o.cls ? `<g class="${o.cls}${o.d || tw(i)}">${g}</g>` : g; }).join('');
128
+ const TWINKLE = 'env-tw', SWAY = 'env-sway', HANG = 'env-hang';
342
129
 
343
- /* The charm table. key → { name, head, neck, held, feet (each a function of the sports colours), back, groundFx, front (functions of W, H, gy),
344
- * grass (false: no tufts), dark (a night sky by day: the greeting's words go light) }. Every key has --ad-<key>0, --ad-<key>1 and --ad-<key>g. */
130
+ /* The charm table. key → { name, head, neck, held, feet (a PNG name, or a function of the sports colours), back, front (things), dark (a night sky
131
+ * by day: the greeting's words go light), grass (false: no tufts) }. Every key has --ad-<key>0, --ad-<key>1 and --ad-<key>g. */
345
132
  const CH = {
346
- newyear: { name: 'New Year', head: () => partyHat(), back: (W) => streamers(W) + sun(W, 70, 18, 30), groundFx: (W, H, gy) => confetti(W, gy) },
347
- cny: { name: 'Chinese New Year', held: mandarins, back: (W, H, gy) => hang(W * 0.14, 0, 38, lanternCny(W * 0.14, 62)) + hang(W * 0.86, 0, 26, lanternCny(W * 0.86, 50, 0.8))
348
- + `<path d="M0 ${gy - 150} C 40 ${gy - 140}, 70 ${gy - 120}, 96 ${gy - 126} M50 ${gy - 140} C 60 ${gy - 160}, 76 ${gy - 166}, 86 ${gy - 168}" class="${KS('brown3')}" stroke-width="4" fill="none" stroke-linecap="round"/>`
349
- + blossom(96, gy - 126) + blossom(86, gy - 168, 4) + blossom(40, gy - 144, 4.5) + blossom(66, gy - 134, 3.6) },
350
- lantern: { name: 'Chap Goh Mei', held: () => stickLantern(), dark: true, back: (W) => `<circle class="env-glow ${K('gold5')}" cx="${r1(W * 0.82)}" cy="56" r="34" opacity=".4"/><circle cx="${r1(W * 0.82)}" cy="56" r="22" class="${K('gold5')}"/>` + stars([[W * 0.1, 30, 2], [W * 0.35, 50, 1.6], [W * 0.6, 26, 2]]) },
351
- valentine: { name: 'Valentine’s Day', held: heartMug, back: (W) => [[W * 0.44, 60, ''], [W * 0.58, 44, ' d2'], [W * 0.52, 26, ' d3']].map(([x, y, d]) => `<g class="env-tw${d}"><path transform="translate(${r1(x)} ${y}) scale(.8)" d="M0 10 C -12 0, -10 -10, -4 -10 C -1 -10, 0 -7, 0 -6 C 0 -7, 1 -10, 4 -10 C 10 -10, 12 0, 0 10Z" class="${K('red2')}"/></g>`).join('') },
352
- ramadan: { name: 'Ramadan evenings', dark: true, back: (W) => crescent(W * 0.8, 56, 20, 'ink3') + stars([[W * 0.15, 40, 2], [W * 0.4, 30, 1.6], [W * 0.62, 62, 1.6]]), front: (W, H, gy) => pelita(W * 0.16, gy + 14) + pelita(W * 0.84, gy + 12) },
353
- raya: { name: 'Hari Raya Puasa', held: () => ketupat(), back: (W) => crescent(W * 0.84, 56, 20, 'paper6') + hang(W * 0.12, 0, 40, ketupat(r1(W * 0.12), 58, 0.9)) + hang(W * 0.22, 0, 22, ketupat(r1(W * 0.22), 40, 0.7)),
354
- front: (W, H, gy) => [0.08, 0.2, 0.8, 0.92].map((f) => pelita(W * f, gy + 18 - Math.abs(0.5 - f) * 10)).join('') },
355
- haji: { name: 'Hari Raya Haji', back: (W) => crescent(W * 0.84, 56, 20, 'paper4'), front: (W, H, gy) => pelita(W * 0.14, gy + 14) + pelita(W * 0.86, gy + 12) },
356
- iwd: { name: 'International Women’s Day', head: mimosa, back: (W) => [[W * 0.1, 60], [W * 0.14, 70], [W * 0.08, 76], [W * 0.88, 50], [W * 0.92, 62]].map(([x, y]) => `<circle cx="${Math.round(x)}" cy="${y}" r="5" class="${K('gold14')}" opacity=".7"/>`).join('') },
357
- pi: { name: 'Pi Day', held: () => pie() },
358
- easter: { name: 'Easter', held: egg, front: (W, H, gy) => [[0.12, 'red1'], [0.18, 'white'], [0.84, 'gold14'], [0.9, 'red1']].map(([f, c]) => blossom(W * f, gy + 14, 5, c)).join('') },
359
- earth: { name: 'Earth Day', held: wateringCan, back: (W) => earth(W * 0.84, 60, 22), front: (W, H, gy) => grassS(W * 0.24, gy + 22, 0.6) + grassS(W * 0.32, gy + 24, 0.5, ' d2') + grassS(W * 0.7, gy + 24, 0.6) + grassS(W * 0.78, gy + 22, 0.5, ' d2') },
360
- labour: { name: 'Labour Day', head: hardHat },
361
- vesak: { name: 'Vesak Day', held: () => lotus(), grass: false, groundFx: (W, H, gy) => `<ellipse cx="${r1(W * 0.16)}" cy="${gy + 18}" rx="30" ry="7" class="${K('green3')}" opacity=".8"/><ellipse cx="${r1(W * 0.84)}" cy="${gy + 22}" rx="26" ry="6" class="${K('green3')}" opacity=".8"/>` + lotus(r1(W * 0.16), gy + 12, 0.7) + lotus(r1(W * 0.84), gy + 16, 0.6) },
362
- dragonboat: { name: 'Dragon Boat Festival', held: zongzi, grass: false, back: (W, H, gy) => boat(W * 0.78, gy - 70, 0.9) + waves(W, gy - 58) },
363
- natday: { name: 'National Day', neck: () => scarf('blue10', 'white'), back: (W) => bunting(W, 8, ['blue10', 'white', 'gold14']) },
364
- moon: { name: 'Moon landing day', head: helmet, dark: true, grass: false, back: (W) => earth(W * 0.16, 64, 24) + stars([[W * 0.4, 30, 2], [W * 0.6, 58, 1.6], [W * 0.74, 24, 2], [W * 0.9, 80, 1.6], [W * 0.3, 96, 1.4]]), groundFx: (W, H, gy) => craters(W, gy) + footprints(W * 0.66, gy + 12) },
365
- ndp: { name: 'National Day', neck: () => scarf('red6', 'white'), dark: true, grass: false, back: (W) => bunting(W, 6, ['red6', 'white']) + burst(W * 0.18, 88, 30, 'orange1') + burst(W * 0.82, 74, 36, 'white', ' d2') + burst(W * 0.66, 120, 20, 'gold14', ' d3') },
366
- teachers: { name: 'Teachers’ Day', held: apple, back: (W, H, gy) => chalkboard(W * 0.74, gy - 120) },
367
- midautumn: { name: 'Mid-Autumn Festival', held: mooncake, dark: true, back: (W) => `<circle class="env-glow ${K('gold5')}" cx="${r1(W * 0.8)}" cy="70" r="52" opacity=".3"/><circle cx="${r1(W * 0.8)}" cy="70" r="38" class="${K('gold5')}"/><circle cx="${r1(W * 0.8 - 10)}" cy="62" r="6" class="${K('gold11')}"/><circle cx="${r1(W * 0.8 + 12)}" cy="80" r="4" class="${K('gold11')}"/>`
368
- + hang(W * 0.12, 0, 46, lanternRound(W * 0.12, 64, 14, 'orange3')) + hang(W * 0.24, 0, 28, lanternRound(W * 0.24, 44, 11, 'red6')) + hang(W * 0.36, 0, 54, lanternRound(W * 0.36, 70, 10, 'gold14')) + stars([[W * 0.5, 30, 1.6], [W * 0.6, 90, 1.4], [W * 0.94, 140, 1.6]]) },
369
- exam: { name: 'Exam season', head: pencil, back: (W, H, gy) => deskLamp(W * 0.76, gy - 18) },
370
- children: { name: 'Children’s Day', held: pinwheel, back: kites },
371
- nightrace: { name: 'The night race', neck: () => scarf('ink1', 'white', true), dark: true, grass: false, back: (W, H, gy) => city(W, gy - 40) + stars([[W * 0.2, 26, 1.6], [W * 0.7, 30, 1.6]]) },
372
- halloween: { name: 'Halloween', feet: () => pumpkin(), dark: true, back: (W) => `<circle cx="${r1(W * 0.82)}" cy="58" r="22" class="${K('gold4')}"/>` + stars([[W * 0.15, 40, 2], [W * 0.4, 30, 1.6], [W * 0.6, 62, 1.6]]) },
373
- deepavali: { name: 'Deepavali', held: diya, dark: true, grass: false, back: (W) => marigoldGarland(W, 0) + stars([[W * 0.2, 70, 1.6], [W * 0.5, 52, 1.6], [W * 0.8, 76, 1.6]]),
374
- groundFx: (W, H, gy) => rangoli(W * 0.2, gy + 18, 46), front: (W, H, gy) => [0.62, 0.74, 0.86, 0.96].map((f) => smallDiya(W * f, gy + 20 - Math.abs(0.5 - f) * 8)).join('') },
375
- thanks: { name: 'Thanksgiving', held: () => pie(), back: (W) => `<circle cx="${r1(W * 0.84)}" cy="80" r="34" fill="none" class="${KS('amber8')}" stroke-width="10"/>` + [[0, 'orange3'], [1.2, 'red6'], [2.4, 'gold14'], [3.6, 'orange3'], [4.8, 'red6']].map(([a, c]) => maple(W * 0.84 + 34 * Math.cos(a), 80 + 34 * Math.sin(a), c, a * 40, 0.9)).join('') },
376
- hanukkah: { name: 'Hanukkah', back: (W) => menorahWindow(W * 0.72, 40, 4) + stringLights(W * 0.6, 12, ['blue10', 'white']) },
377
- christmas: { name: 'Christmas', head: () => beanie(), feet: () => gift(), back: (W, H, gy) => stringLights(W, 10, ['gold14', 'red6', 'green2', 'blue10']) + evergreen(W * 0.86, gy + 10) },
378
- dongzhi: { name: 'Dongzhi', held: tangyuan },
379
- pongal: { name: 'Pongal', held: ricePot, back: (W, H, gy) => sugarcane(W * 0.82, gy + 10), groundFx: (W, H, gy) => `<ellipse cx="${r1(W * 0.2)}" cy="${gy + 18}" rx="40" ry="12" fill="none" class="${KS('white')}" stroke-width="2.4"/><ellipse cx="${r1(W * 0.2)}" cy="${gy + 18}" rx="24" ry="7" fill="none" class="${KS('white')}" stroke-width="2"/>` },
380
- football: { name: 'The football finals', neck: (c) => scarf(team(c, 0, 'blue10'), team(c, 1, 'white')), feet: () => football(), grass: false, back: (W, H, gy) => goal(W * 0.74, gy + 6) + `<path d="M0 ${gy + 16} L${W} ${gy + 16}" class="${KS('white')}" stroke-width="3" opacity=".6"/>` },
381
- games: { name: 'The Games', head: (c) => headband(team(c, 0, 'blue10')), grass: false, groundFx: (W, H, gy) => track(W, gy) },
382
- movie: { name: 'Movie night', held: popcorn, feet: () => clapper(), dark: true, grass: false, back: (W, H) => `<rect x="${r1(W * 0.22)}" y="18" width="${r1(W * 0.56)}" height="${r1(H * 0.36)}" rx="6" class="${K('paper9')}" opacity=".18"/>` + curtains(W, H) },
133
+ newyear: { name: 'New Year', head: 'party_hat_multicolor', back: [['fireworks', 0.2, 0.3, 96, { cls: TWINKLE }], ['fireworks', 0.82, 0.26, 80, { cls: TWINKLE, d: ' d2' }], ['gold_star', 0.5, 0.16, 26, { cls: TWINKLE, d: ' d3' }]] },
134
+ cny: { name: 'Chinese New Year', held: 'mandarins', back: [['lantern_pair', 0.2, 0.2, 96, { cls: HANG }], ['red_lantern', 0.86, 0.2, 54, { cls: HANG, d: ' d2' }]] },
135
+ lantern: { name: 'Chap Goh Mei', held: 'red_lantern', dark: true, back: [['crescent_stars', 0.82, 0.2, 84], ['lantern_pair', 0.16, 0.2, 84, { cls: HANG }]] },
136
+ valentine: { name: 'Valentine’s Day', held: 'heart_mug', back: [['gold_heart', 0.46, 0.22, 36, { cls: TWINKLE }], ['gold_heart', 0.6, 0.3, 28, { cls: TWINKLE, d: ' d2' }], ['gold_heart', 0.54, 0.12, 22, { cls: TWINKLE, d: ' d3' }]] },
137
+ ramadan: { name: 'Ramadan evenings', dark: true, back: [['crescent_stars', 0.8, 0.22, 90]], front: [['lantern_pair', 0.12, 0.8, 70], ['lantern_pair', 0.88, 0.8, 70]] },
138
+ raya: { name: 'Hari Raya Puasa', held: 'ketupat', back: [['crescent_stars', 0.84, 0.2, 80], ['ketupat', 0.12, 0.2, 46, { cls: HANG }], ['ketupat', 0.22, 0.14, 32, { cls: HANG, d: ' d2' }]], front: [['lantern_pair', 0.1, 0.82, 56], ['lantern_pair', 0.9, 0.82, 56]] },
139
+ haji: { name: 'Hari Raya Haji', back: [['crescent_stars', 0.84, 0.2, 80]], front: [['lantern_pair', 0.12, 0.8, 62], ['lantern_pair', 0.88, 0.8, 62]] },
140
+ iwd: { name: 'International Women’s Day', head: 'yellow_flowers', back: [['yellow_flowers', 0.1, 0.28, 56], ['yellow_flowers', 0.9, 0.24, 48, { d: ' d2' }]] },
141
+ pi: { name: 'Pi Day', held: 'pie' },
142
+ easter: { name: 'Easter', held: 'egg', front: [['egg', 0.12, 0.82, 44], ['egg', 0.2, 0.86, 34], ['egg', 0.86, 0.82, 44], ['leaf_green', 0.92, 0.86, 30]] },
143
+ earth: { name: 'Earth Day', held: 'watering_can', back: [['planet_cloud', 0.84, 0.24, 72]], front: [['leaf_green', 0.2, 0.84, 34], ['leaf_green', 0.78, 0.82, 34, { rot: 40 }]] },
144
+ labour: { name: 'Labour Day', head: 'hard_hat' },
145
+ vesak: { name: 'Vesak Day', held: 'lotus', grass: false, front: [['lotus', 0.16, 0.8, 64], ['lotus', 0.84, 0.82, 56]] },
146
+ dragonboat: { name: 'Dragon Boat Festival', held: 'zongzi', grass: false, back: [['cloud_small', 0.8, 0.2, 74, { cls: 'env-cloud' }]] },
147
+ natday: { name: 'National Day', neck: () => 'scarf_blue_white', back: [['bunting', 0.5, 0.1, 330]] },
148
+ moon: { name: 'Moon landing day', head: 'astronaut_helmet', dark: true, grass: false, back: [['planet_cloud', 0.16, 0.22, 64], ['satellite', 0.8, 0.26, 62, { cls: TWINKLE }], ['rocket_idle', 0.64, 0.5, 56]], front: [['lunar_ground', 0.5, 0.9, 420]] },
149
+ ndp: { name: 'National Day', neck: () => 'scarf_red_white', dark: true, grass: false, back: [['bunting', 0.5, 0.08, 330], ['fireworks', 0.18, 0.34, 96, { cls: TWINKLE }], ['fireworks', 0.82, 0.3, 90, { cls: TWINKLE, d: ' d2' }]] },
150
+ teachers: { name: 'Teachers’ Day', held: 'apple', back: [['gold_star', 0.78, 0.3, 34, { cls: TWINKLE }], ['gold_star', 0.2, 0.2, 24, { cls: TWINKLE, d: ' d2' }]] },
151
+ midautumn: { name: 'Mid-Autumn Festival', held: 'mooncake', dark: true, back: [['moon_cloud', 0.8, 0.26, 108], ['lantern_pair', 0.18, 0.2, 92, { cls: HANG }], ['gold_sparkles', 0.5, 0.14, 60, { cls: TWINKLE }]] },
152
+ exam: { name: 'Exam season', head: 'pencil', back: [['question_mark', 0.8, 0.34, 52], ['gold_star', 0.2, 0.22, 24, { cls: TWINKLE, d: ' d2' }]] },
153
+ children: { name: 'Children’s Day', held: 'pinwheel', back: [['cloud_small', 0.2, 0.2, 72, { cls: 'env-cloud' }], ['cloud_medium', 0.78, 0.26, 84, { cls: 'env-cloud' }]] },
154
+ nightrace: { name: 'The night race', neck: () => 'scarf_black_white', dark: true, grass: false, back: [['string_lights', 0.5, 0.12, 300], ['gold_star', 0.2, 0.3, 22, { cls: TWINKLE }]] },
155
+ halloween: { name: 'Halloween', feet: 'pumpkin', dark: true, back: [['crescent_stars', 0.82, 0.24, 84]] },
156
+ deepavali: { name: 'Deepavali', held: 'diya', dark: true, grass: false, back: [['flower_garland', 0.5, 0.1, 340], ['gold_star', 0.2, 0.34, 22, { cls: TWINKLE }]], front: [['diya', 0.62, 0.84, 36], ['diya', 0.76, 0.86, 36], ['diya', 0.9, 0.84, 36]] },
157
+ thanks: { name: 'Thanksgiving', held: 'pie', back: [['deciduous_forest', 0.84, 0.5, 110]], front: [['leaf_orange', 0.2, 0.84, 32], ['leaf_pink', 0.3, 0.88, 28]] },
158
+ hanukkah: { name: 'Hanukkah', back: [['string_lights', 0.5, 0.12, 300], ['gold_star', 0.8, 0.3, 28, { cls: TWINKLE }]] },
159
+ christmas: { name: 'Christmas', head: 'beanie_red', feet: 'gift', back: [['string_lights', 0.5, 0.1, 330], ['pine_forest', 0.8, 0.6, 110]] },
160
+ dongzhi: { name: 'Dongzhi', held: 'tangyuan' },
161
+ pongal: { name: 'Pongal', held: 'cooking_pot', back: [['yellow_flowers', 0.82, 0.74, 56]] },
162
+ football: { name: 'The football finals', neck: (c) => SCARF[(c || [])[0]] || 'scarf_blue_white', feet: 'soccer_ball', grass: false },
163
+ games: { name: 'The Games', head: 'headband', grass: false },
164
+ movie: { name: 'Movie night', held: 'popcorn', feet: 'clapperboard', dark: true, grass: false },
383
165
  // Music: notes, never headphones (headphones mean a meeting is recording)
384
- music: { name: 'Music', back: (W) => note(W * 0.62, 90) + note(W * 0.7, 60, ' d2', 'blue10') + note(W * 0.34, 70, ' d3') },
385
- spring: { name: 'Spring', back: () => `<path d="M0 30 C 40 36, 70 50, 100 50" class="${KS('brown3')}" stroke-width="4" fill="none"/>` + blossom(100, 50) + blossom(60, 40, 4) + blossom(30, 32, 4.5), groundFx: (W, H, gy) => petals(W, gy) },
386
- summer: { name: 'Summer', head: sunHat, back: (W) => sun(W, 62, 26, 40) },
166
+ music: { name: 'Music', back: [['gold_sparkles', 0.66, 0.3, 80, { cls: TWINKLE }], ['gold_star', 0.34, 0.22, 30, { cls: TWINKLE, d: ' d2' }]] },
167
+ spring: { name: 'Spring', front: [['yellow_flowers', 0.12, 0.82, 54], ['yellow_flowers', 0.88, 0.82, 54], ['leaf_pink', 0.2, 0.2, 28, { cls: TWINKLE }]] },
168
+ summer: { name: 'Summer', head: 'straw_hat', back: [['sun', 0.82, 0.22, 76]] },
387
169
  // autumn leaves lie on the ground; they never fall
388
- autumn: { name: 'Autumn', neck: () => scarf('amber6', 'paper2'), back: (W, H, gy) => tree(W * 0.14, gy + 6) + tree(W * 0.9, gy + 10, 'red6', 'orange3'),
389
- groundFx: (W, H, gy) => [[0.26, 'orange3'], [0.32, 'red6'], [0.66, 'gold14'], [0.72, 'orange3'], [0.78, 'red6'], [0.38, 'gold14']].map(([f, c], i) => maple(W * f, gy + 14 + (i * 5) % 12, c, (i * 47) % 180, 0.9)).join('') },
390
- winter: { name: 'Winter', head: () => beanie('blue12', 'paper12', 'white'), neck: () => scarf('blue12', 'paper12'), grass: false, back: (W) => flakes([[W * 0.2, 30], [W * 0.5, 20], [W * 0.8, 40]]) },
391
- // the monsoon: clouds and a puddle, no falling rain (rain means a source failed)
392
- monsoon: { name: 'Monsoon', feet: () => umbrella(), back: (W) => clouds(W), groundFx: (W, H, gy) => puddle(W * 0.72, gy + 18) },
393
- pmosday: { name: 'Your PMOS day', held: cupcake, back: streamers },
394
- birthday: { name: 'Your birthday', head: () => partyHat('blue10', 'gold14'), held: cupcake, back: streamers, groundFx: (W, H, gy) => confetti(W, gy, 18) },
170
+ autumn: { name: 'Autumn', neck: () => 'scarf_yellow', back: [['deciduous_forest', 0.14, 0.5, 120], ['deciduous_forest', 0.9, 0.54, 100]], front: [['leaf_orange', 0.26, 0.86, 30], ['leaf_pink', 0.34, 0.9, 26], ['leaf_orange', 0.7, 0.88, 30, { rot: 60 }], ['leaf_green', 0.78, 0.84, 26]] },
171
+ winter: { name: 'Winter', head: 'beanie_blue', neck: () => 'scarf_blue_white', grass: false, back: [['snow_mountains', 0.5, 0.52, 380]] },
172
+ // the monsoon: clouds and an umbrella, no falling rain (rain means a source failed)
173
+ monsoon: { name: 'Monsoon', feet: 'umbrella', back: [['cloud_large', 0.5, 0.16, 150, { cls: 'env-cloud' }]] },
174
+ pmosday: { name: 'Your PMOS day', held: 'cupcake', back: [['bunting', 0.5, 0.1, 330]] },
175
+ birthday: { name: 'Your birthday', head: 'party_hat_blue', held: 'cupcake', back: [['bunting', 0.5, 0.1, 330], ['gold_sparkles', 0.2, 0.3, 60, { cls: TWINKLE }]] },
395
176
  };
396
177
  export const CHARM_KEYS = Object.freeze(Object.keys(CH));
397
178
  /** The words for a charm ("Deepavali"), or '' for a key PMOS does not draw. */
398
179
  export const charmName = (key) => (CH[key] ? CH[key].name : '');
180
+ const nameOf = (v, cs) => (typeof v === 'function' ? v(cs) : v);
399
181
 
400
182
  /** The charm on its own, with no Adler (batch 18 item 15, TbT9Divider: the day's charm on the panel divider): the held charm, else the one at
401
- * his feet, else the head charm, else the neck charm, in figure coordinates. The svg carries data-ad-fit: the page fits its viewBox to the
402
- * drawing (fitCharm). '' for a key PMOS does not draw. */
183
+ * his feet, else the head charm, else the neck charm, else the first thing of its scene. The viewBox is the PNG's own solid box. '' for a key
184
+ * PMOS does not draw. */
403
185
  export function charmIcon(key, colors = null, px = 26) {
404
186
  const ch = CH[key]; if (!ch) return '';
405
187
  addCss();
406
- const part = ch.held || ch.feet || ch.head || ch.neck; if (!part) return '';
407
- const box = ch.held ? '76 166 54 62' : '0 0 200 252';
408
- return `<svg class="ad-svg ad-charm" width="${px}" height="${px}" viewBox="${box}" data-ad-fit aria-hidden="true">${part(colors)}</svg>`;
409
- }
410
- /** Fits a charmIcon's viewBox to what it draws, once it is in the page (getBBox needs layout). */
411
- export function fitCharm(svg) {
412
- if (!svg || !svg.hasAttribute('data-ad-fit') || typeof svg.getBBox !== 'function') return;
413
- try {
414
- const b = svg.getBBox(); if (!b.width || !b.height) return;
415
- const s = Math.max(b.width, b.height), pad = s * 0.06;
416
- svg.setAttribute('viewBox', [b.x + b.width / 2 - s / 2 - pad, b.y + b.height / 2 - s / 2 - pad, s + 2 * pad, s + 2 * pad].map((v) => Math.round(v * 10) / 10).join(' '));
417
- svg.removeAttribute('data-ad-fit');
418
- } catch { /* not laid out yet: the default box stays */ }
188
+ const n = nameOf(ch.held || ch.feet || ch.head || ch.neck, colors) || (ch.back && ch.back[0] && ch.back[0][0]) || (ch.front && ch.front[0] && ch.front[0][0]); if (!n || !ART[n]) return '';
189
+ const a = ART[n], s = Math.max(a[3] - a[1], a[4] - a[2]), pad = s * 0.06, cx = (a[1] + a[3]) / 2, cy = (a[2] + a[4]) / 2;
190
+ return `<svg class="ad-svg ad-charm" width="${px}" height="${px}" viewBox="${[cx - s / 2 - pad, cy - s / 2 - pad, s + 2 * pad, s + 2 * pad].map(r1).join(' ')}" aria-hidden="true">${whole(n)}</svg>`;
419
191
  }
192
+ /** Kept for the divider: a charm's viewBox is already its PNG's solid box, so there is nothing to fit once it is in the page. */
193
+ export function fitCharm(svg) { if (svg && svg.removeAttribute) svg.removeAttribute('data-ad-fit'); }
420
194
 
421
- /* What he wears on the figure: a held charm goes in his paws only when they are free (handled, resting); in a raised-paw mood it rests at his
422
- * feet instead, unless the charm already has one there. The headphones win over a head charm: they mean a meeting is recording. */
195
+ /* What he wears on the figure: a held charm goes in front of him only when his arms are free (handled, resting); in any other mood it rests
196
+ * beside him instead, unless the charm already has a place at his feet. The headphones win over a head charm: they mean a meeting is recording. */
423
197
  function wear(m, prop, c) {
424
198
  if (!c) return '';
425
- const ch = c.ch, cs = c.colors;
426
- const aside = ch.held && !ch.feet && m !== 'calm' && m !== 'rest' ? `<g transform="translate(-62 22)">${ch.held(cs)}</g>` : '';
427
- return aside + (ch.neck ? ch.neck(cs) : '') + (ch.feet ? ch.feet(cs) : '') + (ch.head && prop !== 'headphones' ? ch.head(cs) : '');
199
+ const ch = c.ch, cs = c.colors, held = nameOf(ch.held, cs), feet = nameOf(ch.feet, cs), neck = nameOf(ch.neck, cs), head = nameOf(ch.head, cs);
200
+ const free = m === 'calm' || m === 'rest';
201
+ return (neck ? place('neck', neck) : '') + (held && (free || !feet) ? place(free ? 'held' : 'aside', held) : '') + (feet ? place('feet', feet) : '') + (head && prop !== 'headphones' ? place('head', head) : '');
428
202
  }
203
+ const hatOf = (c) => { const h = c && nameOf(c.ch.head, c.colors); return h ? place('head', h) : ''; };
429
204
 
430
205
  /* ── Settings > Adler (AdM5): this computer's settings, kept in localStorage for the first paint and read from /api/settings ── */
431
206
  const PREF_DEF = Object.freeze({ 'adler.amount': 'full', 'adler.motion': 'system', 'adler.celebrate': 'real', 'adler.quiet': '22' });
@@ -528,6 +303,7 @@ function addCss() {
528
303
  applyPrefs();
529
304
  }
530
305
 
306
+
531
307
  /* ── the drawings ── */
532
308
  const labelAttr = (o, mood, extra) => (o.label === false ? 'aria-hidden="true"' : `role="img" aria-label="${esc(o.label || 'Adler, ' + WORDS[mood] + (extra ? ', ' + extra : ''))}"`);
533
309
  /** The plain mood dot Settings > Adler > Off shows where a face would be. */
@@ -536,7 +312,7 @@ const dot = (mood, px, o) => `<span class="ad-dot m-${mood}" style="--ad-px:${px
536
312
  /**
537
313
  * Adler. mood: one of MOODS (anything else is handled). size: 's' | 'm' | 'l' or a number of px (the face's side; the figure's height).
538
314
  * o: { label: false (beside words that carry the meaning) | 'text', prop: 'headphones' | 'magnifier', cls, id (a fixed prefix), grow: one of GROWS (Your
539
- * impact's leaves on the sprout, the face only), growNew: true plays one grow on the newest leaf }. Off → the mood dot;
315
+ * impact's sprout), growNew: true plays one grow on the newest leaf, charm: a charm key, dress: true wears today's charm }. Off → the mood dot;
540
316
  * Face only → an L figure is drawn as the M face. → HTML string
541
317
  */
542
318
  export function adler(mood, size = 'm', o = {}) {
@@ -547,31 +323,36 @@ export function adler(mood, size = 'm', o = {}) {
547
323
  let px = typeof size === 'number' ? size : SIZES[size] || SIZES.m;
548
324
  if (figure && amount !== 'full') { figure = false; px = SIZES.m; }
549
325
  if (amount === 'off') return dot(mood, Math.min(px, 24), o);
550
- // o.id: a fixed prefix for a drawing that is redrawn in place (the chat avatar), so the same state draws the same markup and a
551
- // redraw that diffs the markup does not replace the node and replay its entrance (premium-viewer-flicker F1)
552
- const p = o.id ? 'ad' + o.id : nextId(), cls = `ad-svg am m-${m}${o.cls ? ' ' + o.cls : ''}`;
326
+ const cls = `ad-svg am m-${m}${o.cls ? ' ' + o.cls : ''}`;
553
327
  // a charm: the S face (under 36 px) never wears one, the M face wears a head charm only, the figure wears all of it
554
- const c = dressed(mood, o), hat = c && !figure && px >= 36 && c.ch.head && o.prop !== 'headphones' ? c.ch.head(c.colors) : '';
328
+ const c = dressed(mood, o), hat = c && !figure && px >= 36 && o.prop !== 'headphones' ? hatOf(c) : '';
555
329
  const worn = figure ? c : hat ? c : null;
556
330
  const extra = [o.prop === 'headphones' ? 'listening' : o.prop === 'magnifier' ? 'searching' : '', worn ? 'dressed for ' + worn.ch.name : ''].filter(Boolean).join(', ');
557
- if (!figure) return `<svg class="${cls} ad-face" width="${px}" height="${px}" viewBox="22 4 156 156" overflow="visible" ${labelAttr(o, mood, extra)}>${defs(p)}${head(m, p, o.prop, o.grow, o.growNew)}${hat}</svg>`;
558
- const w = Math.round(px * 200 / 252);
559
- return `<svg class="${cls} ad-fig" width="${w}" height="${px}" viewBox="0 0 200 252" overflow="visible" ${labelAttr(o, mood, extra)}>${defs(p)}<ellipse cx="100" cy="246" rx="62" ry="7" class="${F('shadow')}" opacity=".16" filter="url(#${p}b)"/><g class="ad-br">${full(m, p, o.prop, c)}</g></svg>`;
331
+ const art = pose(m, o.prop, figure ? null : o.grow);
332
+ const grew = o.growNew && o.grow && !figure ? `<g class="ad-gw">${whole(art)}</g>` : whole(art);
333
+ if (!figure) return `<svg class="${cls} ad-face" width="${px}" height="${px}" viewBox="22 26 488 488" overflow="visible" ${labelAttr(o, mood, extra)}>${grew}${hat}</svg>`;
334
+ return `<svg class="${cls} ad-fig" width="${px}" height="${px}" viewBox="0 0 512 512" overflow="visible" ${labelAttr(o, mood, extra)}>`
335
+ + `<ellipse cx="262" cy="488" rx="170" ry="14" class="${F('shadow')}" opacity=".14"/><g class="ad-br">${m === 'joy' ? sparkles() : ''}${whole(art)}${wear(m, o.prop, c)}</g></svg>`;
560
336
  }
561
337
  /** His face where a plain icon stood (the Jira chip, the charter's check line, the Deliveries lane): with Settings > Adler > Off the icon
562
338
  * stays, so the press still says what it does. */
563
339
  export const faceOr = (mood, size, icon, o = {}) => (P['adler.amount'] === 'off' ? icon : adler(mood, size, o));
564
- /** AdP6: only his ears and the top of his head, peeking over the floating button. */
340
+ /** AdP6: only the top of his head, peeking over the floating button. */
565
341
  export function adlerPeek(o = {}) {
566
342
  addCss();
567
343
  if (P['adler.amount'] !== 'full') return '';
568
- const p = nextId();
569
- return `<svg class="ad-svg am m-ask ad-peek" width="44" height="22" viewBox="22 4 156 78" overflow="hidden" ${labelAttr({ label: o.label || 'Adler, one call is yours' }, 'needs-you')}>${defs(p)}${head('ask', p)}</svg>`;
344
+ return `<svg class="ad-svg am m-ask ad-peek" width="44" height="22" viewBox="37 179 466 233" overflow="hidden" ${labelAttr({ label: o.label || 'Adler, one call is yours' }, 'needs-you')}>${whole('peeking_up')}</svg>`;
570
345
  }
571
346
 
572
347
  const grass = (x, y, s = 1, d = '') => `<g class="env-sway${d}"><path d="M${x} ${y} q -3 -${14 * s} -9 -${20 * s} M${x} ${y} q 1 -${18 * s} 4 -${24 * s} M${x} ${y} q 4 -${10 * s} 11 -${15 * s}" class="${S('grass')}" stroke-width="2.4" fill="none" stroke-linecap="round"/></g>`;
573
- const fallLeaf = (x, y, d, k) => `<g class="env-leaf${d}"><path d="M${x} ${y} c 4 -6 12 -6 14 0 c -4 6 -12 6 -14 0z" class="${F(k)}"/></g>`;
348
+ const fallLeaf = (x, y, d, k) => `<g class="env-leaf${d}">${put(k, x + 7, y, 20)}</g>`;
349
+ const LEAVES = [['leaf_green', 0.2], ['gold_star', 0.35], ['leaf_green', 0.62], ['leaf_pink', 0.78], ['leaf_orange', 0.5]];
350
+ const steam = (mx, my) => [-6, 0, 6].map((dx, i) => `<path class="env-steam${i ? ' d' + (i + 1) : ''} ${S('white')}" d="M${r1(mx + dx)} ${r1(my)} q -4 -6 0 -12 q 4 -6 0 -12" stroke-width="2.6" fill="none" stroke-linecap="round"/>`).join('');
351
+ const thinkDots = (W, H, adh) => { const cx = W / 2 + adh * 0.42, cy = H - adh - 6; let g = ''; for (let i = 0; i < 3; i++) g += `<circle class="env-dot${i ? ' d' + (i + 1) : ''} ${F('thinkdot')}" cx="${cx + i * 14}" cy="${cy + 18 - i * 6}" r="${4 + i}"/>`; return g; };
352
+ const sleepZ = (W, H, adh) => put('sleep_curls', W / 2 + adh * 0.3, H - adh + 14, 38, { cls: 'env-z' });
574
353
  export const SCENES = Object.freeze(['morning', 'tea', 'win', 'think', 'rain', 'night', 'plain']);
354
+ /* the figure in a scene: his own pose where the scene has one (the stretch in the morning, the mug at tea), else his mood */
355
+ const scenePose = (kind, m, prop) => (prop ? pose(m, prop) : kind === 'morning' && m === 'calm' ? 'morning_stretch' : kind === 'tea' && (m === 'calm' || m === 'rest') ? 'tea_mug' : EXPR[m]);
575
356
  /**
576
357
  * The XL scene: Adler in his small world. kind: one of SCENES. o: { w (viewBox width, 400), h (260), label, prop }. It scales to its
577
358
  * container's width. Face only → the M face; Off → nothing. → HTML string
@@ -588,24 +369,24 @@ export function adlerScene(kind, mood, o = {}) {
588
369
  let g = `<svg class="ad-scene env k-${kind}" viewBox="0 0 ${W} ${H}" preserveAspectRatio="xMidYMax slice" ${labelAttr(o, mood, kind === 'night' ? 'asleep' : '')}>`;
589
370
  g += `<defs><linearGradient id="${p}bg" x1="0" y1="0" x2="0" y2="1"><stop offset="0" class="adg-${kind}0"/><stop offset="1" class="adg-${kind}1"/></linearGradient></defs>`;
590
371
  g += `<g class="ad-env"><rect width="${W}" height="${H}" fill="url(#${p}bg)"/>`;
591
- if (kind === 'morning') g += `<circle class="env-glow ${F('sunglow')}" cx="${W - 80}" cy="62" r="34" opacity=".7"/><circle cx="${W - 80}" cy="62" r="22" class="${F('sun')}"/><g class="env-cloud"><ellipse cx="90" cy="58" rx="34" ry="12" class="${F('white')}" opacity=".9"/><ellipse cx="110" cy="50" rx="20" ry="12" class="${F('white')}" opacity=".9"/></g>`;
372
+ if (kind === 'morning') g += `<g class="env-glow">${put('sun', W - 80, 62, 64)}</g><g class="env-cloud">${put('cloud_small', 96, 56, 76)}</g>`;
592
373
  if (kind === 'night') {
593
- g += `<circle cx="${W - 78}" cy="58" r="22" class="${F('moon')}"/><circle cx="${W - 68}" cy="52" r="20" class="${F('night0')}"/>`;
594
- [[60, 40], [140, 70], [220, 36], [300, 90], [90, 110]].forEach(([x, y], i) => { g += `<circle class="env-tw${i % 3 ? ' d' + (i % 3 + 1) : ''} ${F('moon')}" cx="${x}" cy="${y}" r="2"/>`; });
374
+ g += put('crescent_stars', W - 78, 62, 70);
375
+ [[60, 40], [140, 70], [220, 36], [300, 90], [90, 110]].forEach(([x, y], i) => { g += `<circle class="env-tw${tw(i)} ${F('moon')}" cx="${x}" cy="${y}" r="2"/>`; });
595
376
  g += `<circle class="env-ff ${F('firefly')}" cx="${W * 0.22}" cy="${gy - 30}" r="3"/><circle class="env-ff d2 ${F('firefly')}" cx="${W * 0.8}" cy="${gy - 50}" r="2.5"/>`;
596
377
  }
597
378
  if (kind === 'rain') {
598
- g += `<g class="env-cloud"><ellipse cx="${W / 2 - 8}" cy="40" rx="44" ry="15" class="${F('raincloud')}"/><ellipse cx="${W / 2 + 16}" cy="30" rx="26" ry="16" class="${F('raincloud')}"/></g>`;
599
- [W / 2 - 30, W / 2, W / 2 + 26].forEach((x, i) => { g += `<path class="env-drop${i ? ' d' + (i + 1) : ''} ${S('drop')}" d="M${x} 56 l0 7" stroke-width="2.4" stroke-linecap="round"/>`; });
379
+ g += `<g class="env-cloud">${put('rain_cloud', W / 2, 40, 96)}</g>`;
380
+ [W / 2 - 30, W / 2, W / 2 + 26].forEach((x, i) => { g += `<path class="env-drop${i ? ' d' + (i + 1) : ''} ${S('drop')}" d="M${x} 66 l0 7" stroke-width="2.4" stroke-linecap="round"/>`; });
600
381
  }
601
- if (kind === 'think') { const cx = W / 2 + adh * 0.42, cy = H - adh - 6; for (let i = 0; i < 3; i++) g += `<circle class="env-dot${i ? ' d' + (i + 1) : ''} ${F('thinkdot')}" cx="${cx + i * 14}" cy="${cy + 18 - i * 6}" r="${4 + i}"/>`; }
602
- if (kind === 'win') [[W * 0.2, 'leaf2'], [W * 0.35, 'gold'], [W * 0.62, 'leaf2'], [W * 0.78, 'pink'], [W * 0.5, 'gold']].forEach(([x, k], i) => { g += fallLeaf(x, 14, i ? ' d' + (i + 1) : '', k); });
382
+ if (kind === 'think') g += thinkDots(W, H, adh);
383
+ if (kind === 'win') LEAVES.forEach(([k, f], i) => { g += fallLeaf(W * f, 14, i ? ' d' + (i + 1) : '', k); });
603
384
  if (kind !== 'plain') g += `<ellipse cx="${W / 2}" cy="${H + 30}" rx="${W * 0.75}" ry="70" class="${F(kind === 'night' ? 'groundn' : 'ground')}" opacity="${kind === 'night' ? 0.9 : 0.7}"/>` + grass(W * 0.12, gy + 18, 1) + grass(W * 0.86, gy + 14, 0.8, ' d2');
604
385
  g += '</g>';
605
- if (kind === 'night' && m === 'rest') { const zx = W / 2 + adh * 0.25, zy = H - adh + 10; for (let i = 0; i < 3; i++) g += `<text class="env-z${i ? ' d' + (i + 1) : ''} ${F('moon')} ad-z z${i}" x="${zx}" y="${zy}">z</text>`; }
606
- const aw = Math.round(adh * 200 / 252), x = (W - aw) / 2, y = H - adh - 8, q = nextId();
607
- g += `<svg x="${x}" y="${y}" width="${aw}" height="${adh}" viewBox="0 0 200 252" overflow="visible" class="am m-${m}" aria-hidden="true">${defs(q)}<ellipse cx="100" cy="246" rx="62" ry="7" class="${F('shadow')}" opacity=".16" filter="url(#${q}b)"/><g class="ad-br">${full(m, q, o.prop)}</g></svg>`;
608
- if (kind === 'tea') { const sc = adh / 252, mx = x + 101 * sc, my = y + 186 * sc; [-6, 0, 6].forEach((dx, i) => { g += `<path class="env-steam${i ? ' d' + (i + 1) : ''} ${S('white')}" d="M${mx + dx} ${my} q -4 -6 0 -12 q 4 -6 0 -12" stroke-width="2.6" fill="none" stroke-linecap="round"/>`; }); }
386
+ if (kind === 'night' && m === 'rest') g += sleepZ(W, H, adh);
387
+ const x = (W - adh) / 2, y = H - adh - 8;
388
+ g += `<svg x="${x}" y="${y}" width="${adh}" height="${adh}" viewBox="0 0 512 512" overflow="visible" class="am m-${m}" aria-hidden="true"><ellipse cx="262" cy="488" rx="170" ry="14" class="${F('shadow')}" opacity=".14"/><g class="ad-br">${m === 'joy' ? sparkles() : ''}${whole(scenePose(kind, m, o.prop))}</g></svg>`;
389
+ if (kind === 'tea' && scenePose(kind, m) === 'tea_mug') g += steam(x + 304 * adh / 512, y + 312 * adh / 512);
609
390
  return g + '</svg>';
610
391
  }
611
392
 
@@ -618,19 +399,18 @@ function charmScene(kind, mood, o, c) {
618
399
  let g = `<svg class="ad-scene env k-${kind} ch-${key}${ch.dark || night ? ' dark' : ''}" viewBox="0 0 ${W} ${H}" preserveAspectRatio="xMidYMax slice" ${labelAttr(o, mood, (kind === 'night' ? 'asleep, ' : '') + 'dressed for ' + ch.name)}>`;
619
400
  g += `<defs><linearGradient id="${p}bg" x1="0" y1="0" x2="0" y2="1"><stop offset="0" class="adg-${sky}0"/><stop offset="1" class="adg-${sky}1"/></linearGradient></defs>`;
620
401
  g += `<g class="ad-env"><rect width="${W}" height="${H}" fill="url(#${p}bg)"/>`;
621
- if (!plain && ch.back) g += ch.back(W, H, gy);
622
- if (night) g += stars([[W * 0.1, 30, 2], [W * 0.3, 60, 1.6], [W * 0.55, 24, 2], [W * 0.7, 70, 1.6], [W * 0.9, 40, 2]]);
623
- g += `<ellipse cx="${W / 2}" cy="${H + 30}" rx="${W * 0.75}" ry="70" class="${plain ? K('gold3') : night ? F('groundn') : `adf-${key}g`}" opacity=".85"/>`;
624
- if (!plain && ch.groundFx) g += ch.groundFx(W, H, gy);
625
- if (!plain && ch.grass !== false) g += grassS(W * 0.1, gy + 18, 1) + grassS(W * 0.9, gy + 14, 0.8, ' d2');
626
- if (kind === 'think') { const cx = W / 2 + adh * 0.42, cy = H - adh - 6; for (let i = 0; i < 3; i++) g += `<circle class="env-dot${i ? ' d' + (i + 1) : ''} ${F('thinkdot')}" cx="${cx + i * 14}" cy="${cy + 18 - i * 6}" r="${4 + i}"/>`; }
402
+ if (!plain && ch.back) g += things(W, H, ch.back);
403
+ if (night) [[0.1, 30], [0.3, 60], [0.55, 24], [0.7, 70], [0.9, 40]].forEach(([f, y], i) => { g += `<circle class="env-tw${tw(i)} ${F('moon')}" cx="${r1(W * f)}" cy="${y}" r="2"/>`; });
404
+ g += `<ellipse cx="${W / 2}" cy="${H + 30}" rx="${W * 0.75}" ry="70" class="${plain ? 'adk-gold3' : night ? F('groundn') : `adf-${key}g`}" opacity=".85"/>`;
405
+ if (!plain && ch.grass !== false) g += grass(W * 0.1, gy + 18, 1) + grass(W * 0.9, gy + 14, 0.8, ' d2');
406
+ if (kind === 'think') g += thinkDots(W, H, adh);
627
407
  g += '</g>';
628
- if (kind === 'night' && m === 'rest') { const zx = W / 2 + adh * 0.25, zy = H - adh + 10; for (let i = 0; i < 3; i++) g += `<text class="env-z${i ? ' d' + (i + 1) : ''} ${F('moon')} ad-z z${i}" x="${zx}" y="${zy}">z</text>`; }
629
- const aw = Math.round(adh * 200 / 252), x = (W - aw) / 2, y = H - adh - 8, q = nextId();
630
- g += `<svg x="${x}" y="${y}" width="${aw}" height="${adh}" viewBox="0 0 200 252" overflow="visible" class="am m-${m}" aria-hidden="true">${defs(q)}<ellipse cx="100" cy="246" rx="62" ry="7" class="${F('shadow')}" opacity=".16" filter="url(#${q}b)"/><g class="ad-br">${full(m, q, o.prop, c)}</g></svg>`;
631
- if (!plain && ch.front) g += `<g class="ad-env">${ch.front(W, H, gy)}</g>`;
632
- if (m === 'joy') [[W * 0.2, 'leaf2'], [W * 0.35, 'gold'], [W * 0.62, 'leaf2'], [W * 0.78, 'pink'], [W * 0.5, 'gold']].forEach(([lx, k], i) => { g += fallLeaf(lx, 14, i ? ' d' + (i + 1) : '', k); });
633
- if (kind === 'tea' && !(ch.held && (m === 'calm' || m === 'rest'))) { const sc = adh / 252, mx = x + 101 * sc, my = y + 186 * sc; [-6, 0, 6].forEach((dx, i) => { g += `<path class="env-steam${i ? ' d' + (i + 1) : ''} ${S('white')}" d="M${mx + dx} ${my} q -4 -6 0 -12 q 4 -6 0 -12" stroke-width="2.6" fill="none" stroke-linecap="round"/>`; }); }
408
+ if (kind === 'night' && m === 'rest') g += sleepZ(W, H, adh);
409
+ const x = (W - adh) / 2, y = H - adh - 8;
410
+ g += `<svg x="${x}" y="${y}" width="${adh}" height="${adh}" viewBox="0 0 512 512" overflow="visible" class="am m-${m}" aria-hidden="true"><ellipse cx="262" cy="488" rx="170" ry="14" class="${F('shadow')}" opacity=".14"/><g class="ad-br">${m === 'joy' ? sparkles() : ''}${whole(scenePose(kind, m, o.prop))}${wear(m, o.prop, c)}</g></svg>`;
411
+ if (!plain && ch.front) g += `<g class="ad-env">${things(W, H, ch.front)}</g>`;
412
+ if (m === 'joy') LEAVES.forEach(([k, f], i) => { g += fallLeaf(W * f, 14, i ? ' d' + (i + 1) : '', k); });
413
+ if (kind === 'tea' && !(ch.held && (m === 'calm' || m === 'rest')) && scenePose(kind, m) === 'tea_mug') g += steam(x + 304 * adh / 512, y + 312 * adh / 512);
634
414
  return g + '</svg>';
635
415
  }
636
416