Repository navigation
Expand file tree
/
Copy path3d.html
More file actions
1668 lines (1594 loc) · 109 KB
/
Copy path3d.html
File metadata and controls
1668 lines (1594 loc) · 109 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
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<!--
Flow Explainer
Made by Solution Forest Limited · Hong Kong
https://solutionforest.net/
https://github.com/solutionforest/flow-explainer (MIT)
-->
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="author" content="Solution Forest Limited">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<title>Flow Explainer 3D · Turn Mermaid diagrams into animated 3D walkthroughs</title>
<meta name="description" content="Paste a GitHub markdown file with a Mermaid diagram and get an animated, step-by-step walkthrough you can send to a client. 2D and 3D, 23 diagram types, runs in your browser. Free and open source.">
<meta name="robots" content="index, follow">
<link rel="canonical" href="https://flow-explainer.laravel.cloud/3d">
<meta name="theme-color" content="#007c90">
<link rel="icon" href="favicon.svg" type="image/svg+xml">
<link rel="icon" href="favicon.ico" sizes="48x48">
<link rel="apple-touch-icon" href="apple-touch-icon.png">
<link rel="manifest" href="site.webmanifest">
<!-- social sharing (Open Graph: Facebook, LinkedIn, WhatsApp, Slack; Twitter / X card) -->
<meta property="og:type" content="website">
<meta property="og:site_name" content="Flow Explainer">
<meta property="og:title" content="Flow Explainer 3D · Turn Mermaid diagrams into animated 3D walkthroughs">
<meta property="og:description" content="Paste a GitHub markdown file with a Mermaid diagram and get an animated, step-by-step walkthrough you can send to a client. 2D and 3D, 23 diagram types, runs in your browser. Free and open source.">
<meta property="og:url" content="https://flow-explainer.laravel.cloud/3d">
<meta property="og:image" content="https://flow-explainer.laravel.cloud/og-image.png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:alt" content="Flow Explainer: a Mermaid diagram played step by step in 3D, on desktop and phone">
<meta property="og:locale" content="en_US">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Flow Explainer 3D · Turn Mermaid diagrams into animated 3D walkthroughs">
<meta name="twitter:description" content="Paste a GitHub markdown file with a Mermaid diagram and get an animated, step-by-step walkthrough you can send to a client. 2D and 3D, 23 diagram types, runs in your browser. Free and open source.">
<meta name="twitter:image" content="https://flow-explainer.laravel.cloud/og-image.png">
<meta name="twitter:image:alt" content="Flow Explainer: a Mermaid diagram played step by step in 3D, on desktop and phone">
<script type="application/ld+json">{"@context":"https://schema.org","@type":"WebApplication","name":"Flow Explainer","url":"https://flow-explainer.laravel.cloud/","description":"Paste a GitHub markdown file with a Mermaid diagram and get an animated, step-by-step walkthrough you can send to a client. 2D and 3D, 23 diagram types, runs in your browser. Free and open source.","applicationCategory":"DeveloperApplication","operatingSystem":"Any (web browser)","browserRequirements":"Requires JavaScript and WebGL","isAccessibleForFree":true,"offers":{"@type":"Offer","price":"0","priceCurrency":"USD"},"license":"https://opensource.org/licenses/MIT","image":"https://flow-explainer.laravel.cloud/og-image.png","screenshot":"https://flow-explainer.laravel.cloud/docs/images/player-desktop.png","author":{"@type":"Organization","name":"Solution Forest Limited","url":"https://solutionforest.net/"},"sameAs":["https://github.com/solutionforest/flow-explainer"]}</script>
<style>
@font-face{font-family:"Inter";font-style:normal;font-weight:400 700;font-display:swap;src:url(vendor/inter-latin.woff2) format("woff2")}
@font-face{font-family:"Raleway";font-style:normal;font-weight:700;font-display:swap;src:url(vendor/raleway-700-latin.woff2) format("woff2")}
:root{
/* site colours (Solution Forest) */
--brand:#007c90; --brand-600:#006577; --brand-50:#e6f4f6; --brand-100:#c4e6eb; --amber:#fcaf17;
--paper:#f8fafc; --card:#fff; --ink:#0f172a; --ink-2:#334155; --muted:#64748b; --line:#e2e8f0; --line-2:#cbd5e1;
--accent:var(--brand); --ok:#2f9e6b;
--mono:ui-monospace,"SF Mono",Menlo,Consolas,monospace;
--sans:"Inter",ui-sans-serif,system-ui,-apple-system,"Segoe UI","PingFang HK","Noto Sans TC",sans-serif;
--head:"Raleway","Inter",ui-sans-serif,system-ui,sans-serif;
--shadow-sm:0 1px 2px rgba(15,23,42,.06);
--shadow-lg:0 14px 34px -10px rgba(15,23,42,.22),0 2px 6px rgba(15,23,42,.06);
/* diagram colours: set by the active diagram style (STYLES in the script); these are the Original values */
--d-sans:ui-sans-serif,system-ui,-apple-system,"Segoe UI","PingFang HK","Noto Sans TC",sans-serif;
--d-mono:ui-monospace,"SF Mono",Menlo,Consolas,monospace;
--d-bg:#f5f0e6; --d-bg2:#fbf7ee; --d-ink:#1f2430; --d-accent:#ee5a3a; --d-accent-fg:#fff;
--d-plate:#fffdf8; --d-plate-fg:#1f2430; --d-plate-bd:#1f2430; --d-on:#1f2430; --d-on-fg:#f5f0e6; --d-muted:#6b6f7b;
--d-zone:rgba(31,36,48,.035); --d-zone-bd:rgba(31,36,48,.45); --d-chip:rgba(245,240,230,.75); --d-lab-shadow:rgba(31,36,48,.2); --d-lab:var(--d-sans);
}
*{box-sizing:border-box}
[hidden]{display:none!important}
html,body{margin:0;height:100%}
body{font-family:var(--sans);color:var(--ink);background:var(--paper);overflow:hidden;-webkit-font-smoothing:antialiased}
button,select,textarea,input{font:inherit;color:inherit}
svg.i{width:15px;height:15px;flex:none}
.app{display:grid;grid-template-rows:auto minmax(0,1fr) auto;grid-template-columns:minmax(0,1fr);height:100dvh;width:100%;overflow:hidden}
header{display:flex;align-items:center;gap:8px;padding:10px 16px;border-bottom:1px solid var(--line);background:rgba(255,255,255,.92);position:relative;z-index:30}
.brand{font:700 15px/1 var(--head);letter-spacing:-.01em;white-space:nowrap;display:flex;align-items:center;gap:7px}
.brand small{font:600 10px/1.4 var(--mono);color:var(--brand);border:1px solid var(--brand-100);background:var(--brand-50);border-radius:5px;padding:0 5px;letter-spacing:.04em}
.doc-title{font-size:14px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;padding-left:12px;margin-left:4px;border-left:1px solid var(--line)}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:34px;border:1px solid var(--line);background:var(--card);border-radius:8px;padding:6px 12px;font-size:13px;font-weight:500;line-height:1.2;color:var(--ink-2);cursor:pointer;white-space:nowrap;box-shadow:var(--shadow-sm);text-decoration:none;transition:background .15s,border-color .15s,color .15s}
.btn:hover{background:var(--paper);border-color:var(--line-2)}
.btn:focus-visible,.dot:focus-visible,.opt:focus-visible,.stepper li:focus-visible,.steps summary:focus-visible{outline:2px solid var(--brand);outline-offset:2px}
.btn.primary{background:var(--brand);border-color:var(--brand);color:#fff}
.btn.primary:hover{background:var(--brand-600);border-color:var(--brand-600)}
.btn.ghost{box-shadow:none}
.btn.icon{width:34px;padding:0}
.btn.on{background:var(--brand-50);border-color:var(--brand);color:var(--brand)}
.btn:disabled{opacity:.45;cursor:default}
select.btn{appearance:none;padding-right:28px;background-image:linear-gradient(45deg,transparent 50%,var(--muted) 50%),linear-gradient(135deg,var(--muted) 50%,transparent 50%);background-position:calc(100% - 15px) 55%,calc(100% - 10px) 55%;background-size:5px 5px;background-repeat:no-repeat;max-width:200px}
main{display:grid;grid-template-columns:minmax(0,1fr) 370px;min-height:0;min-width:0}
.stage{position:relative;min-height:0;background:radial-gradient(circle at 50% 40%,var(--d-bg2) 0,var(--d-bg) 70%);overflow:hidden}
.stage-tools{position:absolute;right:12px;top:12px;display:flex;gap:6px;z-index:2}
.stage-tools .btn{background:rgba(255,255,255,.92)}
.legend{position:absolute;left:12px;bottom:10px;display:flex;flex-wrap:wrap;gap:6px;max-width:80%;z-index:2}
.legend i{display:inline-flex;align-items:center;gap:6px;font-style:normal;font-size:11px;font-family:var(--mono);color:var(--ink-2);background:rgba(255,255,255,.92);border:1px solid var(--line);border-radius:999px;padding:2px 9px}
.legend b{width:9px;height:9px;border-radius:3px;border:1px solid rgba(15,23,42,.35)}
.panel{border-left:1px solid var(--line);background:var(--card);padding:22px 22px 16px;overflow:auto;display:flex;flex-direction:column;gap:14px;min-height:0}
.kicker{font:500 11px var(--mono);letter-spacing:.08em;color:var(--brand);display:flex;gap:8px;align-items:center;flex-wrap:wrap;text-transform:uppercase}
.chip{background:#fff6e0;color:#8a5a00;border:1px solid #f7d58a;border-radius:999px;padding:0 8px;letter-spacing:0;font-weight:600;text-transform:none}
.panel h2{margin:0;font:700 23px/1.22 var(--head);letter-spacing:-.015em;overflow-wrap:anywhere}
.panel>*{min-width:0}
footer,header{min-width:0}
.panel p{margin:0;font-size:15px;line-height:1.65;color:var(--ink-2)}
.panel p b{color:var(--ink);font-weight:600}
.panel code{font-family:var(--mono);font-size:.88em;background:var(--paper);border:1px solid var(--line);padding:0 4px;border-radius:4px}
.note{border:1px solid var(--line);border-left:3px solid var(--amber);border-radius:8px;padding:10px 12px;font-size:13.5px;line-height:1.55;background:var(--paper);color:var(--ink-2)}
.note b.t{display:block;font:500 10.5px var(--mono);color:var(--muted);letter-spacing:.08em;margin-bottom:3px}
.nav{display:flex;gap:8px;margin-top:2px}
.nav .btn{flex:1;min-height:38px}
/* all steps: stepper */
.steps{border-top:1px dashed var(--line-2);padding-top:14px;margin-top:2px}
.steps summary{list-style:none;display:flex;align-items:center;gap:10px;cursor:pointer;margin-bottom:12px;border-radius:6px}
.steps summary::-webkit-details-marker{display:none}
.steps .h{font:500 11px var(--mono);letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.steps .cnt{margin-left:auto;font:500 11px var(--mono);color:var(--muted)}
.steps .chev{width:14px;height:14px;color:var(--muted);transition:transform .2s;display:none}
.steps[open] .chev{transform:rotate(180deg)}
.prog{height:3px;border-radius:3px;background:var(--line);overflow:hidden;margin:-4px 0 12px}
.prog i{display:block;height:100%;background:var(--brand);border-radius:3px;transition:width .3s}
.stepper{list-style:none;margin:0;padding:0;display:flex;flex-direction:column}
.stepper li{position:relative;display:flex;gap:12px;cursor:pointer;border-radius:10px}
.stepper li::before{content:"";position:absolute;left:13px;top:30px;bottom:-2px;width:2px;background:var(--line)}
.stepper li:last-child::before{display:none}
.stepper li.done::before{background:var(--brand)}
.stepper .mk{flex:none;width:28px;height:28px;border-radius:50%;display:grid;place-items:center;font:600 11.5px var(--mono);background:var(--card);border:1.5px solid var(--line-2);color:var(--muted);position:relative;z-index:1;margin:6px 0;transition:.15s}
.stepper .mk svg{width:13px;height:13px}
.stepper li.done .mk{background:var(--brand-50);border-color:var(--brand);color:var(--brand)}
.stepper li.on .mk{background:var(--brand);border-color:var(--brand);color:#fff;box-shadow:0 0 0 4px var(--brand-100)}
.stepper .bd{flex:1;min-width:0;padding:7px 10px;border-radius:10px;margin:2px 0;border:1px solid transparent;transition:.15s}
.stepper .t{display:flex;align-items:center;gap:8px;font-size:14px;font-weight:500;color:var(--ink-2);line-height:1.35}
.stepper .tt{min-width:0;overflow-wrap:anywhere}
.stepper .ft{display:block;font:11.5px var(--mono);color:var(--muted);margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.stepper .tag{flex:none;font:600 10px var(--mono);padding:1px 6px;border-radius:999px;border:1px solid var(--line-2);color:var(--muted);white-space:nowrap}
.stepper .tag.no{border-color:#f5c2b5;color:#b4432a;background:#fdf0ec}
.stepper .tag.yes{border-color:#b9dfc7;color:#2f7a4f;background:#eef8f1}
.stepper li:hover .bd{background:var(--paper)}
.stepper li:hover .mk{border-color:var(--brand)}
.stepper li.on .bd{background:var(--brand-50);border-color:var(--brand-100)}
.stepper li.on .t{color:var(--ink);font-weight:650}
.stepper li.on .ft{color:var(--brand)}
.stepper li.up .t{color:var(--muted)}
.stepper .now{margin-left:auto;flex:none;font:600 10px var(--mono);letter-spacing:.06em;text-transform:uppercase;color:var(--brand)}
footer{border-top:1px solid var(--line);background:var(--card);display:flex;align-items:center;gap:14px;padding:10px 16px}
.timeline{flex:1;display:flex;align-items:center;gap:0;overflow-x:auto;padding:5px 4px;scrollbar-width:none}
.timeline::-webkit-scrollbar{display:none}
.dot{flex:none;width:26px;height:26px;border-radius:50%;border:1px solid var(--line-2);background:var(--card);font:500 11px var(--mono);color:var(--muted);cursor:pointer;padding:0;transition:background .15s,border-color .15s,color .15s,box-shadow .15s}
.dot:hover{border-color:var(--brand);color:var(--brand)}
.dot.done{border-color:var(--brand);color:var(--brand);background:var(--brand-50)}
.dot.on{background:var(--brand);border-color:var(--brand);color:#fff;box-shadow:0 0 0 4px var(--brand-100)}
.seg{flex:1 0 10px;height:1px;background:var(--line-2);min-width:10px;max-width:60px}
.seg.done{background:var(--brand);height:2px}
.credit{display:inline-flex;align-items:center;gap:8px;font:500 11px var(--mono);color:var(--muted);white-space:nowrap}
.credit i{font-style:normal;opacity:.5}
.credit a{color:var(--ink-2);text-decoration:none;display:inline-flex;align-items:center;gap:5px}
.credit a:hover{color:var(--brand);text-decoration:underline}
.credit svg{width:13px;height:13px}
.drawer{position:fixed;inset:0 auto 0 0;width:min(560px,100%);background:var(--card);border-right:1px solid var(--line);z-index:50;display:flex;flex-direction:column;gap:10px;padding:16px;transform:translateX(-102%);transition:transform .25s ease}
.drawer.open{transform:none;box-shadow:var(--shadow-lg)}
.drawer h3{margin:0;font:700 17px var(--head)}
.drawer p{margin:0;font-size:12.5px;color:var(--muted);line-height:1.55}
.drawer code{font-family:var(--mono);font-size:.92em}
.drawer textarea{flex:1;resize:none;border:1px solid var(--line-2);border-radius:10px;padding:12px;font-family:var(--mono);font-size:12.5px;line-height:1.5;background:var(--paper);min-height:0;white-space:pre;overflow:auto}
.drawer textarea:focus{outline:2px solid var(--brand-100);border-color:var(--brand)}
.drawer .url-row{display:flex;gap:6px;align-items:center}
.drawer .url-row input{flex:1;min-width:0;border:1px solid var(--line-2);border-radius:8px;padding:8px 10px;font:12.5px var(--mono);background:var(--paper);color:var(--ink)}
.drawer .url-row input:focus{outline:2px solid var(--brand-100);border-color:var(--brand)}
.row{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.err{display:none;border:1px solid #f0b3a3;background:#fdf0ec;color:#8f2412;border-radius:8px;padding:8px 10px;font-size:13px}
.err.show{display:block}
.scrim{position:fixed;inset:0;background:rgba(15,23,42,.3);z-index:45;opacity:0;pointer-events:none;transition:opacity .2s}
.scrim.open{opacity:1;pointer-events:auto}
.toast{position:fixed;left:50%;bottom:76px;transform:translate(-50%,20px);background:var(--ink);color:#fff;padding:8px 14px;border-radius:999px;font-size:13px;opacity:0;transition:.25s;z-index:70;pointer-events:none}
.toast.show{opacity:1;transform:translate(-50%,0)}
body.client .edit-only{display:none}
/* embed: compact chrome for iframes / third-party hosts */
body.embed header .brand,
body.embed header #btnShare,
body.embed header a.btn.icon,
body.embed header #btnSet,
body.embed .credit,
body.embed .about{display:none!important}
body.embed header{padding:6px 10px;gap:6px;border-bottom-color:var(--line)}
body.embed .doc-title{border:0;padding-left:0;margin:0;font-size:13px}
body.embed footer{padding:6px 10px}
body.embed .toast{bottom:58px}
body.embed .panel{padding:14px 14px 10px;gap:10px}
body.embed .panel h2{font-size:18px}
/* settings + share popovers */
.pop-scrim{position:fixed;inset:0;z-index:38;display:none}
.pop-scrim.open{display:block}
.pop{position:fixed;right:16px;top:60px;width:350px;max-height:calc(100dvh - 76px);overflow:auto;background:var(--card);border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow-lg);display:none;flex-direction:column;z-index:40}
.pop.open{display:flex}
.pop-h{display:flex;align-items:center;justify-content:space-between;padding:10px 12px 10px 16px;border-bottom:1px solid var(--line)}
.pop-h b{font:700 15px var(--head)}
.pop-h .btn{width:30px;min-height:30px;border-color:transparent}
.set-sec{padding:14px 16px;border-bottom:1px dashed var(--line-2);display:flex;flex-direction:column;gap:10px}
.set-l{font:500 11px var(--mono);letter-spacing:.08em;text-transform:uppercase;color:var(--muted);display:flex;justify-content:space-between}
.set-l span{text-transform:none;letter-spacing:0}
.opts{display:flex;flex-direction:column;gap:2px}
.opt{display:flex;align-items:center;gap:10px;padding:7px 8px;border-radius:8px;border:1px solid transparent;background:none;cursor:pointer;text-align:left;font-size:13.5px;color:var(--ink-2)}
.opt:hover{background:var(--paper)}
.opt.on{background:var(--brand-50);border-color:var(--brand-100);color:var(--ink)}
.opt .radio{width:16px;height:16px;border-radius:50%;border:1.5px solid var(--line-2);flex:none;display:grid;place-items:center}
.opt.on .radio{border-color:var(--brand)}
.opt.on .radio::after{content:"";width:8px;height:8px;border-radius:50%;background:var(--brand)}
.opt .ot{flex:1;min-width:0}
.opt b{font-weight:600;display:flex;align-items:center;gap:6px}
.opt b em{font:500 10px var(--mono);font-style:normal;color:var(--brand);border:1px solid var(--brand-100);border-radius:999px;padding:0 6px}
.opt small{display:block;font-size:11.5px;color:var(--muted)}
.opt .sw{display:flex;gap:2px;flex:none}
.opt .sw i{width:12px;height:12px;border-radius:3px;border:1px solid rgba(15,23,42,.15)}
.segc{display:flex;padding:3px;border:1px solid var(--line);border-radius:10px;background:var(--paper)}
.segc button{flex:1;border:0;background:transparent;min-height:30px;border-radius:7px;font-size:13px;font-weight:500;color:var(--muted);cursor:pointer}
.segc button.on{background:var(--brand);color:#fff;box-shadow:var(--shadow-sm)}
.set-foot{padding:10px 16px 12px;font:11px var(--mono);color:var(--muted)}
.set-about{margin-top:auto;padding:12px 16px 14px;border-top:1px solid var(--line);display:flex;flex-direction:column;gap:4px;font-size:12px;color:var(--muted)}
.set-about a{color:var(--ink-2);text-decoration:none;font-weight:600}
.set-about a.gh{display:inline-flex;align-items:center;gap:6px}
.set-about a:hover{color:var(--brand)}
.set-about svg{width:14px;height:14px}
.share{width:390px;padding:14px 16px;gap:12px;font-size:13px;color:var(--ink-2)}
.share .pop-h{padding:0;border:0}
.share .pop-h b{display:flex;align-items:center;gap:8px}
.share .pop-h b svg{width:18px;height:18px;color:#fff;background:var(--brand);border-radius:50%;padding:3px}
.sh-url{display:flex;gap:6px;align-items:center;border:1px solid var(--line);background:var(--paper);border-radius:8px;padding:4px 4px 4px 10px}
.sh-url input{flex:1;min-width:0;border:0;background:none;font:12px var(--mono);color:var(--muted);outline:none}
.sh-url .btn{min-height:28px}
.sh-facts{margin:0;padding:0;list-style:none;display:flex;flex-direction:column;gap:8px}
.sh-facts li{padding-left:14px;position:relative;line-height:1.5}
.sh-facts li::before{content:"";position:absolute;left:0;top:.6em;width:6px;height:6px;border-radius:50%;background:var(--brand)}
.sh-facts li.warn::before{background:var(--amber)}
.sh-facts b{color:var(--ink)}
.sh-facts code{font:12px var(--mono);background:var(--paper);border:1px solid var(--line);border-radius:4px;padding:0 4px}
.sh-foot{font:11px var(--mono);color:var(--muted);border-top:1px dashed var(--line-2);padding-top:10px}
.sh-embed{display:flex;flex-direction:column;gap:8px;border-top:1px solid var(--line);padding-top:12px}
.sh-eh{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap}
.sh-eh b{font:600 13px var(--sans);color:var(--ink)}
.sh-eh select.btn{min-height:28px;font-size:12px}
.sh-embed textarea{width:100%;resize:none;border:1px solid var(--line);background:var(--paper);border-radius:8px;padding:8px 10px;font:11.5px/1.5 var(--mono);color:var(--ink-2);white-space:pre-wrap;word-break:break-all}
.sh-embed .row .btn{flex:1}
.sh-opts{display:flex;flex-wrap:wrap;gap:6px 16px}
.sh-opts .ck{font-size:12.5px}
/* embed options: &t=0 hides the step text panel, &v=0 locks the view (no 2D/3D switch) */
body.embed.no-text main{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr)}
body.embed.no-text .panel{display:none}
body.embed.lock-view #btnMode{display:none}
/* about dialog */
button.brand{border:0;background:none;padding:0;color:inherit;cursor:pointer;border-radius:6px}
button.brand:hover{color:var(--brand)}
button.brand:focus-visible{outline:2px solid var(--brand);outline-offset:3px}
.about{position:fixed;inset:0;z-index:65;display:none;align-items:center;justify-content:center;background:rgba(15,23,42,.4);padding:16px}
.about.open{display:flex}
.about-card{position:relative;width:min(900px,100%);max-height:100%;overflow:auto;background:var(--card);border:1px solid var(--line);border-radius:16px;box-shadow:var(--shadow-lg);display:grid;grid-template-columns:1.05fr 1fr}
.about-hero{position:relative;padding:44px 38px;display:flex;flex-direction:column;justify-content:center;gap:18px;overflow:hidden;border-right:1px solid var(--line)}
.about-hero::before{content:"";position:absolute;inset:0;pointer-events:none;background-image:linear-gradient(rgba(15,23,42,.05) 1px,transparent 1px),linear-gradient(90deg,rgba(15,23,42,.05) 1px,transparent 1px);background-size:32px 32px;-webkit-mask-image:radial-gradient(ellipse at 30% 40%,#000 30%,transparent 80%);mask-image:radial-gradient(ellipse at 30% 40%,#000 30%,transparent 80%)}
.about-hero::after{content:"";position:absolute;right:-150px;bottom:-170px;width:400px;height:400px;border-radius:50%;pointer-events:none;background:radial-gradient(circle,rgba(0,124,144,.16),transparent 65%)}
.about-hero>*{position:relative;z-index:1}
.ab-eyebrow{font:500 12px var(--mono);letter-spacing:.14em;text-transform:uppercase;color:var(--brand);display:flex;align-items:center;gap:10px}
.ab-eyebrow i{width:26px;height:2px;background:var(--brand)}
.about-hero h2{margin:0;font:700 54px/1 var(--head);letter-spacing:-.03em;color:var(--ink)}
.about-hero h2 span{color:var(--brand)}
.about-hero p{margin:0;font-size:16px;line-height:1.55;color:var(--ink-2)}
.ab-chips{display:flex;flex-wrap:wrap;gap:6px}
.ab-chips b{font:500 12px var(--mono);padding:4px 10px;border:1px solid var(--line-2);border-radius:999px;background:var(--card);color:var(--ink-2)}
.ab-chips b.a{border-color:var(--brand);color:var(--brand);background:var(--brand-50)}
.ab-repo{display:inline-flex;align-items:center;gap:8px;font:500 13px var(--mono);color:var(--muted);text-decoration:none;width:max-content}
.ab-repo:hover{color:var(--brand)}
.ab-repo svg{width:16px;height:16px}
.about-body{padding:34px 30px 24px;display:flex;flex-direction:column;gap:20px}
.ab-sec h3{margin:0 0 10px;font:600 11px var(--mono);letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.ab-steps{margin:0;padding:0;list-style:none;counter-reset:s;display:flex;flex-direction:column;gap:10px}
.ab-steps li{counter-increment:s;display:flex;gap:12px;font-size:14px;line-height:1.5;color:var(--ink-2)}
.ab-steps li::before{content:counter(s);flex:none;width:24px;height:24px;border-radius:50%;background:var(--brand-50);border:1px solid var(--brand-100);color:var(--brand);font:600 11px/22px var(--mono);text-align:center}
.ab-steps b,.ab-sec p b{color:var(--ink);font-weight:600}
.ab-sec p{margin:0;font-size:14px;line-height:1.6;color:var(--ink-2)}
.ab-links{display:flex;gap:8px;flex-wrap:wrap}
.ab-foot{margin-top:auto;padding-top:14px;border-top:1px dashed var(--line-2);font-size:12px;line-height:1.6;color:var(--muted)}
.ab-foot a{color:var(--ink-2);font-weight:600;text-decoration:none}
.ab-foot a:hover{color:var(--brand)}
.about-x{position:absolute;top:10px;right:10px;z-index:2;border-color:transparent;box-shadow:none}
@media (max-width:820px){
.about{padding:0;align-items:stretch}
.about-card{grid-template-columns:1fr;border-radius:0;border:0;width:100%}
.about-hero{padding:30px 22px;border-right:0;border-bottom:1px solid var(--line);gap:14px}
.about-hero h2{font-size:42px}
.about-body{padding:22px}
}
/* diagram */
#scene{position:absolute;inset:0;width:100%;height:100%;display:block;touch-action:none;cursor:grab;outline:none}
#scene.drag{cursor:grabbing}
#labels{position:absolute;inset:0;overflow:hidden;pointer-events:none;z-index:1;isolation:isolate}
.lab{position:absolute;left:0;top:0;white-space:nowrap;opacity:0;transition:opacity .45s ease;will-change:transform}
.lab.in{opacity:1}
.lab.in.ghost{opacity:.2}
.lab.node{transform-origin:50% 100%;padding-bottom:8px}
.lab.node span{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden;max-width:150px;white-space:normal;text-align:center;font:600 12.5px/1.25 var(--d-lab);color:var(--d-plate-fg);background:var(--d-plate);border:1.4px solid var(--d-plate-bd);border-radius:8px;padding:4px 9px;box-shadow:0 2px 0 var(--d-lab-shadow);overflow-wrap:anywhere;transition:background .3s,color .3s}
.lab.node::after{content:"";position:absolute;left:50%;bottom:4px;width:8px;height:8px;background:var(--d-plate);border:solid var(--d-plate-bd);border-width:0 1.4px 1.4px 0;transform:translateX(-50%) rotate(45deg);transition:background .3s}
.lab.node.active span{background:var(--d-on);border-color:var(--d-on);color:var(--d-on-fg)}
.lab.node.active::after{background:var(--d-on);border-color:var(--d-on)}
.lab.edge{transform-origin:50% 100%}
.lab.edge span{display:block;max-width:170px;overflow:hidden;text-overflow:ellipsis;font:600 10.5px var(--d-mono);color:var(--d-plate-fg);background:var(--d-plate);border:1.2px solid var(--d-plate-bd);border-radius:20px;padding:2px 8px}
.lab.edge.active span{background:var(--d-accent);border-color:var(--d-accent);color:var(--d-accent-fg)}
.lab.zone{transform-origin:50% 0}
.lab.zone span{font:700 11px var(--d-mono);color:var(--d-muted);letter-spacing:.06em;background:var(--d-chip);border-radius:6px;padding:1px 6px}
.hint{position:absolute;left:12px;top:12px;font:11px var(--mono);color:var(--muted);background:rgba(255,255,255,.9);border:1px solid var(--line);border-radius:999px;z-index:2;padding:3px 10px;transition:opacity .6s;pointer-events:none}
.hint.off{opacity:0}
.snap{position:fixed;inset:0;z-index:60;display:none;align-items:center;justify-content:center;background:rgba(15,23,42,.35);padding:16px}
.snap.open{display:flex}
.snap-card{background:var(--card);border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow-lg);width:min(960px,100%);max-height:100%;display:flex;flex-direction:column;gap:10px;padding:16px;overflow:auto}
.snap-card h3{margin:0;font:700 17px var(--head)}
.seg2{display:inline-flex;padding:3px;border:1px solid var(--line);border-radius:10px;background:var(--paper)}
.seg2 button{border:0;background:transparent;padding:5px 10px;border-radius:7px;font-size:13px;font-weight:500;color:var(--muted);cursor:pointer}
.seg2 button.on{background:var(--brand);color:#fff}
.ck{font-size:13px;display:inline-flex;gap:5px;align-items:center;cursor:pointer;color:var(--ink-2)}
.ck input{accent-color:var(--brand)}
.snap-prev{border:1px solid var(--line);border-radius:10px;background:#eef2f5;min-height:160px;display:flex;align-items:center;justify-content:center;overflow:hidden;flex:none}
.snap-prev img{max-width:100%;max-height:52vh;display:block}
.chk{border-radius:10px;padding:9px 11px;font-size:13.5px;line-height:1.5;border:1px solid var(--line);color:var(--ink-2)}
.chk.ok{background:#eef8f1;border-color:#b9dfc7}
.chk.warn{background:#fdf0ec;border-color:#f5c2b5}
.chk ul{margin:4px 0 2px;padding-left:18px}
.chk .tip{color:var(--muted);font-size:12.5px}
.snap-meta{font:12px var(--mono);color:var(--muted)}
@media (max-width:1024px){
main{grid-template-columns:minmax(0,1fr) 320px}
.panel{padding:18px}
.panel h2{font-size:21px}
}
@media (max-width:820px){
main{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1.1fr) minmax(0,1fr)}
.panel{border-left:0;border-top:1px solid var(--line);padding:16px;gap:12px}
.panel h2{font-size:19px}
.panel p{font-size:14px}
header{padding:8px 12px;gap:6px}
.brand{flex:1;min-width:0}
.doc-title{display:none}
header .btn:not(select){width:34px;padding:0}
.btn .tx{display:none}
.hide-m,.hide-s{display:none!important}
footer{padding:8px 12px;gap:10px}
.steps .chev{display:block}
.steps:not([open]) summary{margin-bottom:0}
.steps:not([open]) .prog{margin:10px 0 0}
.pop.settings{top:0;right:0;bottom:0;max-height:none;width:min(360px,88vw);border-radius:0;border-width:0 0 0 1px;display:flex;transform:translateX(102%);visibility:hidden;transition:transform .25s ease,visibility .25s}
.pop.settings.open{transform:none;visibility:visible}
.pop.share{left:12px;right:12px;top:auto;bottom:12px;width:auto}
.pop-scrim.open{background:rgba(15,23,42,.3)}
}
</style>
</head>
<body data-view="3d">
<script>(function(){const p=location.pathname,q=location.search;if(/(?:^|\/)embed(?:\/|$)/.test(p)||/(?:^|[?&])embed(?:=1)?(?:&|$)/.test(q))document.body.classList.add('embed','client')})()</script>
<script>
/* Solution Forest console easter egg (skipped in embeds) */
;(function(){
try{
if(document.body.classList.contains('embed'))return;
const mono='font-family:ui-monospace,Menlo,Consolas,monospace;font-size:11px;line-height:1.25';
console.log(
'%c'+
' .\n'+
' /|\\\n'+
' / | \\\n'+
' / | \\\n'+
' .---+---.\n'+
' /|\\ | /|\\\n'+
' / | \\ | / | \\\n'+
' / | \\|/ | \\\n'+
'.---+---+---+---.\n'+
'%cFlow Explainer%c · made by %cSolution Forest%c\n'+
'Hong Kong · https://solutionforest.net/ · MIT',
'color:#007c90;'+mono,
'color:#5eead4;font:700 13px Inter,ui-sans-serif,system-ui,sans-serif',
'color:#94a3b8;font:12px Inter,ui-sans-serif,system-ui,sans-serif',
'color:#fcaf17;font:700 12px Inter,ui-sans-serif,system-ui,sans-serif',
'color:#94a3b8;'+mono);
}catch(_){}
})();
</script>
<div class="app">
<header>
<button class="brand" id="btnAbout" title="About Flow Explainer">Flow Explainer<small>3D</small></button>
<div class="doc-title" id="docTitle"></div>
<select class="btn ghost" id="sceneSel" hidden></select>
<button class="btn edit-only" id="btnNew" title="Start a new walkthrough from your own markdown"><svg class="i" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg><span class="tx">New</span></button>
<select class="btn edit-only hide-s" id="exHead" title="Load an example" aria-label="Load an example"></select>
<button class="btn edit-only" id="btnEdit" title="Paste or edit the markdown"><svg class="i" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 20h9"/><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4z"/></svg><span class="tx">Edit</span></button>
<button class="btn edit-only hide-s" id="btnSnap" title="Save a picture for your README"><svg class="i" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 7h3l2-3h6l2 3h3a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1z"/><circle cx="12" cy="13" r="3.5"/></svg><span class="tx">Snapshot</span></button>
<button class="btn primary" id="btnShare" title="Copy a view-only link for your client"><svg class="i" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 13a5 5 0 0 0 7.07 0l3-3a5 5 0 0 0-7.07-7.07l-1 1"/><path d="M14 11a5 5 0 0 0-7.07 0l-3 3a5 5 0 0 0 7.07 7.07l1-1"/></svg><span class="tx">Copy client link</span></button>
<a class="btn icon" href="https://github.com/solutionforest/flow-explainer" target="_blank" rel="noopener" title="View the source on GitHub" aria-label="View the source on GitHub"><svg class="i" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg></a>
<button class="btn icon" id="btnSet" title="Settings" aria-label="Settings" aria-haspopup="dialog" aria-expanded="false"><svg class="i" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 0 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 0 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 0 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 0 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"/></svg></button>
</header>
<main>
<div class="stage">
<canvas id="scene"></canvas>
<div id="labels"></div>
<div class="hint" id="hint">Drag to rotate · <span class="hide-m">scroll or </span>pinch to zoom</div>
<div class="stage-tools"><button class="btn ghost" id="btnMode" title="Switch to the flat 2D view">2D</button><button class="btn ghost" id="btnFit" title="Reset view">⤢</button></div>
<div class="legend" id="legend"></div>
</div>
<aside class="panel" id="panel"></aside>
</main>
<footer>
<button class="btn primary" id="btnPlay">▶ Play</button>
<div class="timeline" id="timeline"></div>
<span class="credit hide-s"><a href="#about" data-about>About</a><i>·</i><a href="https://github.com/solutionforest/flow-explainer" target="_blank" rel="noopener"><svg class="i" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg>GitHub</a><i>·</i>MIT License<i>·</i><span>Made by <a href="https://solutionforest.net/" target="_blank" rel="noopener" title="Solution Forest Limited, a Hong Kong digital agency">Solution Forest</a></span></span>
</footer>
</div>
<div class="about" id="about" role="dialog" aria-modal="true" aria-labelledby="aboutTitle">
<div class="about-card">
<button class="btn icon about-x" id="aboutClose" aria-label="Close">✕</button>
<div class="about-hero">
<div class="ab-eyebrow"><i></i>Mermaid → walkthrough</div>
<h2 id="aboutTitle">Flow<br><span>Explainer</span></h2>
<p>Paste a GitHub markdown diagram. Get an animated, step-by-step walkthrough you can send to a client.</p>
<div class="ab-chips"><b class="a">2D & 3D</b><b>23 diagram types</b><b>No server</b><b>MIT</b></div>
<a class="ab-repo" href="https://github.com/solutionforest/flow-explainer" target="_blank" rel="noopener"><svg class="i" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg>solutionforest/flow-explainer</a>
</div>
<div class="about-body">
<div class="ab-sec"><h3>How it works</h3><ol class="ab-steps">
<li><span><b>Paste</b> a markdown file with a Mermaid diagram, and a numbered list to explain each step.</span></li>
<li><span><b>Play</b> it one arrow at a time. The camera follows each step and the side panel explains it in plain language.</span></li>
<li><span><b>Share</b> a view-only client link, or save a PNG for your README.</span></li>
</ol></div>
<div class="ab-sec"><h3>Your diagram stays with you</h3><p>Nothing is uploaded. Drafts stay in this browser, and a client link carries the diagram inside the link itself. The link is <b>not encrypted</b>, so share it like the document.</p></div>
<div class="ab-links"><a class="btn primary" href="https://github.com/solutionforest/flow-explainer" target="_blank" rel="noopener"><svg class="i" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg>View on GitHub</a><a class="btn" href="https://github.com/solutionforest/flow-explainer#readme" target="_blank" rel="noopener">Read the guide</a></div>
<div class="ab-foot">Made by <a href="https://solutionforest.net/" target="_blank" rel="noopener">Solution Forest</a>, a digital agency in Hong Kong. Open source under the <a href="https://github.com/solutionforest/flow-explainer/blob/main/LICENSE" target="_blank" rel="noopener">MIT License</a>. Built with Three.js; fonts Inter and Raleway.</div>
</div>
</div>
</div>
<div class="pop-scrim" id="popScrim"></div>
<div class="pop settings" id="settings" role="dialog" aria-label="Settings">
<div class="pop-h"><b>Settings</b><button class="btn ghost" id="setClose" aria-label="Close settings">✕</button></div>
<div class="set-sec"><div class="set-l">Diagram style <span>3D & 2D</span></div><div class="opts" id="styleSel" role="radiogroup" aria-label="Diagram style"></div>
<div class="row" style="gap:8px;flex-wrap:wrap"><label class="btn">Load JSON<input type="file" id="styleFile" accept=".json,application/json" hidden></label><button class="btn ghost" id="styleClear" type="button" hidden>Remove custom</button></div>
<p class="set-hint" id="styleHint" style="margin:0;font-size:12px;color:var(--muted);line-height:1.45"></p>
</div>
<div class="set-sec"><div class="set-l">Icons <span>emoji on the blocks</span></div><div class="segc" id="iconSel"><button data-i="1">Show</button><button data-i="0">Hide</button></div></div>
<div class="set-sec"><div class="set-l">View</div><div class="segc" id="viewSel"><button data-v="3d">3D</button><button data-v="2d">2D</button></div></div>
<div class="set-foot">Saved in this browser · included in client links</div>
<div class="set-about"><a class="gh" href="https://github.com/solutionforest/flow-explainer" target="_blank" rel="noopener"><svg class="i" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg>solutionforest/flow-explainer</a><span>Open source · MIT License · Made by <a href="https://solutionforest.net/" target="_blank" rel="noopener">Solution Forest</a></span><a href="#about" data-about>About Flow Explainer →</a></div>
</div>
<div class="pop share" id="share" role="dialog" aria-labelledby="shareTitle">
<div class="pop-h"><b id="shareTitle"><svg class="ok" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg><span>Client link copied</span></b><button class="btn ghost" id="shareClose" aria-label="Close">✕</button></div>
<div class="sh-url"><input id="shareUrl" readonly aria-label="Client link"><button class="btn" id="shareCopy">Copy</button></div>
<ul class="sh-facts">
<li><b>Not uploaded.</b> The whole diagram is packed into the link itself, after the <code>#</code>. Browsers never send that part to the server.</li>
<li class="warn"><b>Not secret.</b> The link is compressed, not encrypted. Anyone who gets it can open and read the diagram, so share it like the document itself.</li>
<li><b>Copies stay where you paste them.</b> Chat apps, email and browser history keep the full link.</li>
</ul>
<div class="sh-foot">Opens view-only: no Edit or Snapshot.</div>
<div class="sh-embed">
<div class="sh-eh"><b>Embed on a website</b><select class="btn" id="embedKind" aria-label="Embed format"><option value="iframe">iframe HTML</option><option value="script">script tag</option></select><select class="btn" id="embedSize" aria-label="Embed size"><option value="r">Responsive</option><option value="960x600">960 × 600</option><option value="800x500">800 × 500</option><option value="640x480">640 × 480</option></select></div>
<div class="sh-opts"><label class="ck"><input type="checkbox" id="embedText"> Show step text</label><label class="ck"><input type="checkbox" id="embedSwitch" checked> Allow 2D / 3D switch</label></div>
<textarea id="embedCode" readonly rows="4" spellcheck="false" aria-label="Embed code"></textarea>
<div class="row"><button class="btn primary" id="embedCopy" type="button">Copy embed code</button><button class="btn ghost" id="shareEmbed" type="button" title="Copy only the compact /embed URL">Copy embed link</button></div>
</div>
</div>
<div class="scrim" id="scrim"></div>
<div class="drawer" id="drawer">
<div class="row" style="justify-content:space-between"><h3 id="drawerTitle">Paste your markdown</h3><button class="btn ghost icon" id="btnClose" aria-label="Close">✕</button></div>
<p>Paste a GitHub markdown file that contains a <code>```mermaid</code> block (<b>flowchart</b>, <b>sequenceDiagram</b>, <b>stateDiagram</b>, <b>classDiagram</b>, <b>erDiagram</b>, <b>gantt</b>, <b>pie</b>, <b>mindmap</b>, <b>journey</b>, <b>timeline</b>, <b>quadrantChart</b>, <b>gitGraph</b>, <b>xychart</b>, <b>sankey</b>, <b>block</b>, <b>architecture</b>, <b>C4</b>, <b>kanban</b>, <b>packet</b>, <b>requirementDiagram</b>, <b>radar</b>, <b>treemap</b> or <b>zenuml</b>). Optional: a numbered list under the diagram becomes the explanation for each step, and <code>- **Box name**: text</code> adds a note to a box. Or load a <b>public</b> URL (GitHub blob links are rewritten to raw).</p>
<div class="url-row">
<input id="mdUrl" type="url" inputmode="url" autocomplete="off" spellcheck="false" placeholder="https://…/file.md or github.com/…/blob/…/file.md" aria-label="Markdown URL">
<button class="btn" id="btnUrl" type="button" title="Fetch markdown from this public URL">Load URL</button>
</div>
<textarea id="src" spellcheck="false"></textarea>
<div class="err" id="err"></div>
<div class="row">
<button class="btn primary" id="btnRender">Render ▶</button>
<select class="btn" id="exSel"><option value="">Load example…</option><option value="ex1">Order flow (flowchart)</option><option value="ex2">Login (sequence)</option><option value="ex3">System map (groups)</option><option value="ex4">Article lifecycle (state)</option><option value="ex5">Shop objects (class)</option><option value="ex6">Shop database (ER)</option><option value="ex7">Launch plan (gantt)</option><option value="ex8">Visitors (pie)</option><option value="ex9">Shop overview (mindmap)</option><option value="ex10">Ticket buying (journey)</option><option value="ex11">Shop history (timeline)</option><option value="ex12">Feature priorities (quadrant)</option><option value="ex13">Checkout release (git graph)</option><option value="ex14">Monthly sales (xychart)</option><option value="ex15">Where money goes (sankey)</option><option value="ex16">Website parts (block)</option><option value="ex17">Cloud setup (architecture)</option><option value="ex18">Shop big picture (C4)</option><option value="ex19">Project board (kanban)</option><option value="ex20">Network message (packet)</option><option value="ex21">Sign-in rules (requirement)</option><option value="ex22">Team skills (radar)</option><option value="ex23">Budget split (treemap)</option><option value="ex24">Checkout (ZenUML)</option></select>
<button class="btn" id="btnTpl" title="Fill in a starter template">Use template</button>
<label class="btn">Open .md<input type="file" id="file" accept=".md,.markdown,.mmd,.txt,text/*" hidden></label>
</div>
</div>
<div class="snap" id="snap"><div class="snap-card">
<div class="row" style="justify-content:space-between"><h3>Snapshot for your README</h3><button class="btn ghost icon" id="snapClose" aria-label="Close">✕</button></div>
<div class="row">
<div class="seg2" id="snapFrame"><button data-v="whole" class="on">Whole diagram</button><button data-v="now">What I see now</button></div>
<label class="ck"><input type="checkbox" id="snapNums" checked> Step numbers</label>
<label class="ck"><input type="checkbox" id="snapTitle" checked> Title</label>
<label class="ck"><input type="checkbox" id="snapMarks"> Mark problem spots</label>
<label class="ck" title="Adds “Made with Flow Explainer · flow-explainer.laravel.cloud” at the bottom"><input type="checkbox" id="snapCredit" checked> Credit line</label>
<button class="btn ghost" id="snapAngle" title="Try many camera angles and pick the one with the fewest overlaps">Find a clean angle</button>
</div>
<div class="chk" id="snapCheck">Checking…</div>
<div class="snap-prev"><img id="snapImg" alt="Snapshot preview"></div>
<div class="row">
<button class="btn primary" id="snapDl">Download PNG</button>
<button class="btn" id="snapCopyImg">Copy image</button>
<button class="btn" id="snapCopyMd">Copy README text</button>
<span class="snap-meta" id="snapSize"></span>
</div>
</div></div>
<div class="toast" id="toast"></div>
<script type="text/plain" id="tplNew"># Title of your walkthrough
One sentence about what this diagram shows.
```mermaid
flowchart LR
A([Customer]) -->|Does something| B[Your system]
B -->|Saves it| C[(Database)]
B --> D{All good?}
D -->|Yes| E[Send confirmation]
D -->|No| F[Show an error]
```
1. What the customer does first.
2. What your system saves, and why.
3. How the system decides.
4. What happens when it works.
5. What happens when it does not.
- **Your system**: A note shown with this box.
</script>
<script type="text/plain" id="ex1"># How an online ticket order is handled
What happens behind the scenes after a customer presses "Buy".
```mermaid
flowchart LR
C([Customer]) -->|Places order| S[Online Shop]
S -->|Asks for payment| P[Payment Gateway]
P --> D{Payment OK?}
D -->|No| F[Show error to customer]
D -->|Yes| O[(Order Database)]
O --> T[Ticket Allocation]
T -->|Sends PDF ticket| M[Email Service]
M --> I([Customer inbox])
```
1. The customer picks a ticket on the website and presses **Buy**.
2. The shop never touches card details. It hands the customer to the payment gateway.
3. The gateway checks the card with the bank and reports back.
4. If the payment fails, the customer sees a clear message and can try again. Nothing is charged.
5. If the payment succeeds, the order is saved as **paid**.
6. A paid order automatically triggers ticket allocation. No staff action is needed.
7. The ticket (code or PDF) is attached to an email.
8. The customer receives the ticket, usually within a minute.
- **Ticket Allocation**: Picks one unused ticket from the vendor's stock and locks it to this order, so the same ticket can never be sent twice.
- **Order Database**: The single record of who bought what. Staff can look up any order here.
</script>
<script type="text/plain" id="ex2"># Signing in with a one-time code
```mermaid
sequenceDiagram
actor U as Customer
participant W as Website
participant A as Login Service
participant D as Database
participant E as Email Service
U->>W: Enters email address
W->>A: Request sign-in code
A->>D: Save one-time code
A->>E: Send code by email
E-->>U: Email with 6-digit code
U->>W: Types the code
W->>A: Check the code
A->>D: Compare with saved code
alt Code is correct
A-->>W: Signed in
W-->>U: Shows account page
else Code is wrong
A-->>W: Rejected
end
```
- **Login Service**: Codes expire after 10 minutes and can be used only once.
</script>
<script type="text/plain" id="ex3"># Where everything lives
```mermaid
flowchart LR
subgraph Customer side
B[Browser]
M[Mobile App]
end
subgraph Our system
G[API Gateway]
O[Order Service]
Q[Job Queue]
DB[(Database)]
end
subgraph Outside partners
P[Stripe Payments]
E[Email Provider]
end
B --> G
M --> G
G --> O
O --> DB
O --> P
O -.-> Q
Q -.-> E
```
</script>
<script type="text/plain" id="ex4"># The life of an article
Every article moves through a few clear stages before readers see it.
```mermaid
stateDiagram-v2
[*] --> Draft
Draft --> Review : submit
Review --> Draft : changes requested
Review --> Approved : approve
state Approved {
[*] --> Scheduled
Scheduled --> Live : publish date
}
Live --> Archived : after 1 year
Archived --> [*]
Draft : The writer is still working on it
Review : An editor reads and checks it
```</script>
<script type="text/plain" id="ex5"># What the shop system knows about
```mermaid
classDiagram
class Product {
+String name
+Money price
+isInStock() bool
}
class Ticket
class Merchandise
Product <|-- Ticket
Product <|-- Merchandise
Customer "1" --> "*" Order : places
Order *-- OrderLine
OrderLine --> Product : refers to
Order ..> PaymentGateway : charges through
```</script>
<script type="text/plain" id="ex6"># How the shop's data fits together
```mermaid
erDiagram
CUSTOMER ||--o{ ORDER : places
ORDER ||--|{ ORDER-LINE : contains
PRODUCT ||--o{ ORDER-LINE : "appears in"
CUSTOMER {
int id PK
string name
string email
}
ORDER {
int id PK
int customer_id FK
date placed_on
}
```</script>
<script type="text/plain" id="ex7"># Website launch plan
```mermaid
gantt
title Website launch plan
dateFormat YYYY-MM-DD
section Design
Wireframes :done, w1, 2026-01-05, 5d
Visual design :active, v1, after w1, 2w
section Build
Front end :f1, after v1, 10d
Back end :b1, 2026-01-12, 3w
Testing :crit, t1, after f1 b1, 5d
section Launch
Go live :milestone, after t1, 0d
```</script>
<script type="text/plain" id="ex8"># Where our visitors come from
Last month's visits, by how people found the site.
```mermaid
pie title Where visitors come from
"Search" : 386
"Direct" : 150
"Social" : 85
"Email" : 15
```</script>
<script type="text/plain" id="ex9"># Everything the online shop covers
```mermaid
mindmap
root((Online shop))
Products
Catalogue
Stock levels
Orders
Payment
Delivery
Customers
Accounts
Support
```</script>
<script type="text/plain" id="ex10"># Buying a concert ticket online
How a customer feels at each step, from finding the show to getting in. Low scores are the pain points to fix first.
```mermaid
journey
title Buying a concert ticket online
section Find
Search for the show: 4: Customer
Compare seats: 3: Customer
section Buy
Enter card details: 2: Customer, Shop
Get confirmation email: 5: Customer, Shop
section Attend
Show ticket at the door: 4: Customer, Staff
```</script>
<script type="text/plain" id="ex11"># How the online shop grew
```mermaid
timeline
title How the online shop grew
section Getting started
2023 : Shop opens online
2024 : Mobile app launches : Loyalty points added
section Growing
2025 : Second warehouse opens
2026 : Same-day delivery : Three new cities
```</script>
<script type="text/plain" id="ex12"># Which features to build next
Each feature is placed by how much work it is and how much it helps customers.
```mermaid
quadrantChart
title Which features to build next
x-axis Low effort --> High effort
y-axis Low value --> High value
quadrant-1 Plan carefully
quadrant-2 Do first
quadrant-3 Maybe later
quadrant-4 Skip for now
Gift cards: [0.25, 0.8]
Wish list: [0.4, 0.62]
Live chat: [0.72, 0.75]
Dark mode: [0.2, 0.3]
Custom reports: [0.8, 0.25]
```</script>
<script type="text/plain" id="ex13"># How the checkout feature was built
The new checkout was built on its own copy of the code, then merged back once it was ready.
```mermaid
gitGraph
commit id: "Start project"
commit id: "Add home page"
branch checkout
checkout checkout
commit id: "Build checkout"
commit id: "Fix card bug"
checkout main
commit id: "Update prices"
merge checkout id: "Release checkout" tag: "v1.0"
commit id: "Small text fix"
```</script>
<script type="text/plain" id="ex14"># Online shop sales this year
Monthly sales, in Hong Kong dollars.
```mermaid
xychart-beta
title "Monthly sales"
x-axis [Jan, Feb, Mar, Apr, May, Jun]
y-axis "Sales (HK$)" 0 --> 120000
bar [42000, 51000, 68000, 61000, 87000, 104000]
```</script>
<script type="text/plain" id="ex15"># Where each order's money goes
How HK$100 of ticket sales is split up.
```mermaid
sankey-beta
Ticket sales,Event organiser,80
Ticket sales,Shop fees,20
Shop fees,Card payments,4
Shop fees,Hosting,3
Shop fees,Support team,6
Shop fees,Profit,7
```</script>
<script type="text/plain" id="ex16"># The parts of the website
```mermaid
block-beta
columns 3
browser["Visitor's browser"]:3
space:3
block:shop["Online shop"]:2
columns 2
pages["Web pages"] cart["Shopping cart"]
end
cms["Content editor"]
db[("Database")]:3
browser --> pages
pages --> cart
cart --> db
cms --> db
```</script>
<script type="text/plain" id="ex17"># How the shop runs in the cloud
```mermaid
architecture-beta
group web(cloud)[Website]
service visitor(internet)[Visitors]
service cdn(server)[Fast delivery network] in web
service app(server)[Shop server] in web
service db(database)[Database] in web
service files(disk)[Photo storage] in web
visitor:R --> L:cdn
cdn:R --> L:app
app:R --> L:db
app:B --> T:files
```</script>
<script type="text/plain" id="ex18"># Who uses the online shop
```mermaid
C4Context
title Online shop: the big picture
Person(customer, "Customer", "Buys tickets on the website")
Person(staff, "Shop staff", "Adds events and answers questions")
System_Boundary(ours, "Our system") {
System(shop, "Online shop", "Sells tickets and sends them out")
SystemDb(db, "Order database", "Keeps every order")
}
System_Ext(pay, "Payment provider", "Takes card payments")
System_Ext(mail, "Email service", "Delivers emails")
Rel(customer, shop, "Buys tickets on")
Rel(staff, shop, "Manages events in")
Rel(shop, db, "Saves orders to")
Rel(shop, pay, "Takes payment through", "HTTPS")
Rel(shop, mail, "Sends tickets by", "SMTP")
```</script>
<script type="text/plain" id="ex19"># Where the website project stands
```mermaid
kanban
todo[To do]
t1[Write About page text]
t2[Choose photos for events]@{ assigned: 'May', priority: 'High' }
doing[In progress]
d1[New checkout page]@{ assigned: 'Ken', priority: 'Very High', ticket: WEB-42 }
d2[Faster search]@{ assigned: 'Jo' }
review[Waiting for client]
r1[Homepage design]
done[Done]
x1[Set up hosting]
x2[Connect payments]
```</script>
<script type="text/plain" id="ex20"># What's inside a UDP message
Every message sent over the network starts with a small header.
```mermaid
packet-beta
title UDP message
0-15: "Sender port"
16-31: "Receiver port"
32-47: "Length"
48-63: "Checksum"
64-95: "Data"
```</script>
<script type="text/plain" id="ex21"># What the sign-in feature must do
```mermaid
requirementDiagram
requirement sign_in {
id: 1
text: Customers can sign in with email and a code
risk: high
verifymethod: test
}
functionalRequirement code_expiry {
id: 1.1
text: A sign-in code stops working after 10 minutes
risk: medium
verifymethod: test
}
performanceRequirement fast_email {
id: 1.2
text: The code email arrives within 30 seconds
risk: low
verifymethod: demonstration
}
element login_page {
type: web page
}
element login_tests {
type: automated tests
}
sign_in - contains -> code_expiry
sign_in - contains -> fast_email
login_page - satisfies -> sign_in
login_tests - verifies -> code_expiry
```</script>
<script type="text/plain" id="ex22"># How our two teams compare
A quick look at where each team is strong, scored from 1 to 5.
```mermaid
radar-beta
title Team skills
axis design["Design"], frontend["Frontend"], backend["Backend"]
axis data["Data"], devops["DevOps"], support["Support"]
curve web["Web team"]{5, 5, 3, 2, 3, 4}
curve platform["Platform team"]{2, 3, 5, 4, 5, 3}
max 5
min 0
```
1. The web team leads on design; the platform team helps when a screen needs a second opinion.
2. Frontend is the web team's home ground.
3. Backend work goes to the platform team first.
4. Data and reports sit with the platform team.
5. Servers and deployments are run by the platform team.
6. Both teams share customer support, with the web team taking slightly more.
</script>
<script type="text/plain" id="ex23"># Where this year's budget goes
How the HK$1.2M project budget is split.
```mermaid
treemap-beta
"Build"
"Website": 320
"Mobile app": 280
"Back office": 150
"Run"
"Hosting": 90
"Support": 120
"Grow"
"Marketing"
"Ads": 110
"Content": 60
"Research": 70
```
1. Most of the money goes into building the product: the website, the app and the staff back office.
2. Keeping it running costs about a sixth of the budget, mostly support.
3. The rest is for growth: advertising, content and talking to customers.
</script>
<script type="text/plain" id="ex24"># What happens when a customer checks out
```mermaid
zenuml
title Checkout
@Actor Customer
@Boundary Shop
@Control Orders
@Database OrderDB
@EC2 Payments
@Starter(Customer)
// The customer presses Pay
Shop.checkout(cart) {
Orders.create(cart) {
order = new Order(cart)
OrderDB.save(order)
return order
}
result = Payments.charge(order)
if(result == paid) {
Orders.markPaid(order)
} else {
Shop.showError()
}
return receipt
}
```
- **Payments**: Card details go straight to the payment provider; the shop never stores them.
</script>
<script type="module">
import * as THREE from './vendor/three.module.js';
"use strict";
import {
$, esc, mdInline, parseMarkdown, parseMermaid, layout,
DS, ICONS_ON, setStyle, initStyle, wireUi, stepsHtml,
isEmbed, viewHref, fetchMarkdown, urlLink, bindPage, openPop, popOpen
} from './core.mjs';
/* ---------- 3D scene (three.js) ---------- */
const colorize=g=>g.nodes.forEach(n=>{const P=DS.blocks;n.color=n.ci!=null?P[n.ci%P.length]:g.groups.length?(n.group==null?DS.neutral:P[n.group%P.length]):P[n.rank%P.length]});
function rr(h,r,seg=6){const pts=[];[[h-r,h-r,0],[-(h-r),h-r,90],[-(h-r),-(h-r),180],[h-r,-(h-r),270]].forEach(([cx,cy,a0])=>{for(let i=0;i<=seg;i++){const a=(a0+90*i/seg)*Math.PI/180;pts.push([cx+r*Math.cos(a),cy+r*Math.sin(a)])}});return pts}
function ngon(r,n,rot=0){return Array.from({length:n},(_,i)=>{const a=rot+i*2*Math.PI/n;return [r*Math.cos(a),r*Math.sin(a)]})}
/** @type {Array<[RegExp,string]>} */
const ICONS=[[/\b(error|fail\w*|reject\w*|cancel\w*|invalid)\b|失敗|錯誤/i,'⚠️'],[/\b(inbox|mail|email|smtp)\b|電郵/i,'✉️'],[/\b(customer|user|client|buyer|visitor|shopper|member)s?\b|用戶|客戶|顧客/i,'🧑'],[/\b(admin|staff|editor|manager)\b|員工|管理/i,'🧑💼'],
[/\b(pay\w*|stripe|checkout|billing|card|refund)\b|付款|支付/i,'💳'],[/\b(auth\w*|login|sign.?in|token|password|otp)\b|登入/i,'🔐'],[/\b(database|db|mysql|postgres\w*|sql)\b|資料庫/i,'🗄️'],
[/\b(cache|redis)\b/i,'⚡'],[/\b(queue|kafka|jobs?|worker)\b/i,'📬'],[/\b(tickets?|coupons?|vouchers?|allocation)\b|門票/i,'🎟️'],[/\b(orders?|cart|invoice)\b|訂單/i,'🧾'],
[/\b(notif\w*|sms|push|telegram|whatsapp)\b|通知/i,'🔔'],[/\b(storage|s3|files?|bucket|pdf|upload)\b|檔案/i,'📦'],[/\b(shop|store|shopify)\b|商店/i,'🏬'],
[/\b(browser|web|website|frontend|page)\b|網站/i,'🌐'],[/\b(app|mobile|phone|ios|android)\b/i,'📱'],[/\b(ai|llm|gpt|claude|model)\b/i,'🤖'],
[/\b(report|analytics|dashboard)\b/i,'📊'],[/\b(cron|schedule\w*|timer|wait)\b/i,'⏱️'],[/\b(vendor|supplier|partner)\b/i,'🤝'],[/\b(cdn|cloud)\b/i,'☁️'],[/\b(logs?|audit)\b/i,'📜'],
[/\b(success|done|complete\w*|finish\w*|approved)\b|完成/i,'✅'],[/\b(start|begin)\b|開始/i,'▶️'],[/\b(api|gateway|server|backend|service|laravel)\b/i,'⚙️']];
const iconFor=n=>{if(n.icon)return n.icon;if(n.shape==='hex')return '🔀';for(const [re,ic] of ICONS)if(re.test(n.label))return ic;return n.actor?'🧑':(n.iconFallback||'')};
/** @type {any} */
const S={doc:null,scene:null,si:0,step:0,playing:false,timer:null,labs:[],pick:[],active:null,rev:false,t0:0};
const canvas=$('#scene'),stage=$('.stage'),labels=$('#labels');
const to2d=()=>{location.replace(viewHref('2d'))};
let renderer;
try{renderer=new THREE.WebGLRenderer({canvas,antialias:true,alpha:true})}catch(e){to2d();throw e}
renderer.setPixelRatio(Math.min(devicePixelRatio||1,2));
renderer.shadowMap.enabled=true;renderer.shadowMap.type=THREE.PCFShadowMap;
const scene3=new THREE.Scene(),camera=new THREE.PerspectiveCamera(28,1,.5,800),probe=camera.clone();