bokata 3.0.0-beta.3 → 3.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/.agents/skills/bokata-acceptance-criteria/SKILL.md +6 -7
  2. package/.agents/skills/bokata-acceptance-criteria/resources/output-template-functional.md +3 -3
  3. package/.agents/skills/bokata-acceptance-criteria/resources/output-template.md +1 -1
  4. package/.agents/skills/bokata-feature-map/SKILL.md +10 -11
  5. package/.agents/skills/bokata-feature-mapper/SKILL.md +4 -5
  6. package/.agents/skills/bokata-feature-mapper/resources/output-template.md +1 -1
  7. package/.agents/skills/bokata-feature-slicer/SKILL.md +16 -12
  8. package/.agents/skills/bokata-feature-slicer/resources/output-template-bites.md +12 -4
  9. package/.agents/skills/bokata-feature-slicer/resources/phase-2-increments.md +29 -51
  10. package/.agents/skills/bokata-feature-slicer/resources/{phase-3-baby-steps.md → phase-3-skeleton.md} +3 -3
  11. package/.agents/skills/bokata-feature-slicer/resources/phase-4-bites.md +8 -7
  12. package/.agents/skills/bokata-plan/SKILL.md +21 -15
  13. package/.agents/skills/bokata-plan/resources/plan-template.md +7 -5
  14. package/.agents/skills/bokata-render/SKILL.md +62 -138
  15. package/.agents/skills/bokata-render/assets/story-map.html +428 -0
  16. package/.agents/skills/bokata-render/scripts/render.mjs +703 -0
  17. package/.agents/skills/bokata-shape/SKILL.md +1 -1
  18. package/.agents/skills/bokata-slice/SKILL.md +194 -100
  19. package/.agents/skills/bokata-slice/resources/inc-template.md +36 -0
  20. package/.agents/skills/bokata-slice/resources/slice-template.md +37 -84
  21. package/.agents/skills/bokata-status/SKILL.md +27 -15
  22. package/.agents/skills/bokata-tdd/resources/evidence-rules.md +2 -2
  23. package/LICENSE +21 -0
  24. package/README.md +54 -40
  25. package/agents/bokata-product-designer.md +2 -2
  26. package/agents/bokata-product-engineer.md +2 -2
  27. package/agents/bokata-product-manager.md +3 -3
  28. package/agents/code-executor.md +27 -16
  29. package/agents/design-reviewer.md +2 -2
  30. package/agents/feature-slicer.md +21 -9
  31. package/bin/bokata.js +17 -5
  32. package/package.json +1 -1
  33. package/src/agents.js +36 -11
  34. package/src/config.js +8 -7
  35. package/src/install.js +12 -3
  36. package/.agents/skills/bokata-render/resources/story-map-template.md +0 -835
  37. package/agents/story-map-renderer.md +0 -19
@@ -0,0 +1,428 @@
1
+ <!doctype html>
2
+ <html lang="{{LANG}}">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title>{{TITLE}}</title>
7
+ <!-- Generated by bokata-render from the initiative's markdown. Self-contained: no external CSS, JS, fonts or images.
8
+ Every page of the site (map, increment, bite, User Task, Feature) lives in this one file, routed by the URL hash. -->
9
+ <style>
10
+ :root{--bg:#f6f7f9;--ink:#1c2230;--mute:#6b7280;--line:#dfe3ea;--panel:#fff;--lab:176px;--w:150px;
11
+ --done:#e3f3e8;--done-b:#59a96f;--build:#fff1cf;--build-b:#e0a21b;--plan:#e6eefc;--plan-b:#6e93e0;--back-b:#b5bcc8}
12
+ *{box-sizing:border-box}
13
+ html,body{margin:0;height:100%}
14
+ body{font:14px/1.45 system-ui,-apple-system,"Segoe UI",sans-serif;color:var(--ink);background:var(--bg);display:flex;flex-direction:column}
15
+ #app{flex:1;min-height:0;display:flex;flex-direction:column;overflow:auto}
16
+ a{color:inherit;text-decoration:none}
17
+ code{background:#eef0f4;padding:0 4px;border-radius:3px;font-size:.92em}
18
+ .top{display:flex;flex-wrap:wrap;gap:14px;align-items:center;padding:10px 16px;background:var(--panel);border-bottom:1px solid var(--line);position:sticky;top:0;z-index:50;flex:none}
19
+ .top h1{font-size:16px;margin:0 8px 0 0}
20
+ .top .sum{color:var(--mute);font-size:12.5px}
21
+ .tool{display:flex;gap:6px;align-items:center;font-size:12.5px;color:var(--mute)}
22
+ .tool button,.chip-btn{font:inherit;border:1px solid var(--line);background:#fff;border-radius:6px;padding:3px 9px;cursor:pointer;color:var(--ink)}
23
+ .tool button.on,.chip-btn.on{background:var(--ink);color:#fff;border-color:var(--ink)}
24
+ .legend{display:flex;gap:10px;font-size:12px;color:var(--mute);margin-left:auto;flex-wrap:wrap}
25
+ .legend i{display:inline-block;width:12px;height:12px;border-radius:3px;vertical-align:-2px;margin-right:4px;border:1.5px solid}
26
+ .lg-done{background:var(--done);border-color:var(--done-b)!important}.lg-build{background:var(--build);border-color:var(--build-b)!important}
27
+ .lg-planned{background:var(--plan);border-color:var(--plan-b)!important}.lg-plan{background:var(--plan);border-color:var(--plan-b)!important;border-style:dashed!important}.lg-back{background:#fff;border-color:var(--back-b)!important;border-style:dashed!important}
28
+ .scroll{overflow:auto;flex:1;min-height:0}
29
+ .map{width:max-content;min-width:100%;padding-bottom:60px}
30
+ .hd{position:sticky;top:0;z-index:30;background:var(--bg)}
31
+ .row{display:grid;grid-template-columns:var(--cols)}
32
+ .fh{padding:6px 8px;font-weight:600;font-size:12.5px;border-right:2px solid var(--bg);border-radius:8px 8px 0 0;cursor:pointer;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;user-select:none}
33
+ .fh small{font-weight:500;opacity:.7;margin-left:4px}
34
+ .th{padding:5px 7px;font-size:11.5px;line-height:1.25;color:#333;border-right:2px solid var(--bg);height:62px;overflow:hidden;cursor:pointer}
35
+ .th:hover{text-decoration:underline}
36
+ .z4 .th{writing-mode:vertical-rl;padding:6px 2px;height:120px;font-size:11px}
37
+ .corner{position:sticky;left:0;z-index:40;background:var(--bg)}
38
+ .slice-h{position:sticky;left:0;display:flex;gap:10px;align-items:center;padding:14px 12px 6px;font-weight:700;font-size:15px;width:max-content;cursor:pointer;z-index:20}
39
+ .slice-h .pill{font-size:11px}
40
+ .band{display:grid;grid-template-columns:var(--cols);column-gap:0;border-top:1px dashed var(--back-b);padding:6px 0;align-items:start}
41
+ .band.st-done,.band.st-building{border-top-style:solid;border-top-color:var(--line)}
42
+ .lab{position:sticky;left:0;z-index:10;background:var(--bg);padding:2px 10px 2px 12px;display:block;align-self:stretch;margin-right:6px;border-radius:8px}
43
+ .lab:hover b{text-decoration:underline}
44
+ .lab b{font-size:14px;display:block}
45
+ .lab .t{font-size:12px;color:#444;display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;overflow:hidden}
46
+ .lab .m{font-size:11.5px;color:var(--mute);margin-top:3px}
47
+ .pill{display:inline-block;font-size:10.5px;font-weight:600;border-radius:999px;padding:1px 8px;border:1px solid;vertical-align:1px}
48
+ .p-done{background:var(--done);border-color:var(--done-b);color:#1e6b36}.p-building{background:var(--build);border-color:var(--build-b);color:#8a5d00}
49
+ .p-sliced,.p-planned,.p-proposed{background:var(--plan);border-color:var(--plan-b);color:#2f56b0}.p-open{background:#eee;border-color:#ccc;color:#555}
50
+ .bar{height:4px;background:#e5e7eb;border-radius:3px;margin-top:4px;overflow:hidden}.bar i{display:block;height:100%;background:var(--build-b)}
51
+ .card{display:flex;flex-direction:column;gap:2px;margin:3px 5px;padding:6px 8px;border-radius:8px;border:1.5px solid;font-size:12px;line-height:1.3;min-height:44px;overflow:hidden;position:relative}
52
+ .card:hover{box-shadow:0 2px 8px rgba(0,0,0,.18);z-index:5}
53
+ .card .id{font-size:10.5px;font-weight:700;opacity:.75;display:flex;gap:5px;align-items:center}
54
+ .card .ti{display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;overflow:hidden;word-break:break-word}
55
+ .card .ti.empty{color:var(--mute);font-style:italic}
56
+ .card .cx{font-size:10px;color:var(--mute)}
57
+ .c-done{background:var(--done);border-color:var(--done-b)}.c-building{background:var(--build);border-color:var(--build-b)}
58
+ .c-planned{background:var(--plan);border-color:var(--plan-b)}
59
+ .c-proposed{background:var(--plan);border-color:var(--plan-b);border-style:dashed}
60
+ .c-back{background:#fff;border-color:var(--back-b);border-style:dashed}
61
+ .c-loose{background:repeating-linear-gradient(135deg,#f0f1f4,#f0f1f4 6px,#e6e8ed 6px,#e6e8ed 12px);border-color:#9aa1ad}
62
+ .pr{font-size:9.5px;font-weight:700;border-radius:4px;padding:0 4px;margin-left:auto}
63
+ .pr-must-have{background:var(--ink);color:#fff}.pr-nice-to-have{border:1px solid #888;color:#555}.pr-deferred{color:#999;font-style:italic}
64
+ .card.deferred{opacity:.7}
65
+ .dim{opacity:.13;pointer-events:none}
66
+ .approx::after{content:"?";position:absolute;right:5px;bottom:2px;font-size:10px;color:#a33;font-weight:700}
67
+ /* zoom levels */
68
+ .mm{position:fixed;right:18px;bottom:18px;z-index:60;background:#fff;border:1px solid #c7ccd6;border-radius:8px;box-shadow:0 4px 16px rgba(0,0,0,.18);padding:6px;cursor:pointer}
69
+ .mm .cap{font-size:10px;color:var(--mute);margin:0 0 4px 2px;display:flex;justify-content:space-between}
70
+ .mm .cv{position:relative;background:#f3f4f7;border-radius:4px;overflow:hidden}
71
+ .mm .cv i{position:absolute;display:block;border-radius:1px}
72
+ .mm .vp{position:absolute;border:2px solid #d9482b;background:rgba(217,72,43,.10);border-radius:2px;pointer-events:none}
73
+ .z1{--w:190px}.z1 .card{font-size:12.5px}
74
+ .z2{--w:150px}
75
+ .z3{--w:96px}.z3 .card{padding:4px 5px;margin:2px 3px;font-size:10.5px;min-height:36px}.z3 .card .ti{-webkit-line-clamp:3}.z3 .card .pr,.z3 .card .cx{display:none}
76
+ .z4{--w:30px}.z4 .card{padding:2px;margin:2px;min-height:26px;align-items:center;justify-content:center}.z4 .card .ti,.z4 .card .cx,.z4 .card .pr{display:none}.z4 .card .id{font-size:8.5px}
77
+ .z4 .fh{font-size:10.5px;padding:6px 3px}.z4 .fh small{display:none}
78
+ .z4 .lab .t{-webkit-line-clamp:2}
79
+ /* detail */
80
+ .page{max-width:1020px;margin:0 auto;padding:22px 20px 80px}
81
+ .crumbs{font-size:12.5px;color:var(--mute);margin-bottom:12px}.crumbs a{text-decoration:underline}
82
+ .page h1{font-size:23px;margin:4px 0 8px;line-height:1.25}
83
+ .page h2{font-size:15px;margin:26px 0 8px;padding-bottom:4px;border-bottom:1px solid var(--line)}
84
+ .kv{display:grid;grid-template-columns:130px 1fr;gap:6px 14px;margin:10px 0}.kv dt{color:var(--mute);font-size:12.5px}.kv dd{margin:0}
85
+ .chips{display:flex;flex-wrap:wrap;gap:6px;margin:6px 0}
86
+ .chip{border:1px solid var(--line);background:#fff;border-radius:999px;padding:1px 10px;font-size:12px}.chip:hover{border-color:var(--ink)}
87
+ .grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:2px}
88
+ .grid .card{margin:3px;min-height:56px}
89
+ .outcome{background:#fff;border:1px solid var(--line);border-left:5px solid var(--done-b);border-radius:10px;padding:12px 16px;margin:12px 0}
90
+ .outcome .ol{font-size:11px;text-transform:uppercase;letter-spacing:.05em;color:var(--mute);font-weight:700}
91
+ .outcome p{margin:2px 0;font-size:15.5px;line-height:1.5}.outcome ul{margin:4px 0 0;padding-left:20px}.outcome li a:hover{text-decoration:underline}
92
+ .proposed-oc .outcome{border-left-color:var(--plan-b)}
93
+ details.more{margin-top:26px;border:1px solid var(--line);border-radius:10px;background:#fff;padding:0 16px}
94
+ details.more>summary{cursor:pointer;padding:12px 0;font-weight:600;font-size:14px}
95
+ details.more[open]>summary{border-bottom:1px solid var(--line);margin-bottom:10px}
96
+ .src{font-size:12px;color:var(--mute);margin-top:30px;border-top:1px solid var(--line);padding-top:8px}
97
+ .muted{color:var(--mute)}
98
+ .opts{columns:2;column-gap:28px;font-size:12.5px}.opts li{break-inside:avoid;margin-bottom:3px}
99
+ .opts b{font-size:12.5px}
100
+ .detail ul{padding-left:20px}.detail li.n1{margin-left:18px}.detail li.n2{margin-left:36px}
101
+ .detail h3,.detail h4,.detail h5{margin:18px 0 6px}
102
+ .detail h4{font-size:14.5px;border-left:4px solid var(--plan-b);padding-left:8px}
103
+ .detail p.rule{background:#f1f3f8;border-radius:6px;padding:6px 10px;margin:16px 0 4px}
104
+ pre.gh{background:#fbfbfd;border:1px solid var(--line);border-radius:8px;padding:10px 12px;font:12.5px/1.55 ui-monospace,Menlo,monospace;overflow:auto;margin:4px 0 12px;white-space:pre-wrap}
105
+ pre.gh span{display:block}.g-sc{font-weight:700;color:#14326e}.g-st i{font-style:normal;font-weight:700;color:#7a3e9d;margin-right:5px}.g-cm{color:#8a8f98}
106
+ .detail table{border-collapse:collapse;margin:8px 0;font-size:12.5px}.detail td,.detail th{border:1px solid var(--line);padding:4px 8px;text-align:left}
107
+ .banner{background:#fff7e0;border:1px solid #ecd48a;border-radius:8px;padding:8px 12px;margin:8px 16px;font-size:12.5px}
108
+ .tbl{width:100%;border-collapse:collapse;font-size:13px}.tbl td,.tbl th{border-bottom:1px solid var(--line);padding:6px 8px;text-align:left;vertical-align:top}
109
+ </style>
110
+ </head>
111
+ <body>
112
+ <div class="top" id="top"></div>
113
+ <div id="app"></div>
114
+ <script>window.DATA={{DATA}};</script>
115
+ <script>
116
+ const D = window.DATA;
117
+ const ES = String(D.lang || 'en').toLowerCase().startsWith('es');
118
+ const I = {
119
+ en: {
120
+ zoom: 'Zoom', fold: 'Fold features', unfold: 'Unfold features', empty: 'Only columns with cards', minimap: 'Minimap', state: 'State', priority: 'Priority',
121
+ done: 'done', building: 'building', planned: 'planned', sliced: 'sliced', proposed: 'proposed', back: 'untaken', open: 'open',
122
+ must: 'must', nice: 'nice', def: 'def', backlog: 'Backlog', backlogSub: 'Untaken bites, by priority', bitesN: (n) => `${n} ${n === 1 ? 'bite' : 'bites'}`, noBites: 'no bites', scN: (n) => `${n} sc.`,
123
+ map: 'Map', mapBack: '← Map', slice: 'Slice', incsDone: (a, b) => `${a}/${b} Incs done`, bitesTotal: (n) => `${n} bites`,
124
+ summary: (f, u, a, b, n) => `${f} features · ${u} user tasks · ${a}/${b} Incs · ${n} bites untaken`,
125
+ next: 'Next', generated: 'Generated',
126
+ whenDone: 'When it is done', whatPossible: 'What will be possible', bites: 'Bites', touches: 'Features and User Tasks it touches',
127
+ optionsN: (n) => `Options (${n})`, showOpts: 'show grouped by User Task', noTrace: 'No trace',
128
+ detail: (n) => `Full detail of the increment${n ? ` · ${n} scenarios` : ''} (rules, Gherkin, fixtures)`,
129
+ pending: 'Pending — not in the code', unknowns: 'Unknowns', planN: (p) => `plan ${p}`, scenariosN: (n) => `${n} scenarios`, tasksN: (n) => `${n} user tasks`,
130
+ looseNote: (n) => `This increment has no bites: ${n} loose options. Every Inc should be made of bites.`,
131
+ source: 'Source', readOnly: 'generated page, read only',
132
+ value: 'Value', check: 'How it is checked', dependsOn: 'Depends on', userTasks: 'User Tasks', biteOptions: (n) => `Options of the bite (${n})`,
133
+ notTaken: 'untaken', covered: 'Where it is covered', thSlice: 'Slice', thIncs: 'Increments', thBites: 'Bites', thOpts: 'Options in Incs',
134
+ featureTasks: 'User Tasks', incsTouch: 'Increments that touch it', systemTasks: 'System Tasks', noSlice: 'No slice has cut this feature yet.',
135
+ notFound: 'Not found', foldTip: (o) => `click to ${o ? 'fold' : 'unfold'}`, tasksN2: (n) => `${n} UT`, plusUT: (n) => `+${n} UT`,
136
+ touchesN: (n) => ` (touches ${n} User Tasks)`, loose: (n) => `${n} loose options`, looseTip: (t, n, i) => `${t} — ${n} options of Inc ${i} not grouped in bites`,
137
+ clickDrag: 'click or drag', untakenN: (n) => `${n} untaken`, desc: 'description',
138
+ whyOrder: 'Why this order'
139
+ },
140
+ es: {
141
+ zoom: 'Zoom', fold: 'Plegar features', unfold: 'Desplegar features', empty: 'Solo columnas con tarjetas', minimap: 'Minimapa', state: 'Estado', priority: 'Prioridad',
142
+ done: 'hecho', building: 'en curso', planned: 'planificado', sliced: 'cortado', proposed: 'propuesto', back: 'sin tomar', open: 'abierto',
143
+ must: 'must', nice: 'nice', def: 'def', backlog: 'Backlog', backlogSub: 'Bites sin tomar, por prioridad', bitesN: (n) => `${n} ${n === 1 ? 'bite' : 'bites'}`, noBites: 'sin bites', scN: (n) => `${n} esc.`,
144
+ map: 'Mapa', mapBack: '← Mapa', slice: 'Slice', incsDone: (a, b) => `${a}/${b} Incs hechos`, bitesTotal: (n) => `${n} bites`,
145
+ summary: (f, u, a, b, n) => `${f} features · ${u} user tasks · ${a}/${b} Incs · ${n} bites sin tomar`,
146
+ next: 'Siguiente', generated: 'Generado',
147
+ whenDone: 'Cuando esté hecho', whatPossible: 'Qué se podrá hacer', bites: 'Bites', touches: 'Features y User Tasks que toca',
148
+ optionsN: (n) => `Opciones (${n})`, showOpts: 'mostrar agrupadas por User Task', noTrace: 'Sin traza',
149
+ detail: (n) => `Ver el detalle completo del incremento${n ? ` · ${n} escenarios` : ''} (reglas, Gherkin, fixtures)`,
150
+ pending: 'Pendiente — no está en el código', unknowns: 'Incógnitas', planN: (p) => `plan ${p}`, scenariosN: (n) => `${n} escenarios`, tasksN: (n) => `${n} user tasks`,
151
+ looseNote: (n) => `Este incremento no tiene bites: ${n} opciones sueltas. Todo Inc debería componerse de bites.`,
152
+ source: 'Fuente', readOnly: 'página generada, solo lectura',
153
+ value: 'Valor', check: 'Cómo se comprueba', dependsOn: 'Depende de', userTasks: 'User Tasks', biteOptions: (n) => `Opciones del bite (${n})`,
154
+ notTaken: 'sin tomar', covered: 'Dónde se cubre', thSlice: 'Slice', thIncs: 'Incrementos', thBites: 'Bites', thOpts: 'Opciones en Incs',
155
+ featureTasks: 'User Tasks', incsTouch: 'Incrementos que la tocan', systemTasks: 'System Tasks', noSlice: 'Ningún slice ha cortado esta feature todavía.',
156
+ notFound: 'No encontrado', foldTip: (o) => `clic para ${o ? 'plegar' : 'desplegar'}`, tasksN2: (n) => `${n} UT`, plusUT: (n) => `+${n} UT`,
157
+ touchesN: (n) => ` (toca ${n} User Tasks)`, loose: (n) => `${n} opciones sueltas`, looseTip: (t, n, i) => `${t} — ${n} opciones del Inc ${i} sin agrupar en bites`,
158
+ clickDrag: 'clic o arrastra', untakenN: (n) => `${n} sin tomar`, desc: 'descripción',
159
+ whyOrder: 'Por qué este orden'
160
+ }
161
+ };
162
+ const t = (k, ...a) => { const v = (ES ? I.es : I.en)[k] ?? I.en[k] ?? k; return typeof v === 'function' ? v(...a) : v; };
163
+
164
+ const $ = (s) => document.querySelector(s);
165
+ const esc = (s) => String(s ?? '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
166
+ const FEATCOL = ['#fbe3e8', '#fdeccb', '#dcecf7', '#dff1e6', '#e8e2f8', '#fbe4d8'];
167
+ const prLabel = { skeleton: 'skel', 'must-have': t('must'), 'nice-to-have': t('nice'), deferred: t('def') };
168
+ const taskById = {}, featOfTask = {}, featByCode = {};
169
+ D.features.forEach((f) => { featByCode[f.code] = f; f.tasks.forEach((x) => { taskById[x.id] = x; featOfTask[x.id] = f; }); });
170
+ const sliceByNn = {}, biteByKey = {}, incByKey = {};
171
+ D.slices.forEach((s) => { sliceByNn[s.nn] = s; s.bites.forEach((b) => (biteByKey[b.key] = b)); s.incs.forEach((i) => { i.slice = s.nn; incByKey[i.key] = i; }); });
172
+ D.slices.forEach((s) => s.bites.forEach((b) => { b.slice = s.nn; const n = b.taken || b.proposedInc; b.stateInc = n ? incByKey[`${s.nn}-${n}`] || null : null; }));
173
+
174
+ const ui = { minimap: true, zoom: 2, collapsed: new Set(), hideEmpty: false, state: null, prio: null, closed: new Set() };
175
+ try {
176
+ Object.assign(ui, JSON.parse(sessionStorage.getItem('mapui') || '{}'), { collapsed: new Set(JSON.parse(sessionStorage.getItem('mapcol') || '[]')), closed: new Set() });
177
+ } catch (e) {}
178
+ const save = () => { try { sessionStorage.setItem('mapui', JSON.stringify({ zoom: ui.zoom, hideEmpty: ui.hideEmpty, minimap: ui.minimap })); sessionStorage.setItem('mapcol', JSON.stringify([...ui.collapsed])); } catch (e) {} };
179
+
180
+ // done | building | planned (sliced too) | proposed | back (untaken)
181
+ const cardState = (b) => {
182
+ const i = b.stateInc;
183
+ if (!i) return 'back';
184
+ return i.state === 'sliced' ? 'planned' : i.state;
185
+ };
186
+ const incClass = (i) => (i.state === 'sliced' ? 'planned' : i.state);
187
+ const pad2 = (n) => String(n).padStart(2, '0');
188
+
189
+ /* ---------- map ---------- */
190
+ function columns() {
191
+ const cols = [];
192
+ D.features.forEach((f) => {
193
+ if (ui.collapsed.has(f.code)) cols.push({ f, t: null });
194
+ else f.tasks.forEach((x) => cols.push({ f, t: x }));
195
+ });
196
+ return cols;
197
+ }
198
+ function cardsOf(slice) {
199
+ const out = [];
200
+ slice.incs.forEach((inc) => {
201
+ const bs = inc.bites.map((k) => biteByKey[k]).filter(Boolean);
202
+ if (bs.length) bs.forEach((b) => out.push({ band: inc.key, task: b.anchor, bite: b }));
203
+ else if (!inc.proposed) {
204
+ const cnt = {};
205
+ inc.options.forEach((o) => { if (o.task) cnt[o.task] = (cnt[o.task] || 0) + 1; });
206
+ if (!Object.keys(cnt).length) inc.tasks.forEach((tk) => { cnt[tk] = 0; }); // only **[User Task]** tags (oldest slices)
207
+ Object.entries(cnt).forEach(([task, n]) => out.push({ band: inc.key, task, loose: { inc, n } }));
208
+ }
209
+ });
210
+ const prio = { skeleton: 0, 'must-have': 0, 'nice-to-have': 1, deferred: 2 };
211
+ slice.bites.filter((b) => !b.stateInc).sort((a, b) => prio[a.priority] - prio[b.priority]).forEach((b) => out.push({ band: 'backlog', task: b.anchor, bite: b }));
212
+ return out;
213
+ }
214
+ function renderMap() {
215
+ const cols0 = columns();
216
+ const all = D.slices.flatMap((s) => cardsOf(s));
217
+ const used = new Set(all.map((c) => (ui.collapsed.has(featOfTask[c.task]?.code) ? featOfTask[c.task].code : c.task)));
218
+ const cols = ui.hideEmpty ? cols0.filter((c) => used.has(c.t ? c.t.id : c.f.code)) : cols0;
219
+ const colIdx = (task) => { const f = featOfTask[task]; return cols.findIndex((c) => (c.t ? c.t.id === task : c.f.code === f.code)); };
220
+ let h = `<div class="scroll z${ui.zoom}" style="--cols:var(--lab) repeat(${cols.length}, var(--w))"><div class="map">`;
221
+ h += `<div class="hd"><div class="row"><div class="corner" style="grid-column:1;grid-row:1 / span 2"></div>`;
222
+ let start = 2;
223
+ D.features.forEach((f, fi) => {
224
+ const span = cols.filter((c) => c.f.code === f.code).length;
225
+ if (!span) return;
226
+ const open = !ui.collapsed.has(f.code);
227
+ h += `<div class="fh" data-f="${f.code}" title="${esc(f.name)} — ${t('foldTip', open)}" style="grid-column:${start} / span ${span};grid-row:1;background:${FEATCOL[fi % FEATCOL.length]}">${open ? '▾' : '▸'} ${f.code}<small>${esc(f.name)}</small></div>`;
228
+ start += span;
229
+ });
230
+ cols.forEach((c, i) => {
231
+ const bg = `${FEATCOL[D.features.indexOf(c.f) % FEATCOL.length]}88`;
232
+ if (c.t) h += `<a class="th" href="#/ut/${c.t.id}" title="${esc(c.t.name)}" style="grid-column:${i + 2};grid-row:2;background:${bg}">${esc(c.t.name)}</a>`;
233
+ else h += `<div class="th" style="grid-column:${i + 2};grid-row:2;background:${bg};color:var(--mute)">${t('tasksN2', c.f.tasks.length)}</div>`;
234
+ });
235
+ h += `</div></div>`;
236
+
237
+ D.slices.forEach((s) => {
238
+ const closed = ui.closed.has(s.nn);
239
+ const real = s.incs.filter((i) => !i.proposed);
240
+ h += `<div class="slice-h" data-s="${s.nn}">${closed ? '▸' : '▾'} ${t('slice')} ${pad2(s.nn)} · ${esc(s.name.replace(/-/g, ' '))} <span class="pill p-${s.status}">${t(s.status)}</span><span class="muted" style="font-weight:400;font-size:12px">${t('incsDone', real.filter((i) => i.state === 'done').length, real.length)} · ${t('bitesTotal', s.bites.length)}</span></div>`;
241
+ if (closed) return;
242
+ const cards = cardsOf(s);
243
+ const bands = [...s.incs.map((i) => ({ key: i.key, inc: i })), { key: 'backlog', backlog: true }];
244
+ bands.forEach((bd) => {
245
+ const mine = cards.filter((c) => c.band === bd.key).map((c) => ({ ...c, ci: colIdx(c.task) })).filter((c) => c.ci >= 0).sort((a, b) => a.ci - b.ci);
246
+ const stack = {};
247
+ mine.forEach((c) => { stack[c.ci] = (stack[c.ci] || 0) + 1; c.r = stack[c.ci]; });
248
+ const k = Math.max(1, ...Object.values(stack));
249
+ let lab, cls;
250
+ if (bd.backlog) {
251
+ cls = 'back';
252
+ const n = s.bites.filter((b) => !b.stateInc).length;
253
+ lab = `<div class="lab" style="grid-column:1;grid-row:1 / span ${k}"><b>${t('backlog')}</b><div class="t">${t('backlogSub')}</div><div class="m">${t('bitesN', n)}</div></div>`;
254
+ } else {
255
+ const i = bd.inc;
256
+ cls = incClass(i);
257
+ const prog = i.progress && i.state !== 'done' ? `<div class="bar"><i style="width:${(+i.progress.split('/')[0] / +i.progress.split('/')[1]) * 100}%"></i></div>` : '';
258
+ lab = `<a class="lab" title="${esc(i.outcome)}" href="#/inc/${i.key}" style="grid-column:1;grid-row:1 / span ${k}"><b>Inc ${i.n} <span class="pill p-${i.state}">${t(i.state)}</span></b><div class="t">${esc(i.name)}</div><div class="m">${i.bites.length ? t('bitesN', i.bites.length) : t('noBites')}${i.scenarios ? ' · ' + t('scN', i.scenarios) : ''}</div>${prog}</a>`;
259
+ }
260
+ h += `<div class="band st-${cls}">${lab}`;
261
+ mine.forEach((c) => { h += card(c, c.ci + 2, c.r); });
262
+ h += `</div>`;
263
+ });
264
+ });
265
+ h += `</div></div>`;
266
+ $('#app').innerHTML = h;
267
+ buildMinimap();
268
+ $('#app').querySelectorAll('.fh').forEach((e) => e.addEventListener('click', () => { const c = e.dataset.f; ui.collapsed.has(c) ? ui.collapsed.delete(c) : ui.collapsed.add(c); save(); renderMap(); }));
269
+ $('#app').querySelectorAll('.slice-h').forEach((e) => e.addEventListener('click', () => { const n = +e.dataset.s; ui.closed.has(n) ? ui.closed.delete(n) : ui.closed.add(n); renderMap(); }));
270
+ }
271
+ function buildMinimap() {
272
+ const sc = $('#app .scroll'), map = $('#app .map');
273
+ if (!sc || !map || !ui.minimap) return;
274
+ const W = map.scrollWidth, H = map.scrollHeight;
275
+ const k = Math.min(230 / W, 150 / H);
276
+ const mw = Math.round(W * k), mh = Math.round(H * k);
277
+ const mr = map.getBoundingClientRect();
278
+ const col = { done: '#59a96f', building: '#e0a21b', proposed: '#6e93e0', planned: '#6e93e0', back: '#b5bcc8', loose: '#8b93a1' };
279
+ let h = '';
280
+ map.querySelectorAll('.fh').forEach((e) => { const r = e.getBoundingClientRect(); h += `<i style="left:${(r.left - mr.left) * k}px;top:0;width:${r.width * k}px;height:${Math.max(3, 14 * k)}px;background:${e.style.background}"></i>`; });
281
+ map.querySelectorAll('.slice-h').forEach((e) => { const r = e.getBoundingClientRect(); h += `<i style="left:0;top:${(r.top - mr.top) * k}px;width:${mw}px;height:1px;background:#8b93a1"></i>`; });
282
+ map.querySelectorAll('.card').forEach((e) => {
283
+ const r = e.getBoundingClientRect();
284
+ const m = e.className.match(/c-(\w+)/);
285
+ h += `<i style="left:${(r.left - mr.left) * k}px;top:${(r.top - mr.top) * k}px;width:${Math.max(1.5, r.width * k)}px;height:${Math.max(1.5, r.height * k)}px;background:${col[m ? m[1] : 'back']}"></i>`;
286
+ });
287
+ const old = $('.mm'); if (old) old.remove();
288
+ const el = document.createElement('div');
289
+ el.className = 'mm';
290
+ el.innerHTML = `<div class="cap"><span>${t('minimap')}</span><span>${t('clickDrag')}</span></div><div class="cv" style="width:${mw}px;height:${mh}px">${h}<div class="vp"></div></div>`;
291
+ document.body.appendChild(el);
292
+ const vp = el.querySelector('.vp'), cv = el.querySelector('.cv');
293
+ const upd = () => { vp.style.left = sc.scrollLeft * k + 'px'; vp.style.top = sc.scrollTop * k + 'px'; vp.style.width = Math.min(mw, sc.clientWidth * k) + 'px'; vp.style.height = Math.min(mh, sc.clientHeight * k) + 'px'; };
294
+ const go = (ev) => { const r = cv.getBoundingClientRect(); sc.scrollLeft = (ev.clientX - r.left) / k - sc.clientWidth / 2; sc.scrollTop = (ev.clientY - r.top) / k - sc.clientHeight / 2; };
295
+ let drag = false;
296
+ el.addEventListener('mousedown', (ev) => { drag = true; go(ev); ev.preventDefault(); });
297
+ window.addEventListener('mousemove', (ev) => { if (drag) go(ev); });
298
+ window.addEventListener('mouseup', () => { drag = false; });
299
+ sc.addEventListener('scroll', upd);
300
+ upd();
301
+ }
302
+ function dimmed(b) {
303
+ if (ui.state && cardState(b) !== ui.state) return true;
304
+ if (ui.prio && b.priority !== ui.prio) return true;
305
+ return false;
306
+ }
307
+ function card(c, col, row) {
308
+ const pos = `style="grid-column:${col};grid-row:${row}"`;
309
+ if (c.loose) {
310
+ return `<a class="card c-loose" href="#/inc/${c.loose.inc.key}" ${pos} title="${esc(t('looseTip', taskById[c.task].name, c.loose.n, c.loose.inc.n))}"><span class="id">Inc ${c.loose.inc.n}</span><span class="ti">${c.loose.n ? t('loose', c.loose.n) : esc(c.loose.inc.name)}</span></a>`;
311
+ }
312
+ const b = c.bite;
313
+ return `<a class="card c-${cardState(b)}${b.priority === 'deferred' ? ' deferred' : ''}${dimmed(b) ? ' dim' : ''}" href="#/bite/${b.key}" ${pos} title="${esc(b.id + ' · ' + b.title)}${b.others.length ? esc(t('touchesN', b.others.length + 1)) : ''}">`
314
+ + `<span class="id">${b.id}<span class="pr pr-${b.priority}">${prLabel[b.priority]}</span></span><span class="ti">${esc(b.title)}</span>${b.others.length ? `<span class="cx">${t('plusUT', b.others.length)}</span>` : ''}</a>`;
315
+ }
316
+
317
+ /* ---------- top bar ---------- */
318
+ function renderTop(isMap) {
319
+ const bites = D.slices.flatMap((s) => s.bites);
320
+ const incs = D.slices.flatMap((s) => s.incs).filter((i) => !i.proposed);
321
+ let h = `<h1><a href="#/">${esc(D.initiative)}</a></h1><span class="sum">${t('summary', D.features.length, D.features.reduce((a, f) => a + f.tasks.length, 0), incs.filter((i) => i.state === 'done').length, incs.length, bites.filter((b) => !b.taken).length)} · ${t('generated')} ${esc(D.date)}</span>`;
322
+ if (D.next) h += `<span class="sum" title="${esc(D.next.link)}">▶ ${t('next')}: ${esc(D.next.text)}</span>`;
323
+ if (isMap) {
324
+ h += `<span class="tool">${t('zoom')} <button data-z="-1">−</button><b>${['', 'L', 'M', 'S', 'XS'][ui.zoom]}</b><button data-z="1">+</button></span>`;
325
+ h += `<span class="tool"><button id="fold">${D.features.every((f) => ui.collapsed.has(f.code)) ? t('unfold') : t('fold')}</button><button id="empty" class="${ui.hideEmpty ? 'on' : ''}">${t('empty')}</button><button id="mmb" class="${ui.minimap ? 'on' : ''}">${t('minimap')}</button></span>`;
326
+ h += `<span class="tool">${t('state')} ${['done', 'building', 'planned', 'proposed', 'back'].map((s) => `<button class="${ui.state === s ? 'on' : ''}" data-st="${s}">${t(s)}</button>`).join('')}</span>`;
327
+ h += `<span class="tool">${t('priority')} ${['must-have', 'nice-to-have', 'deferred'].map((s) => `<button class="${ui.prio === s ? 'on' : ''}" data-pr="${s}">${prLabel[s]}</button>`).join('')}</span>`;
328
+ h += `<span class="legend"><span><i class="lg-done"></i>${t('done')}</span><span><i class="lg-build"></i>${t('building')}</span><span><i class="lg-planned"></i>${t('planned')}</span><span><i class="lg-plan"></i>${t('proposed')}</span><span><i class="lg-back"></i>${t('back')}</span></span>`;
329
+ } else h += `<a class="chip" href="#/" style="margin-left:auto">${t('mapBack')}</a>`;
330
+ $('#top').innerHTML = h;
331
+ $('#top').querySelectorAll('[data-z]').forEach((e) => e.addEventListener('click', () => { ui.zoom = Math.max(1, Math.min(4, ui.zoom + +e.dataset.z)); save(); route(); }));
332
+ const fold = $('#fold'); if (fold) fold.onclick = () => { const all = D.features.every((f) => ui.collapsed.has(f.code)); ui.collapsed = all ? new Set() : new Set(D.features.map((f) => f.code)); save(); route(); };
333
+ const em = $('#empty'); if (em) em.onclick = () => { ui.hideEmpty = !ui.hideEmpty; save(); route(); };
334
+ const mb = $('#mmb'); if (mb) mb.onclick = () => { ui.minimap = !ui.minimap; save(); route(); };
335
+ $('#top').querySelectorAll('[data-st]').forEach((e) => e.addEventListener('click', () => { ui.state = ui.state === e.dataset.st ? null : e.dataset.st; route(); }));
336
+ $('#top').querySelectorAll('[data-pr]').forEach((e) => e.addEventListener('click', () => { ui.prio = ui.prio === e.dataset.pr ? null : e.dataset.pr; route(); }));
337
+ }
338
+
339
+ /* ---------- detail pages ---------- */
340
+ const chipUT = (id) => `<a class="chip" href="#/ut/${id}">${esc(taskById[id].name)}</a>`;
341
+ const chipF = (code) => `<a class="chip" href="#/feature/${code}"><b>${code}</b> ${esc(featByCode[code].name)}</a>`;
342
+ const miniCard = (b) => `<a class="card c-${cardState(b)}" href="#/bite/${b.key}"><span class="id">${b.id}<span class="pr pr-${b.priority}">${prLabel[b.priority]}</span></span><span class="ti">${esc(b.title)}</span></a>`;
343
+ const incChip = (i) => `<a class="chip" href="#/inc/${i.key}">${t('slice')} ${pad2(i.slice)} · Inc ${i.n} <span class="pill p-${i.state}">${t(i.state)}</span></a>`;
344
+ const groupOpts = (opts) => {
345
+ const g = new Map();
346
+ opts.forEach((o) => { const k = o.task || '—'; if (!g.has(k)) g.set(k, []); g.get(k).push(o); });
347
+ return [...g].map(([tk, os]) => `<div><b>${tk === '—' ? t('noTrace') : `<a href="#/ut/${tk}" style="text-decoration:underline">${esc(taskById[tk].name)}</a>`}</b><ul style="margin:2px 0 10px;padding-left:18px">${os.map((o) => `<li><code>${o.id}</code> ${esc(o.name)}</li>`).join('')}</ul></div>`).join('');
348
+ };
349
+ const crumbs = (...parts) => `<div class="crumbs"><a href="#/">${t('map')}</a> › ${parts.join(' › ')}</div>`;
350
+ const src = (s, extra) => `<div class="src">${t('source')}: <code>${esc(s)}</code>${extra ? ' · ' + extra : ''} · ${t('readOnly')}</div>`;
351
+ const sliceLabel = (s) => `${t('slice')} ${pad2(s.nn)} · ${esc(s.name.replace(/-/g, ' '))}`;
352
+
353
+ function viewInc(key) {
354
+ const i = incByKey[key]; if (!i) return notFound();
355
+ const s = sliceByNn[i.slice];
356
+ const bs = i.bites.map((k) => biteByKey[k]).filter(Boolean);
357
+ const tasks = [...new Set([...i.tasks, ...bs.flatMap((b) => [b.anchor, ...b.others]).filter(Boolean)])];
358
+ const feats = [...new Set(tasks.map((x) => featOfTask[x].code))];
359
+ $('#app').innerHTML = `<div class="page">${crumbs(sliceLabel(s), `Inc ${i.n}`)}
360
+ <h1>Inc ${i.n} — ${esc(i.name)}</h1>
361
+ <div class="chips"><span class="pill p-${i.state}">${t(i.state)}</span>${i.progress ? `<span class="chip">${t('planN', i.progress)}</span>` : ''}${i.scenarios ? `<span class="chip">${t('scenariosN', i.scenarios)}</span>` : ''}<span class="chip">${t('bitesN', bs.length)}</span><span class="chip">${t('tasksN', tasks.length)}</span></div>
362
+ <div class="outcome"><div class="ol">${t('whenDone')}</div><p>${esc(i.outcome)}</p>${bs.length ? `<div class="ol" style="margin-top:10px">${t('whatPossible')}</div><ul>${bs.map((b) => `<li><a href="#/bite/${b.key}"><code>${b.id}</code> ${esc(b.title)}</a></li>`).join('')}</ul>` : ''}</div>
363
+ ${i.pending.length ? `<div class="banner"><b>${t('pending')}</b><ul>${i.pending.map((p) => `<li>${esc(p)}</li>`).join('')}</ul></div>` : ''}
364
+ ${i.unknowns && !/^none$/i.test(i.unknowns) ? `<div class="banner"><b>${t('unknowns')}:</b> ${esc(i.unknowns)}</div>` : ''}
365
+ <h2>${t('bites')}</h2>${bs.length ? `<div class="grid">${bs.map(miniCard).join('')}</div>` : `<p class="muted">${t('looseNote', i.options.length)}</p>`}
366
+ <h2>${t('touches')}</h2><div class="chips">${feats.map(chipF).join('')}</div><div class="chips">${tasks.map(chipUT).join('')}</div>
367
+ ${i.options.length ? `<h2>${t('optionsN', i.options.length)}</h2><details><summary class="muted" style="cursor:pointer">${t('showOpts')}</summary><div class="opts" style="margin-top:8px">${groupOpts(i.options)}</div></details>` : ''}
368
+ ${i.body ? `<details class="more"><summary>${t('detail', i.scenarios)}</summary><div class="detail">${i.body}</div></details>` : ''}
369
+ ${src(i.source)}</div>`;
370
+ }
371
+ function viewBite(key) {
372
+ const b = biteByKey[key]; if (!b) return notFound();
373
+ const s = sliceByNn[b.slice];
374
+ const tasks = [b.anchor, ...b.others].filter(Boolean);
375
+ $('#app').innerHTML = `<div class="page">${crumbs(sliceLabel(s), `Bite ${b.id}`)}
376
+ <h1>${b.id} · ${esc(b.title)}</h1>
377
+ <div class="chips"><span class="chip pr-${b.priority}" style="${b.priority === 'must-have' ? 'background:var(--ink);color:#fff' : ''}">${esc(b.priority === 'deferred' && b.reason ? `deferred: ${b.reason}` : b.priority)}</span>
378
+ ${b.stateInc ? incChip(b.stateInc) : `<span class="pill p-open">${t('notTaken')}</span>`}${chipF(b.feature)}</div>
379
+ <dl class="kv">${b.value ? `<dt>${t('value')}</dt><dd>${esc(b.value)}</dd>` : ''}${b.check ? `<dt>${t('check')}</dt><dd>${esc(b.check)}</dd>` : ''}${b.dependsOn ? `<dt>${t('dependsOn')}</dt><dd>${esc(b.dependsOn)}</dd>` : ''}<dt>${t('userTasks')}</dt><dd class="chips" style="margin:0">${tasks.map(chipUT).join('')}</dd></dl>
380
+ ${b.options.length ? `<h2>${t('biteOptions', b.options.length)}</h2><div class="opts">${groupOpts(b.options)}</div>` : ''}
381
+ ${src(b.source)}</div>`;
382
+ }
383
+ function viewUT(id) {
384
+ const x = taskById[id]; if (!x) return notFound();
385
+ const f = featOfTask[id];
386
+ const rows = D.slices.map((s) => {
387
+ const bs = s.bites.filter((b) => b.anchor === id || b.others.includes(id));
388
+ const incs = s.incs.filter((i) => i.tasks.includes(id) || i.bites.some((k) => { const b = biteByKey[k]; return b && (b.anchor === id || b.others.includes(id)); }));
389
+ const opts = s.incs.reduce((a, i) => a + i.options.filter((o) => o.task === id).length, 0);
390
+ return { s, bs, incs, opts };
391
+ });
392
+ $('#app').innerHTML = `<div class="page">${crumbs(`<a href="#/feature/${f.code}">${f.code} ${esc(f.name)}</a>`, 'User Task')}
393
+ <h1>${esc(x.name)}</h1><div class="chips">${chipF(f.code)}</div>
394
+ ${x.desc ? `<p>${esc(x.desc)}</p>` : ''}
395
+ <h2>${t('covered')}</h2>
396
+ <table class="tbl"><tr><th>${t('thSlice')}</th><th>${t('thIncs')}</th><th>${t('thBites')}</th><th>${t('thOpts')}</th></tr>
397
+ ${rows.map((r) => `<tr><td>${t('slice')} ${pad2(r.s.nn)}</td><td class="chips">${r.incs.map(incChip).join('') || '<span class="muted">—</span>'}</td><td>${r.bs.length ? `<div class="grid" style="grid-template-columns:repeat(auto-fill,minmax(190px,1fr))">${r.bs.map(miniCard).join('')}</div>` : '<span class="muted">—</span>'}</td><td>${r.opts || '—'}</td></tr>`).join('')}</table>
398
+ ${src('features.md', t('desc'))}</div>`;
399
+ }
400
+ function viewFeature(code) {
401
+ const f = featByCode[code]; if (!f) return notFound();
402
+ const bs = D.slices.flatMap((s) => s.bites).filter((b) => b.feature === code);
403
+ const incs = D.slices.flatMap((s) => s.incs).filter((i) => i.bites.some((k) => biteByKey[k]?.feature === code) || i.tasks.some((x) => featOfTask[x].code === code));
404
+ $('#app').innerHTML = `<div class="page">${crumbs('Feature')}
405
+ <h1>${code} · ${esc(f.name)}</h1><div class="chips"><span class="chip">${t('tasksN', f.tasks.length)}</span><span class="chip">${t('bitesN', bs.length)}</span><span class="chip">${t('untakenN', bs.filter((b) => !b.stateInc).length)}</span></div>
406
+ <h2>${t('featureTasks')}</h2><table class="tbl">${f.tasks.map((x) => { const n = bs.filter((b) => b.anchor === x.id || b.others.includes(x.id)).length; return `<tr><td><a class="chip" href="#/ut/${x.id}">${esc(x.name)}</a></td><td class="muted">${esc(x.desc)}</td><td>${n ? t('bitesN', n) : '—'}</td></tr>`; }).join('')}</table>
407
+ ${f.systemTasks.length ? `<h2>${t('systemTasks')}</h2><ul>${f.systemTasks.map((x) => `<li>${esc(x)}</li>`).join('')}</ul>` : ''}
408
+ <h2>${t('incsTouch')}</h2><div class="chips">${incs.map(incChip).join('') || '<span class="muted">—</span>'}</div>
409
+ <h2>${t('bites')}</h2>${D.slices.map((s) => { const x = bs.filter((b) => b.slice === s.nn); return x.length ? `<p class="muted" style="margin:10px 0 2px">${sliceLabel(s)}</p><div class="grid">${x.map(miniCard).join('')}</div>` : ''; }).join('') || `<p class="muted">${t('noSlice')}</p>`}
410
+ ${src('features.md')}</div>`;
411
+ }
412
+ const notFound = () => { $('#app').innerHTML = `<div class="page"><h1>${t('notFound')}</h1><a class="chip" href="#/">${t('mapBack')}</a></div>`; };
413
+
414
+ function route() {
415
+ const h = location.hash.replace(/^#\/?/, '');
416
+ const [kind, ...rest] = h.split('/');
417
+ const arg = rest.join('/');
418
+ renderTop(!kind);
419
+ const old = $('.mm'); if (old) old.remove();
420
+ if (!kind) { renderMap(); return; }
421
+ $('#app').scrollTop = 0;
422
+ ({ inc: viewInc, bite: viewBite, ut: viewUT, feature: viewFeature }[kind] || notFound)(arg);
423
+ }
424
+ window.addEventListener('hashchange', route);
425
+ route();
426
+ </script>
427
+ </body>
428
+ </html>