in plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/util/pngj/chunks/ChunkHelper.kt [231:245]
fun equivalent(c1: PngChunk?, c2: PngChunk?): Boolean {
if (c1 === c2) return true
if (c1 == null || c2 == null || c1.id != c2.id) return false
if (c1.crit) return false
// same id
if (c1::class != c2::class) return false // should not happen
if (!c2.allowsMultiple()) return true
if (c1 is PngChunkTextVar) {
return c1.key.equals((c2 as PngChunkTextVar?)?.key)
}
return if (c1 is PngChunkSPLT) {
c1.palName.equals((c2 as PngChunkSPLT?)?.palName)
} else false
// unknown chunks that allow multiple? consider they don't match
}