-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathm.html
More file actions
626 lines (607 loc) · 48.3 KB
/
Copy pathm.html
File metadata and controls
626 lines (607 loc) · 48.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
<title>Kuber Map — FIBO, on your phone</title>
<!-- PWA -->
<link rel="manifest" href="manifest-m.json" />
<meta name="theme-color" content="#0a1410" media="(prefers-color-scheme: dark)" />
<meta name="theme-color" content="#f4f8f5" media="(prefers-color-scheme: light)" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="apple-mobile-web-app-title" content="Kuber Map" />
<link rel="apple-touch-icon" href="icons/apple-touch-icon.png" />
<script>(function(){try{var t=localStorage.getItem('kuber-theme');document.documentElement.setAttribute('data-theme',t||(window.matchMedia&&window.matchMedia('(prefers-color-scheme: light)').matches?'light':'dark'));}catch(e){document.documentElement.setAttribute('data-theme','dark');}})();</script>
<style>
@font-face { font-family:'Manrope'; font-weight:400; font-display:swap; src:url('fonts/manrope-400.woff2') format('woff2'); }
@font-face { font-family:'Manrope'; font-weight:600; font-display:swap; src:url('fonts/manrope-600.woff2') format('woff2'); }
@font-face { font-family:'Manrope'; font-weight:700; font-display:swap; src:url('fonts/manrope-700.woff2') format('woff2'); }
@font-face { font-family:'Manrope'; font-weight:800; font-display:swap; src:url('fonts/manrope-800.woff2') format('woff2'); }
:root{
--bg:#0a1410; --bg2:#0f1c16; --card:#12211a; --line:rgba(159,188,171,.14);
--ink:#eaf3ee; --muted:#9fbcab; --green:#4fe08a; --green-deep:#1f9d57; --gold:#f3c969;
--top-bg:rgba(10,20,16,.92); --grad:rgba(60,170,100,.13);
--sans:'Manrope',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
}
:root[data-theme="light"]{
--bg:#f4f8f5; --bg2:#ffffff; --card:#ffffff; --line:rgba(20,70,45,.16);
--ink:#0e1c15; --muted:#4c6b5b; --green:#158048; --green-deep:#0f6338; --gold:#9a6b00;
--top-bg:rgba(255,255,255,.9); --grad:rgba(40,150,85,.10);
}
*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
body{font-family:var(--sans);color:var(--ink);min-height:100vh;
background:radial-gradient(560px 420px at 82% -6%, var(--grad), transparent 60%), var(--bg);
-webkit-font-smoothing:antialiased;}
.m-top{position:sticky;top:0;z-index:10;background:var(--top-bg);backdrop-filter:blur(9px);-webkit-backdrop-filter:blur(9px);
padding:calc(12px + env(safe-area-inset-top)) 16px 10px;border-bottom:1px solid var(--line);}
.m-brand{display:flex;align-items:center;gap:9px;font-weight:800;font-size:18px;letter-spacing:-.01em;color:inherit;text-decoration:none;}
.m-brand svg{width:22px;height:22px;color:var(--green);filter:drop-shadow(0 3px 10px rgba(79,224,138,.4));}
.m-brand .count{margin-left:auto;font-size:11px;font-weight:700;color:var(--muted);}
.m-search{margin-top:11px;width:100%;padding:12px 14px;border-radius:12px;border:1px solid var(--line);
background:var(--bg2);color:var(--ink);font-size:16px;font-family:inherit;}
.m-search:focus{outline:none;border-color:var(--green);box-shadow:0 0 0 3px rgba(79,224,138,.14);}
.m-chips{display:flex;gap:8px;overflow-x:auto;padding:12px 16px;scrollbar-width:none;}
.m-chips::-webkit-scrollbar{display:none}
.chip{flex:0 0 auto;display:inline-flex;align-items:center;gap:6px;padding:8px 13px;border-radius:999px;
border:1px solid var(--line);background:transparent;color:var(--muted);font-size:13px;font-weight:600;
font-family:inherit;cursor:pointer;white-space:nowrap;}
.chip .dot{width:9px;height:9px;border-radius:3px;}
.chip.active{background:var(--card);color:var(--ink);border-color:var(--green);}
.m-levels{display:flex;gap:7px;overflow-x:auto;padding:0 16px 12px;scrollbar-width:none;}
.m-levels::-webkit-scrollbar{display:none}
.lchip{flex:0 0 auto;padding:6px 12px;border-radius:999px;border:1px solid var(--line);background:transparent;color:var(--muted);font-size:12px;font-weight:700;font-family:inherit;cursor:pointer;white-space:nowrap;}
.lchip.active{background:var(--card);color:var(--ink);border-color:var(--green);}
.m-tools{display:flex;gap:8px;overflow-x:auto;padding:0 16px 12px;scrollbar-width:none;}
.m-tools::-webkit-scrollbar{display:none}
.tchip{flex:0 0 auto;display:inline-flex;align-items:center;gap:5px;padding:8px 13px;border-radius:999px;border:1px solid rgba(79,224,138,.32);background:rgba(79,224,138,.07);color:var(--ink);font-size:12.5px;font-weight:700;font-family:inherit;cursor:pointer;white-space:nowrap;}
.tchip.active{background:var(--green);color:#06250f;border-color:var(--green);}
.m-anslist{display:flex;flex-direction:column;gap:9px;margin-top:2px;}
.m-ans{text-align:left;line-height:1.4;}
.m-reccard{border:1px solid var(--line);border-left:3px solid var(--c,var(--green));border-radius:12px;background:var(--card);padding:13px 14px;margin-top:2px;}
.m-reccard h2{margin:6px 0 8px;font-size:22px;}
.m-cmp-tabs{display:flex;gap:7px;overflow-x:auto;padding-bottom:12px;scrollbar-width:none;}
.m-cmp-tabs::-webkit-scrollbar{display:none}
.m-cmp-scroll{overflow-x:auto;border:1px solid var(--line);border-radius:12px;margin-top:4px;-webkit-overflow-scrolling:touch;}
table.m-cmp{border-collapse:collapse;font-size:12.5px;white-space:nowrap;min-width:100%;}
table.m-cmp th,table.m-cmp td{padding:9px 12px;text-align:left;border-bottom:1px solid var(--line);}
table.m-cmp th{color:var(--muted);font-size:10px;text-transform:uppercase;letter-spacing:.5px;font-weight:800;background:var(--bg2);}
table.m-cmp tr:last-child td{border-bottom:0;}
.m-cmp-name{color:var(--green);font-weight:700;cursor:pointer;}
.m-list{padding:4px 16px 40px;display:flex;flex-direction:column;gap:10px;}
.m-group-title{font-size:11px;text-transform:uppercase;letter-spacing:1.2px;color:var(--muted);
font-weight:800;margin:16px 2px 3px;}
.card{position:relative;border:1px solid var(--line);border-radius:14px;background:var(--card);
padding:13px 14px 13px 17px;overflow:hidden;cursor:pointer;transition:border-color .15s, transform .06s;}
.card:active{transform:scale(.99);}
.card::before{content:"";position:absolute;left:0;top:0;bottom:0;width:4px;background:var(--c,#888);}
.card h3{font-size:15.5px;font-weight:700;display:flex;align-items:center;gap:8px;flex-wrap:wrap;}
.card .lvl{font-size:10px;font-weight:800;color:var(--muted);background:var(--bg2);border-radius:999px;padding:2px 7px;margin-left:auto;}
.card .newb{font-size:9px;font-weight:800;color:#06250f;background:var(--green);border-radius:999px;padding:2px 6px;}
.card p{margin-top:5px;font-size:13px;line-height:1.5;color:var(--muted);}
.empty{text-align:center;color:var(--muted);padding:50px 20px;font-size:14px;}
.m-foot{text-align:center;padding:8px 20px 34px;font-size:12px;color:var(--muted);}
.m-foot a{color:var(--green);text-decoration:none;font-weight:600;}
/* detail sheet */
.m-sheet{position:fixed;inset:0;z-index:50;display:none;}
.m-sheet.open{display:block;}
.m-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.58);}
.m-panel{position:absolute;left:0;right:0;bottom:0;max-height:90vh;overflow-y:auto;
background:var(--bg2);border-radius:20px 20px 0 0;border-top:1px solid var(--line);
padding:0 18px calc(34px + env(safe-area-inset-bottom));animation:up .28s cubic-bezier(.2,.7,.2,1);}
@keyframes up{from{transform:translateY(34px);opacity:.5}to{transform:none;opacity:1}}
.m-head{position:sticky;top:0;z-index:3;background:var(--bg2);margin:0 -18px;padding:8px 18px 11px;border-bottom:1px solid var(--line);}
.m-body{padding-top:14px;}
.m-close{float:right;width:32px;height:32px;border-radius:50%;border:1px solid var(--line);
background:var(--card);color:var(--ink);font-size:19px;line-height:1;cursor:pointer;}
.m-grab{width:40px;height:4px;border-radius:99px;background:var(--line);margin:2px auto 12px;}
.m-tag{font-size:11px;text-transform:uppercase;letter-spacing:1px;font-weight:800;color:var(--c,var(--green));
display:flex;align-items:center;gap:8px;flex-wrap:wrap;clear:both;}
.m-panel h2{font-size:23px;font-weight:800;margin:8px 0 0;letter-spacing:-.015em;line-height:1.15;}
.m-sum{font-size:15px;line-height:1.55;color:var(--ink);border-left:3px solid var(--c,var(--green));padding-left:13px;}
.m-badges{display:flex;flex-wrap:wrap;gap:6px;margin:2px 0 6px;}
.m-badge{font-size:11px;font-weight:700;padding:3px 10px;border-radius:999px;background:rgba(79,224,138,.12);border:1px solid rgba(79,224,138,.4);color:var(--ink);}
.m-ex{margin:2px 0 0;padding-left:19px;}
.m-ex li{font-size:14.5px;line-height:1.55;color:var(--ink);margin:4px 0;}
.m-syn{font-size:13.5px;color:var(--muted);}
.m-share{float:right;margin:2px 9px 0 0;height:38px;padding:0 15px;border-radius:999px;border:1px solid var(--line);background:transparent;color:var(--muted);font:700 12.5px/1 var(--sans);cursor:pointer;display:inline-flex;align-items:center;}
.m-share:active{border-color:var(--green);color:var(--ink);}
.card:focus-visible,.m-conn:focus-visible,.chip:focus-visible,.lchip:focus-visible,.tchip:focus-visible,.m-close:focus-visible,.m-btn:focus-visible,.m-share:focus-visible,.m-cmp-name:focus-visible{outline:2px solid var(--green);outline-offset:2px;border-radius:8px;}
.chip,.lchip,.tchip{min-height:44px;}
.m-close{width:44px !important;height:44px !important;}
.m-conn{cursor:pointer;}
.m-top{padding-left:calc(16px + env(safe-area-inset-left));padding-right:calc(16px + env(safe-area-inset-right));}
.m-chips,.m-levels,.m-tools,.m-list{padding-left:calc(16px + env(safe-area-inset-left));padding-right:calc(16px + env(safe-area-inset-right));}
.tchip svg,.m-custom svg{width:14px;height:14px;flex:0 0 auto;}
.m-iconbtn{margin-left:auto;width:38px;height:38px;flex:0 0 auto;border-radius:10px;border:1px solid var(--line);background:var(--card);color:var(--ink);display:inline-flex;align-items:center;justify-content:center;cursor:pointer;}
.m-iconbtn svg{width:19px;height:19px;}
.m-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;}
.m-btn svg,.m-share svg{width:15px;height:15px;flex:0 0 auto;}
.m-intro{margin:12px 16px 0;padding:15px 40px 15px 16px;border-radius:14px;border:1px solid var(--line);background:var(--card);position:relative;}
.m-intro h3{font-size:15.5px;font-weight:800;margin-bottom:5px;}
.m-intro p{font-size:13px;line-height:1.55;color:var(--muted);}
.m-intro .m-introclose{position:absolute;top:6px;right:6px;width:34px;height:34px;border:0;background:transparent;color:var(--muted);font-size:22px;line-height:1;cursor:pointer;}
.m-intro .m-introgo{margin-top:11px;display:inline-block;font-size:13px;font-weight:800;color:var(--green);text-decoration:none;}
.m-agentstat{margin:10px 0;padding:12px;border-radius:12px;background:color-mix(in srgb,var(--green) 12%,transparent);border:1px solid color-mix(in srgb,var(--green) 35%,transparent);font-size:13px;color:var(--ink);text-align:center;}
.m-agentstat b{color:var(--green);font-size:16px;}
a.m-btn{text-decoration:none;}
.m-provpill{font-size:9.5px;font-weight:800;letter-spacing:.4px;text-transform:uppercase;padding:1px 6px;border-radius:999px;margin-left:6px;border:1px solid var(--line);color:var(--muted);vertical-align:middle;white-space:nowrap;}
.m-provpill.curated{color:var(--gold);border-color:color-mix(in srgb,var(--gold) 45%,transparent);}
.m-htag{font-size:10px;font-weight:700;color:var(--gold);margin-left:5px;text-transform:none;letter-spacing:0;}
.m-cbridge{font-size:9px;font-weight:800;text-transform:uppercase;letter-spacing:.4px;color:#ffd7de;background:rgba(225,29,72,.85);padding:1px 6px;border-radius:999px;margin-left:6px;vertical-align:middle;}
.l-cap{align-self:center;font-size:10px;font-weight:800;text-transform:uppercase;letter-spacing:1px;color:var(--muted);margin-right:2px;white-space:nowrap;}
.m-prov{font-size:10px;font-weight:700;color:var(--gold);border:1px solid rgba(243,201,105,.45);border-radius:999px;padding:1px 6px;margin-left:5px;vertical-align:middle;}
.m-detail{margin-top:14px;font-size:14px;line-height:1.65;color:var(--muted);}
.m-h{font-size:11px;text-transform:uppercase;letter-spacing:1.2px;color:var(--muted);font-weight:800;margin:20px 0 8px;}
.m-when{font-size:14px;line-height:1.6;color:var(--ink);background:var(--card);border-radius:12px;padding:12px 14px;}
.m-code{background:#08120d;border:1px solid var(--line);border-radius:12px;padding:12px;overflow-x:auto;
font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;line-height:1.5;color:#bfe8cf;white-space:pre;}
.m-conns{display:flex;flex-direction:column;gap:7px;}
.m-conn{display:flex;align-items:center;gap:9px;padding:10px 11px;border:1px solid var(--line);border-radius:11px;
background:var(--card);cursor:pointer;font-size:13px;}
.m-conn:active{border-color:var(--green);}
.m-conn .dot{width:8px;height:8px;border-radius:2px;flex:0 0 auto;}
.m-conn .rel{font-size:10px;color:var(--muted);text-transform:uppercase;letter-spacing:.5px;flex:0 0 auto;}
.m-conn .to{font-weight:600;color:var(--ink);}
.m-refs a{display:block;color:var(--green);text-decoration:none;font-size:13px;padding:5px 0;}
@media (prefers-reduced-motion:reduce){ *{animation:none!important} }
/* My Map (personalization) */
.m-toprow{ display:flex; align-items:center; gap:10px; }
.m-custom{ margin-left:auto; flex:0 0 auto; display:inline-flex; align-items:center; gap:5px; padding:7px 12px; border-radius:999px; border:1px solid var(--line); background:var(--card); color:var(--ink); font-size:12.5px; font-weight:700; font-family:inherit; cursor:pointer; white-space:nowrap; }
.m-custom.on{ border-color:var(--green); color:var(--green); }
.m-brand .count{ margin-left:7px; }
.m-pick{ display:flex; flex-direction:column; gap:9px; }
.m-pick label{ display:flex; align-items:center; gap:11px; padding:11px 13px; border:1px solid var(--line); border-radius:12px; background:var(--card); font-size:14px; cursor:pointer; }
.m-pick input{ width:20px; height:20px; accent-color:var(--green); flex:0 0 auto; }
.m-pick .dot{ width:11px; height:11px; border-radius:3px; flex:0 0 auto; }
.m-pick .pc{ flex:1; font-weight:600; }
.m-pick .pn{ font-size:11px; color:var(--muted); }
.m-actions{ display:flex; gap:10px; margin-top:16px; }
.m-btn{ flex:1; padding:13px; border-radius:12px; border:1px solid var(--line); background:var(--card); color:var(--ink); font-size:14px; font-weight:700; font-family:inherit; cursor:pointer; }
.m-btn.primary{ background:linear-gradient(180deg,var(--green),var(--green-deep)); color:#06250f; border:0; }
.m-hint{ font-size:12.5px; color:var(--muted); margin-top:12px; text-align:center; }
.m-hint a{ color:var(--green); }
.m-path-note{ font-size:12.5px; line-height:1.5; color:var(--muted); background:var(--card); border:1px solid var(--line); border-radius:12px; padding:11px 13px; margin:2px 0 14px; }
.m-path-note a{ color:var(--green); text-decoration:none; font-weight:700; }
.m-toast{ position:fixed; left:50%; bottom:28px; transform:translateX(-50%) translateY(10px); background:#0f1c16; border:1px solid var(--line); color:var(--ink); padding:10px 16px; border-radius:999px; font-size:13px; font-weight:600; opacity:0; pointer-events:none; transition:opacity .2s, transform .2s; z-index:60; }
.m-toast.show{ opacity:1; transform:translateX(-50%) translateY(0); }
</style>
</head>
<body>
<header class="m-top">
<div class="m-toprow">
<a class="m-brand" href="index.html" aria-label="Kuber Map — back to home">
<svg viewBox="0 0 24 24" fill="none" aria-hidden="true"><path d="M12 6.2C10.4 4.5 6.7 4.6 5.1 7.6 3.3 10.9 5.7 15.9 12 22c6.3-6.1 8.7-11.1 6.9-14.4C17.3 4.6 13.6 4.5 12 6.2Z" fill="currentColor"/></svg>
Kuber Map <span class="count" id="count"></span>
</a>
<button class="m-iconbtn" id="themeToggle" type="button" aria-label="Toggle light or dark theme"></button>
<button class="m-custom" id="customize" type="button" aria-label="Build your learning map">Build map</button>
</div>
<input id="search" class="m-search" type="text" placeholder="Search concepts…" autocomplete="off" autocapitalize="off" aria-label="Search concepts" />
</header>
<nav class="m-tools" id="tools" aria-label="Interactive tools">
<button class="tchip" id="mAgents" type="button"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><rect x="4" y="8" width="16" height="11" rx="2"/><path d="M9 8V4M15 8V4M9 13h.01M15 13h.01M9.5 16h5"/></svg> For agents</button>
<button class="tchip" id="mWizard" type="button"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><circle cx="12" cy="12" r="9"/><polygon points="15.5 8.5 13.5 13.5 8.5 15.5 10.5 10.5" fill="currentColor" stroke="none"/></svg> Which concept?</button>
<button class="tchip" id="mPath" type="button"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M8 5v14l11-7z"/></svg> Guided Path</button>
<button class="tchip" id="mCompare" type="button"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><rect x="3" y="4" width="7" height="16" rx="1"/><rect x="14" y="4" width="7" height="16" rx="1"/></svg> Compare</button>
</nav>
<nav class="m-chips" id="chips" aria-label="Filter by cluster"></nav>
<nav class="m-levels" id="levels" aria-label="Filter by level"></nav>
<div id="intro" class="m-intro" hidden>
<button class="m-introclose" id="introClose" type="button" aria-label="Dismiss">×</button>
<h3>Welcome to Kuber Map</h3>
<p>A curated map of the <b>FIBO</b> financial ontology that grounds AI agents. You're on the curated <b>core</b> across 5 use cases — tap a chip (Loan, KYC, Securities…) to focus, or tap any concept for its definition, examples, and FIBO citation.</p>
<a class="m-introgo" id="introGo" href="#">Got it — explore →</a>
</div>
<main class="m-list" id="list"></main>
<div class="m-foot">Prefer the full graph? <a href="app.html?desktop=1">Open on desktop ↗</a> · <a href="https://github.com/AI-First-Community/kuber-map/wiki" target="_blank" rel="noopener">Docs</a></div>
<div class="m-sheet" id="sheet" role="dialog" aria-modal="true">
<div class="m-backdrop"></div>
<div class="m-panel" id="panel"></div>
</div>
<div class="m-sheet" id="pickSheet" role="dialog" aria-modal="true" aria-label="Build your learning map">
<div class="m-backdrop"></div>
<div class="m-panel" id="pickPanel"></div>
</div>
<div class="m-sheet" id="toolSheet" role="dialog" aria-modal="true" aria-label="Interactive tools">
<div class="m-backdrop"></div>
<div class="m-panel" id="toolPanel"></div>
</div>
<script src="js/data.js"></script>
<script>
(function () {
var nodes = GRAPH.nodes, edges = GRAPH.edges;
var byId = {}; nodes.forEach(function (n) { byId[n.id] = n; });
function ucShort(u){ if(/^Loan/i.test(u))return'Loan'; if(/^KYC/i.test(u))return'KYC'; if(/^Securities/i.test(u))return'Securities'; if(/^Regulatory/i.test(u))return'Reg reporting'; if(/^Derivatives/i.test(u))return'Derivatives'; return String(u).split(' (')[0]; }
var SUPER = {}; edges.forEach(function (e) { if (e.r === 'is-a' && byId[e.t]) (SUPER[e.s] = SUPER[e.s] || []).push(byId[e.t].label); });
function superclasses(id) { return SUPER[id] || []; }
function sumOf(n){ var t=(n.summary||'').trim(); if(t) return esc(t); var p=superclasses(n.id).slice(0,3).map(esc); return p.length ? ('A type of '+p.join(', ')+'. FIBO defines this class through its superclass and axioms rather than a text definition.') : 'A FIBO class defined structurally, through axioms rather than a text definition.'; }
var relLabel = {}; Object.keys(RELATIONS).forEach(function (k) { relLabel[k] = RELATIONS[k].label; });
var REL = (typeof RELEASE !== 'undefined' && RELEASE) ? RELEASE.version : null;
var active = 'core', q = '', myMap = [], activeLevel = null;
function esc(s) { return String(s == null ? '' : s).replace(/[&<>"]/g, function (m) { return { '&': '&', '<': '<', '>': '>', '"': '"' }[m]; }); }
var countEl = document.getElementById('count');
var UC = (function () { var seen = {}, out = []; nodes.forEach(function (n) { (n.useCases || []).forEach(function (u) { if (!seen[u]) { seen[u] = 1; out.push(u); } }); }); var order = ['Loan', 'KYC', 'Securities', 'Reg reporting', 'Derivatives']; out.sort(function (a, b) { return order.indexOf(ucShort(a)) - order.indexOf(ucShort(b)); }); return out; })();
(function () { var f = document.querySelector('.m-foot'); if (f && typeof RELEASE !== 'undefined' && RELEASE) f.insertAdjacentHTML('beforeend', ' · <span style="opacity:.6">' + (RELEASE.label || ('v' + RELEASE.version)) + '</span>'); })();
// cluster chips (rebuilt when My Map changes)
var chipsEl = document.getElementById('chips');
function chip(key, label) { return '<button class="chip' + (active === key ? ' active' : '') + '" data-cluster="' + esc(key) + '">' + esc(label) + '</button>'; }
function buildChips() {
var ch = '';
if (myMap.length) ch += chip('mymap', '★ My Map');
ch += chip('core', '★ Core');
UC.forEach(function (u) { ch += chip(u, ucShort(u)); });
ch += chip('all', 'All ' + nodes.length);
chipsEl.innerHTML = ch;
}
chipsEl.addEventListener('click', function (e) {
var b = e.target.closest('.chip'); if (!b) return;
active = b.getAttribute('data-cluster');
buildChips(); updateCustomBtn(); render();
});
var searchEl = document.getElementById('search');
var _searchT;
searchEl.addEventListener('input', function () { clearTimeout(_searchT); _searchT = setTimeout(function () { q = searchEl.value.trim().toLowerCase(); render(); }, 130); });
// level (1–5) filter
var levelsEl = document.getElementById('levels');
function buildLevels() {
var lv = '<span class="l-cap">Maturity</span><button class="lchip' + (activeLevel === null ? ' active' : '') + '" data-level="all">All</button>';
Object.keys(LEVELS).forEach(function (l) {
lv += '<button class="lchip' + (String(activeLevel) === l ? ' active' : '') + '" data-level="' + l + '">' + esc(LEVELS[l]) + '</button>';
});
levelsEl.innerHTML = lv;
}
levelsEl.addEventListener('click', function (e) {
var b = e.target.closest('.lchip'); if (!b) return;
var v = b.getAttribute('data-level');
activeLevel = (v === 'all') ? null : parseInt(v, 10);
buildLevels(); render();
});
// ---- My Map: personalized learning map (topics -> saved, shareable path) ----
var customBtn = document.getElementById('customize');
var pickSheet = document.getElementById('pickSheet'), pickPanel = document.getElementById('pickPanel');
function updateCustomBtn() {
customBtn.innerHTML = SVG.star + ' ' + (myMap.length ? 'My Map' : 'Build map');
customBtn.classList.toggle('on', active === 'mymap');
}
function setMyMap(arr) {
var seen = {}; myMap = arr.filter(function (id) { if (!CLUSTERS[id] || seen[id]) return false; seen[id] = 1; return true; });
try { if (myMap.length) localStorage.setItem('kuber-mymap', myMap.join(',')); else localStorage.removeItem('kuber-mymap'); } catch (e) {}
}
function toast(msg) {
var t = document.getElementById('mtoast');
if (!t) { t = document.createElement('div'); t.id = 'mtoast'; t.className = 'm-toast'; t.setAttribute('role', 'status'); t.setAttribute('aria-live', 'polite'); document.body.appendChild(t); }
t.textContent = msg; t.classList.add('show');
clearTimeout(t._h); t._h = setTimeout(function () { t.classList.remove('show'); }, 1800);
}
function shareMap(sel) {
sel = (sel && sel.length) ? sel : myMap;
var url = location.origin + location.pathname + (sel.length ? '#map=' + sel.join(',') : '');
if (navigator.share) { navigator.share({ title: 'My Kuber Map', text: 'My FIBO concept map', url: url }).catch(function () {}); }
else if (navigator.clipboard && navigator.clipboard.writeText) { navigator.clipboard.writeText(url).then(function () { toast('Link copied'); }).catch(function () { prompt('Copy your map link:', url); }); }
else { prompt('Copy your map link:', url); }
}
function openPicker() {
var checks = Object.keys(CLUSTERS).map(function (id) {
var c = CLUSTERS[id], on = myMap.indexOf(id) !== -1;
var cnt = nodes.filter(function (n) { return n.cluster === id; }).length;
return '<label><input type="checkbox" value="' + id + '"' + (on ? ' checked' : '') + '><span class="dot" style="background:' + c.color + '"></span><span class="pc">' + esc(c.label) + '</span><span class="pn">' + cnt + '</span></label>';
}).join('');
pickPanel.innerHTML =
'<div class="m-head"><div class="m-grab"></div><button class="m-close" aria-label="Close">×</button>' +
'<div class="m-tag" style="--c:var(--green)">Build your learning map</div><h2>Pick your topics</h2></div>' +
'<div class="m-body"><div class="m-path-note">Choose the clusters you want to focus on. Your map is saved on this device and shareable as a link.</div>' +
'<div class="m-pick">' + checks + '</div>' +
'<div class="m-actions"><button class="m-btn" id="pkShare" type="button">' + SVG.share + ' Share</button><button class="m-btn primary" id="pkSave" type="button">Save & view</button></div>' +
(myMap.length ? '<div class="m-hint"><a href="#" id="pkClear">Clear my map</a></div>' : '') +
'</div>';
if (!anyOpen()) _trigger = document.activeElement;
pickSheet.classList.add('open'); pickPanel.scrollTop = 0; document.body.style.overflow = 'hidden';
bgLock(); onSheetOpen(null); focusSheet(pickPanel);
}
function closePicker() { pickSheet.classList.remove('open'); document.body.style.overflow = ''; bgUnlock(); }
function selectedInPicker() { return [].slice.call(pickPanel.querySelectorAll('input:checked')).map(function (i) { return i.value; }); }
customBtn.addEventListener('click', openPicker);
pickSheet.addEventListener('click', function (e) {
if (e.target.classList.contains('m-backdrop') || e.target.classList.contains('m-close')) { requestClose(); return; }
var id = e.target.id;
if (id === 'pkSave') {
setMyMap(selectedInPicker());
active = myMap.length ? 'mymap' : 'all';
buildChips(); updateCustomBtn(); render();
requestClose();
if (myMap.length) toast('Saved your map');
} else if (id === 'pkShare') {
var s = selectedInPicker();
if (!s.length) { toast('Pick at least one topic first'); return; }
shareMap(s);
} else if (id === 'pkClear') {
e.preventDefault(); setMyMap([]); active = 'all'; buildChips(); updateCustomBtn(); render(); requestClose();
}
});
var listEl = document.getElementById('list');
function matches(n) {
if (active === 'mymap') { if (myMap.indexOf(n.cluster) === -1) return false; }
else if (active === 'core') { if (!n.core) return false; }
else if (active !== 'all') { if (!n.useCases || n.useCases.indexOf(active) === -1) return false; }
if (activeLevel !== null && n.level !== activeLevel) return false;
if (q) {
var hay = (n.label + ' ' + n.summary + ' ' + (n.synonyms || []).join(' ') + ' ' + (n.useCases || []).map(ucShort).join(' ')).toLowerCase();
if (hay.indexOf(q) === -1) return false;
}
return true;
}
function card(n) {
var c = CLUSTERS[n.cluster] || { color: '#888' };
var isNew = REL && n.added === REL;
return '<div class="card" role="button" tabindex="0" data-id="' + n.id + '" style="--c:' + c.color + '">' +
'<h3>' + esc(n.label) + (isNew ? ' <span class="newb">NEW</span>' : '') + '<span class="lvl" title="' + esc(LEVELS[n.level] || '') + '">' + esc((LEVELS[n.level] || '?').charAt(0)) + '</span></h3>' +
'<p>' + sumOf(n) + '</p></div>';
}
var CHUNK = 50, _rows = [], _ri = 0, _io = null;
function render() {
var items = nodes.filter(matches);
countEl.textContent = items.length + (active === 'all' ? ' total' : active === 'core' ? ' curated core' : active === 'mymap' ? ' in your map' : ' concepts');
if (_io) { _io.disconnect(); _io = null; }
_rows = []; _ri = 0; listEl.innerHTML = '';
if (!items.length) { listEl.innerHTML = '<div class="empty">No concepts match “' + esc(q) + '”.</div>'; return; }
if (active === 'mymap' && !q) {
_rows.push('<div class="m-path-note">Your map · ' + myMap.length + ' topics · ' + items.length + ' concepts, grouped by <b>FIBO maturity</b>. <a href="#" id="editmap">Edit</a> · <a href="#" id="sharemap">Share</a></div>');
Object.keys(LEVELS).forEach(function (lvl) {
var g = items.filter(function (n) { return String(n.level) === String(lvl); });
if (!g.length) return;
_rows.push('<div class="m-group-title">' + esc(LEVELS[lvl]) + ' · ' + g.length + '</div>');
g.forEach(function (n) { _rows.push(card(n)); });
});
} else if (!q) {
Object.keys(CLUSTERS).forEach(function (cid) {
var g = items.filter(function (n) { return n.cluster === cid; });
if (!g.length) return;
_rows.push('<div class="m-group-title">' + esc(CLUSTERS[cid].label) + ' · ' + g.length + '</div>');
g.forEach(function (n) { _rows.push(card(n)); });
});
} else {
items.forEach(function (n) { _rows.push(card(n)); });
}
appendChunk();
}
function appendChunk() {
var end = Math.min(_ri + CHUNK, _rows.length), html = '';
for (; _ri < end; _ri++) html += _rows[_ri];
var sent = listEl.querySelector('.m-sentinel'); if (sent) sent.remove();
listEl.insertAdjacentHTML('beforeend', html);
if (_ri < _rows.length) {
listEl.insertAdjacentHTML('beforeend', '<div class="m-sentinel" style="height:1px"></div>');
if (!_io) _io = new IntersectionObserver(function (en) { if (en[0].isIntersecting) appendChunk(); }, { rootMargin: '800px' });
_io.observe(listEl.querySelector('.m-sentinel'));
} else if (_io) { _io.disconnect(); _io = null; }
}
listEl.addEventListener('click', function (e) {
if (e.target.id === 'editmap') { e.preventDefault(); openPicker(); return; }
if (e.target.id === 'sharemap') { e.preventDefault(); shareMap(myMap); return; }
var c = e.target.closest('.card'); if (!c) return;
openSheet(c.getAttribute('data-id'));
});
// detail sheet
var sheet = document.getElementById('sheet'), panel = document.getElementById('panel');
// ---- a11y + history: focus trap via inert, focus restore, hardware-back closes sheets ----
var _bgEls = ['header.m-top', '#tools', '#chips', '#levels', '#list', '.m-foot'].map(function (x) { return document.querySelector(x); });
var _trigger = null, _pushed = false;
function bgLock() { _bgEls.forEach(function (el) { if (el) el.setAttribute('inert', ''); }); }
function bgUnlock() { _bgEls.forEach(function (el) { if (el) el.removeAttribute('inert'); }); }
function anyOpen() { return sheet.classList.contains('open') || pickSheet.classList.contains('open') || toolSheet.classList.contains('open'); }
function focusSheet(pnl) { var f = pnl.querySelector('.m-close'); if (f) setTimeout(function () { try { f.focus(); } catch (e) {} }, 30); }
function onSheetOpen(hash) {
if (!_pushed) { _pushed = true; try { history.pushState({ kmSheet: 1 }, ''); } catch (e) {} }
if (hash != null) { try { history.replaceState(history.state || { kmSheet: 1 }, '', '#c=' + hash); } catch (e) {} }
}
function closeAll() {
sheet.classList.remove('open'); pickSheet.classList.remove('open'); toolSheet.classList.remove('open');
bgUnlock(); document.body.style.overflow = '';
if (location.hash.indexOf('c=') !== -1) { try { history.replaceState(null, '', location.pathname + location.search); } catch (e) {} }
if (_trigger && _trigger.focus) { try { _trigger.focus(); } catch (e) {} } _trigger = null;
}
function requestClose() { if (_pushed) { _pushed = false; try { history.back(); return; } catch (e) {} } closeAll(); }
window.addEventListener('popstate', function () { if (anyOpen()) { _pushed = false; closeAll(); } });
function shareConcept(id) {
var n = byId[id]; if (!n) return;
var url = location.origin + location.pathname + '#c=' + id;
if (navigator.share) { navigator.share({ title: n.label + ' — Kuber Map', url: url }).catch(function () {}); }
else if (navigator.clipboard && navigator.clipboard.writeText) { navigator.clipboard.writeText(url).then(function () { toast('Link copied'); }).catch(function () { prompt('Copy link:', url); }); }
else { prompt('Copy link:', url); }
}
// Enter/Space activates role="button" content controls (cards, connection rows, compare cells)
document.addEventListener('keydown', function (e) {
if (e.key !== 'Enter' && e.key !== ' ') return;
var b = e.target && e.target.closest && e.target.closest('.card[role="button"], .m-conn[role="button"], .m-cmp-name[role="button"]');
if (b && e.target === b) { e.preventDefault(); b.click(); }
});
function connsFor(id) {
var out = [];
edges.forEach(function (edge) {
if (edge.r === 'path') return;
var br = !!(edge.bridge || edge.provenance === 'curated');
if (edge.s === id && byId[edge.t]) out.push({ rel: relLabel[edge.r] || edge.r, to: byId[edge.t], bridge: br });
else if (edge.t === id && byId[edge.s]) out.push({ rel: relLabel[edge.r] || edge.r, to: byId[edge.s], rev: true, bridge: br });
});
return out;
}
function openSheet(id) {
var n = byId[id]; if (!n) return;
if (!anyOpen()) _trigger = document.activeElement;
var c = CLUSTERS[n.cluster] || { color: '#888', label: '' };
var isNew = REL && n.added === REL, conns = connsFor(id);
var html = '<div class="m-head"><div class="m-grab"></div><button class="m-close" aria-label="Close">×</button><button class="m-share" data-share="' + id + '" aria-label="Share this concept">' + SVG.share + ' Share</button>' +
'<div class="m-tag" style="--c:' + c.color + '">' + esc(c.label) + ' · ' + esc(LEVELS[n.level] || '') + (n.definitionProvenance === 'curated' ? ' <span class="m-provpill curated">curated def</span>' : ' <span class="m-provpill">FIBO</span>') + (isNew ? ' <span class="newb">NEW</span>' : '') + '</div>' +
'<h2 id="sheetTitle">' + esc(n.label) + '</h2></div>' +
'<div class="m-body"><div class="m-sum" style="--c:' + c.color + '">' + sumOf(n) + '</div>';
if (n.useCases && n.useCases.length) html += '<div class="m-badges">' + n.useCases.map(function (u) { return '<span class="m-badge">' + esc(ucShort(u)) + '</span>'; }).join('') + '</div>';
if (n.detail) html += '<div class="m-detail">' + esc(n.detail) + (n.detailProvenance === 'curated' ? ' <span class="m-prov">curated</span>' : '') + '</div>';
if (n.examples && n.examples.length) html += '<div class="m-h">Examples' + (n.examplesProvenance === 'curated' ? ' <span class="m-htag">illustrative</span>' : '') + '</div><ul class="m-ex">' + n.examples.map(function (x) { return '<li>' + esc(x) + '</li>'; }).join('') + '</ul>';
if (n.synonyms && n.synonyms.length) html += '<div class="m-h">Also known as</div><div class="m-syn">' + n.synonyms.map(esc).join(' · ') + '</div>';
if (conns.length) {
html += '<div class="m-h">Connections</div><div class="m-conns">';
conns.forEach(function (cn) {
var cc = CLUSTERS[cn.to.cluster] || { color: '#888' };
html += '<div class="m-conn" role="button" tabindex="0" data-id="' + cn.to.id + '"><span class="dot" style="background:' + cc.color + '"></span><span class="rel">' + esc(cn.rel) + (cn.rev ? ' ←' : '') + (cn.bridge ? ' <span class="m-cbridge">bridge</span>' : '') + '</span><span class="to">' + esc(cn.to.label) + '</span></div>';
});
html += '</div>';
}
if (n.refs && n.refs.length) {
html += '<div class="m-h">FIBO source (citation)</div><div class="m-refs">';
n.refs.forEach(function (r) { html += '<a href="' + esc(r.u) + '" target="_blank" rel="noopener">' + esc(r.t) + ' ↗</a>'; });
html += '</div>';
}
html += '</div>';
panel.innerHTML = html;
sheet.setAttribute('aria-labelledby', 'sheetTitle');
sheet.classList.add('open');
requestAnimationFrame(function () { panel.scrollTop = 0; });
document.body.style.overflow = 'hidden';
bgLock(); onSheetOpen(id); focusSheet(panel);
}
sheet.addEventListener('click', function (e) {
if (e.target.classList.contains('m-backdrop') || e.target.classList.contains('m-close')) { requestClose(); return; }
var sh = e.target.closest('[data-share]'); if (sh) { shareConcept(sh.getAttribute('data-share')); return; }
var conn = e.target.closest('.m-conn'); if (conn) openSheet(conn.getAttribute('data-id'));
});
// ---- Interactive tools: decision wizard, guided path, compare (parity with desktop) ----
var toolSheet = document.getElementById('toolSheet'), toolPanel = document.getElementById('toolPanel');
function setTool(headHtml, bodyHtml) {
var wasOpen = anyOpen(); if (!wasOpen) _trigger = document.activeElement;
toolPanel.innerHTML =
'<div class="m-head"><div class="m-grab"></div><button class="m-close" aria-label="Close">×</button>' + headHtml + '</div>' +
'<div class="m-body">' + bodyHtml + '</div>';
toolSheet.classList.add('open');
requestAnimationFrame(function () { toolPanel.scrollTop = 0; });
document.body.style.overflow = 'hidden';
bgLock(); onSheetOpen(null); if (!wasOpen) focusSheet(toolPanel);
}
function closeTool() { toolSheet.classList.remove('open'); document.body.style.overflow = ''; bgUnlock(); }
// Decision wizard
var DT = GRAPH.decisionTree;
function startWizard() { renderWizardStep(DT.start); }
function renderWizardStep(id) {
var step = DT.steps[id]; if (!step) return;
var ans = step.a.map(function (a, i) {
return '<button class="m-btn m-ans" data-w="ans" data-step="' + id + '" data-i="' + i + '">' + esc(a.label) + '</button>';
}).join('');
setTool('<div class="m-tag" style="--c:var(--green)">Which concept?</div><h2>' + esc(step.q) + '</h2>',
'<div class="m-anslist">' + ans + '</div>');
}
function renderWizardRec(a) {
var n = byId[a.rec], c = n ? (CLUSTERS[n.cluster] || { color: '#888', label: '' }) : { color: 'var(--green)', label: '' };
var body = '<div class="m-reccard" style="--c:' + c.color + '">' +
'<div class="m-tag" style="--c:' + c.color + '">' + esc(c.label) + ' · Recommended</div>' +
'<h2>' + esc(n ? n.label : a.rec) + '</h2>' +
(n ? '<div class="m-sum" style="--c:' + c.color + '">' + esc(n.summary) + '</div>' : '') +
(a.why ? '<div class="m-detail">' + esc(a.why) + '</div>' : '') + '</div>' +
'<div class="m-actions"><button class="m-btn" data-w="restart">↺ Start over</button>' +
(n ? '<button class="m-btn primary" data-w="open" data-id="' + a.rec + '">Open in graph →</button>' : '') + '</div>' +
(a.then ? '<div class="m-hint" style="text-align:center"><a href="#" data-w="cont" data-step="' + a.then + '">Continue — one more question ↓</a></div>' : '');
setTool('<div class="m-tag" style="--c:var(--green)">Recommendation</div><h2>' + esc(n ? n.label : a.rec) + '</h2>', body);
}
// Guided path
var GP = GRAPH.guidedPath, pathIdx = 0;
function startPath() { pathIdx = 0; renderPathStep(); }
function renderPathStep() {
var s = GP.steps[pathIdx], n = byId[s.id], c = n ? (CLUSTERS[n.cluster] || { color: '#888', label: '' }) : { color: 'var(--green)', label: '' };
var body = '<div class="m-path-note">Step ' + (pathIdx + 1) + ' / ' + GP.steps.length + '</div>' +
'<div class="m-reccard" style="--c:' + c.color + '">' +
'<div class="m-tag" style="--c:' + c.color + '">' + esc(c.label) + (n ? ' · L' + n.level : '') + '</div>' +
'<h2>' + esc(n ? n.label : s.id) + '</h2>' +
'<div class="m-detail">' + esc(s.note) + '</div></div>' +
'<div class="m-actions">' +
'<button class="m-btn" data-w="pprev"' + (pathIdx === 0 ? ' disabled' : '') + '>← Prev</button>' +
(n ? '<button class="m-btn" data-w="popen">Open detail</button>' : '') +
'<button class="m-btn primary" data-w="pnext"' + (pathIdx === GP.steps.length - 1 ? ' disabled' : '') + '>' + (pathIdx === GP.steps.length - 1 ? 'Done ✓' : 'Next →') + '</button></div>';
setTool('<div class="m-tag" style="--c:var(--green)">Guided Path</div><h2>' + esc(GP.title) + '</h2>', body);
}
// Compare tables
var CMP = GRAPH.comparisons, cmpIdx = 0;
function startCompare() { cmpIdx = 0; renderCompare(); }
function renderCompare() {
var set = CMP[cmpIdx];
var tabs = CMP.map(function (s, i) {
return '<button class="tchip' + (i === cmpIdx ? ' active' : '') + '" data-w="ctab" data-i="' + i + '">' + esc(s.title) + '</button>';
}).join('');
var thead = '<th>Technique</th>' + set.dimensions.map(function (d) { return '<th>' + esc(d.label) + '</th>'; }).join('');
var rows = set.rows.map(function (r) {
var n = byId[r.id];
var name = n ? '<td class="m-cmp-name" role="button" tabindex="0" data-w="copen" data-id="' + r.id + '">' + esc(n.label) + '</td>' : '<td>' + esc(r.id) + '</td>';
var tds = set.dimensions.map(function (d) { return '<td>' + esc(r[d.key] == null ? '' : r[d.key]) + '</td>'; }).join('');
return '<tr>' + name + tds + '</tr>';
}).join('');
var body = '<div class="m-cmp-tabs">' + tabs + '</div>' +
'<div class="m-detail">' + esc(set.blurb) + '</div>' +
'<div class="m-cmp-scroll"><table class="m-cmp"><thead><tr>' + thead + '</tr></thead><tbody>' + rows + '</tbody></table></div>' +
'<div class="m-hint">Tap a concept to open its detail.</div>';
setTool('<div class="m-tag" style="--c:var(--green)">Compare</div><h2>' + esc(set.title) + '</h2>', body);
}
toolSheet.addEventListener('click', function (e) {
if (e.target.classList.contains('m-backdrop') || e.target.classList.contains('m-close')) { requestClose(); return; }
var t = e.target.closest('[data-w]'); if (!t) return;
var w = t.getAttribute('data-w');
if (w === 'ans') {
var st = DT.steps[t.getAttribute('data-step')], a = st.a[parseInt(t.getAttribute('data-i'), 10)];
if (a.rec) renderWizardRec(a); else if (a.next) renderWizardStep(a.next);
} else if (w === 'restart') { startWizard(); }
else if (w === 'cont') { e.preventDefault(); renderWizardStep(t.getAttribute('data-step')); }
else if (w === 'pprev') { if (pathIdx > 0) { pathIdx--; renderPathStep(); } }
else if (w === 'pnext') { if (pathIdx < GP.steps.length - 1) { pathIdx++; renderPathStep(); } }
else if (w === 'ctab') { cmpIdx = parseInt(t.getAttribute('data-i'), 10); renderCompare(); }
else if (w === 'open' || w === 'popen' || w === 'copen') {
var id = w === 'popen' ? GP.steps[pathIdx].id : t.getAttribute('data-id');
closeTool(); openSheet(id);
}
});
document.getElementById('mWizard').addEventListener('click', startWizard);
document.getElementById('mPath').addEventListener('click', startPath);
document.getElementById('mCompare').addEventListener('click', startCompare);
window.addEventListener('keydown', function (e) { if (e.key === 'Escape' && anyOpen()) requestClose(); });
// init My Map from a shared link (#map=cluster,cluster) or saved preference
var hm = (location.hash.match(/map=([^&]+)/) || [])[1];
if (hm) { setMyMap(decodeURIComponent(hm).split(',')); active = myMap.length ? 'mymap' : 'all'; }
else { try { var sv = localStorage.getItem('kuber-mymap'); if (sv) myMap = sv.split(',').filter(function (id) { return CLUSTERS[id]; }); } catch (e) {} }
var SVG = {
star: '<svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2l2.9 6.3 6.9.7-5.1 4.6 1.4 6.8L12 17.8 5.9 20.4l1.4-6.8L2.2 9l6.9-.7z"/></svg>',
share: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/><path d="M8.6 13.5l6.8 4M15.4 6.5l-6.8 4"/></svg>',
sun: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/></svg>',
moon: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12.8A8 8 0 1 1 11.2 3 6 6 0 0 0 21 12.8z"/></svg>'
};
// theme toggle (dark <-> light), persisted; icon shows the target theme
var themeBtn = document.getElementById('themeToggle');
function paintThemeIcon() { themeBtn.innerHTML = document.documentElement.getAttribute('data-theme') === 'light' ? SVG.moon : SVG.sun; }
themeBtn.addEventListener('click', function () {
var next = document.documentElement.getAttribute('data-theme') === 'light' ? 'dark' : 'light';
document.documentElement.setAttribute('data-theme', next);
try { localStorage.setItem('kuber-theme', next); } catch (e) {}
paintThemeIcon();
});
paintThemeIcon();
// "For agents" — surface the grounding value + eval headline
function startAgents() {
setTool('<div class="m-tag" style="--c:var(--green)">Grounding for AI agents</div><h2>Ground your agent in FIBO</h2>',
'<div class="m-detail">Kuber Map exports each use case as a portable <b>context pack</b> an AI agent retrieves and cites. Every concept carries its FIBO IRI, so answers are traceable and auditable.</div>' +
'<div class="m-agentstat"><b>+45pt</b> accuracy · <b>0%</b> hallucination · <b>97%</b> auditable</div>' +
'<div class="m-hint" style="text-align:left">Measured grounded vs ungrounded across 263 questions in 5 domains on gpt-4o-mini; the lift held on gpt-4o.</div>' +
'<div class="m-actions" style="flex-direction:column;gap:8px"><a class="m-btn primary" href="https://github.com/AI-First-Community/kuber-map/wiki/For-AI-Teams" target="_blank" rel="noopener">For AI Teams — how to use a pack →</a><a class="m-btn" href="https://github.com/AI-First-Community/kuber-map/wiki/Value-Proof" target="_blank" rel="noopener">See the value proof →</a></div>');
}
document.getElementById('mAgents').addEventListener('click', startAgents);
buildChips(); buildLevels(); updateCustomBtn();
render();
// first-run intro card
(function () {
var intro = document.getElementById('intro');
try { if (localStorage.getItem('kuber-welcomed')) return; } catch (e) {}
intro.hidden = false;
function dismiss(e) { if (e) e.preventDefault(); intro.hidden = true; try { localStorage.setItem('kuber-welcomed', '1'); } catch (e2) {} }
document.getElementById('introClose').addEventListener('click', dismiss);
document.getElementById('introGo').addEventListener('click', dismiss);
})();
(function () { var hc = (location.hash.match(/[#&]c=([^&]+)/) || [])[1]; if (hc) { hc = decodeURIComponent(hc); if (byId[hc]) openSheet(hc); } })();
})();
</script>
<script src="js/sw-register.js"></script>
</body>
</html>