Objective
Given a matrix of connected box drawing characters, count its genus, the number of plane sections it encloses.
Valid input
The box drawing characters are ─│┌┐└┘├┤┬┴┼╴╵╶╷
(U+2500 U+2502 U+250C U+2510 U+2514 U+2518 U+251C U+2524 U+252C U+2534 U+253C U+2574 U+2575 U+2576 U+2577). The matrix shall contain these characters only, along with unique "nothing" value that represents a blank.
The input may also be a string with box drawing characters, whitespaces, and line feeds. You cannot mix different types of whitespaces, or different types of line feeds. Trailing whitespaces and line feeds are permitted.
Rule
Invalid input falls in don't care situation. In particular, you don't need to handle any input having multiple connected components, e.g.
# this
┌─┐┌─┐
└─┘└─┘
# or this
┌───┐
│┌─┐│
│└─┘│
└───┘
Examples
For font issues, every example is presented using normal spaces (U+0020) once and ideographic spaces (U+3000) once.
Genus 0
# Using U+0020 space
┤ ╷
└─┘
┌┼┐
─┴
# Using U+3000 space
┤ ╷
└─┘
┌┼┐
─┴
Genus 1
# Using U+0020 space
┌─┬
│ │
└─┘
┼┬─┬
╵│ │
└┴─┘
# Using U+3000 space
┌─┬
│ │
└─┘
┼┬─┬
╵│ │
└┴─┘
Genus 2
# Using U+0020 space
┼┼┼┼
┼┼┼
# Using U+3000 space
┼┼┼┼
┼┼┼