Move SSD canvas label fallback to typed Kotlin

ober

cf1535c92dcb0c36727f4321aefee73745dc5131

diff --git a/templates/ssd-review.ss b/templates/ssd-review.ss
index bde3869..6203b91 100644
--- a/templates/ssd-review.ss
+++ b/templates/ssd-review.ss
@@ -3667,7 +3667,7 @@
                 formatActivityDuration groupDisplayLabel appendModeStatus
                 selectedGroupStatus sessionCountsStatus rotatedPageStatus
                 manualGroupLabel manualCellCount editedGroupCount
-                clampPageIndex shiftPageIndex)
+                clampPageIndex shiftPageIndex displayGroupCanvasLabel)
         (type Int32)
         (def (normalizeFiringArc (value : String)) : String
           (string-uppercase (string-trim value)))
@@ -3774,6 +3774,13 @@
             (if (string-blank? label)
               (SsdGroup-id group)
               label)))
+        (def (displayGroupCanvasLabel (group : SsdGroup) (selected : Bool)) : String
+          (let ((label (SsdGroup-label group)))
+            (if (not (string-blank? label))
+              label
+              (if selected
+                (groupDisplayLabel group)
+                ""))))
         (def (manualGroupLabel (label : String)
                                (resolvedName : (Nullable String))
                                (fallback : String)) : String
@@ -6831,11 +6838,7 @@
        "        val sess = session ?: return"
        "        for (group in sess.groups) {"
        "            val selected = group.id == selectedGroupId"
-       "            val label = when {"
-       "                group.label.isNotBlank() -> group.label"
-       "                selected -> groupDisplayLabel(group)"
-       "                else -> \"\""
-       "            }"
+       "            val label = displayGroupCanvasLabel(group, selected)"
        "            if (label.isBlank()) continue"
        "            val center = floatArrayOf("
        "                (group.bbox[0] + group.bbox[2]) / 2f,"