<commit_before>import UIKit

class VChatEmojiKeyboard:UIView, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout
{
    weak var controller:CChat!
    weak var collectionView:UICollectionView!
    weak var layoutHeight:NSLayoutConstraint!
    let model:MChatEmojiKeyboard
    private let kNumberOfLines:CGFloat = 2
    private let kBorderHeight:CGFloat = 1
    private let kMaxHeight:CGFloat = 250
    private let kCellWidth:CGFloat = 80
    private let kFooterHeight:CGFloat = 90
    private let kAnimationDuration:TimeInterval = 0.3
    private let kDeselectAfter:TimeInterval = 1
    
    init(controller:CChat)
    {
        model = MChatEmojiKeyboard()
        
        super.init(frame:CGRect.zero)
        clipsToBounds = true
        backgroundColor = UIColor.collectionBackground()
        translatesAutoresizingMaskIntoConstraints = false
        self.controller = controller
        
        let cellsHeight:CGFloat = kMaxHeight - kFooterHeight
        let cellLineHeight:CGFloat = cellsHeight / kNumberOfLines
        
        let border:UIView = UIView()
        border.isUserInteractionEnabled = false
        border.backgroundColor = UIColor.bubbleMine()
        border.translatesAutoresizingMaskIntoConstraints = false
        
        let flow:UICollectionViewFlowLayout = UICollectionViewFlowLayout()
        flow.headerReferenceSize = CGSize.zero
        flow.footerReferenceSize = CGSize(width:0, height:kFooterHeight)
        flow.scrollDirection = UICollectionViewScrollDirection.vertical
        flow.minimumLineSpacing = 0
        flow.minimumInteritemSpacing = 0
        flow.itemSize = CGSize(width:kCellWidth, height:cellLineHeight)
        
        let collectionView:UICollectionView = UICollectionView(frame:CGRect.zero, collectionViewLayout:flow)
        collectionView.translatesAutoresizingMaskIntoConstraints = false
        collectionView.clipsToBounds = true
        collectionView.backgroundColor = UIColor.clear
        collectionView.showsVerticalScrollIndicator = false
        collectionView.showsHorizontalScrollIndicator = false
        collectionView.bounces = false
        collectionView.isScrollEnabled = false
        collectionView.delegate = self
        collectionView.dataSource = self
        collectionView.register(
            VChatEmojiKeyboardCell.self,
            forCellWithReuseIdentifier:
            VChatEmojiKeyboardCell.reusableIdentifier())
        collectionView.register(
            VChatEmojiKeyboardFooter.self,
            forSupplementaryViewOfKind:UICollectionElementKindSectionFooter,
            withReuseIdentifier:
            VChatEmojiKeyboardFooter.reusableIdentifier())
        
        addSubview(border)
        addSubview(collectionView)
        
        let views:[String:UIView] = [
            "border":border,
            "collectionView":collectionView]
        
        let metrics:[String:CGFloat] = [
            "borderHeight":kBorderHeight,
            "collectionHeight":kMaxHeight]
        
        addConstraints(NSLayoutConstraint.constraints(
            withVisualFormat:"H:|-0-[border]-0-|",
            options:[],
            metrics:metrics,
            views:views))
        addConstraints(NSLayoutConstraint.constraints(
            withVisualFormat:"H:|-0-[collectionView]-0-|",
            options:[],
            metrics:metrics,
            views:views))
        addConstraints(NSLayoutConstraint.constraints(
            withVisualFormat:"V:|-0-[border(borderHeight)]",<commit_msg>collectionView reference<commit_after>import UIKit

class VChatEmojiKeyboard:UIView, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout
{
    weak var controller:CChat!
    weak var collectionView:UICollectionView!
    weak var layoutHeight:NSLayoutConstraint!
    let model:MChatEmojiKeyboard
    private let kNumberOfLines:CGFloat = 2
    private let kBorderHeight:CGFloat = 1
    private let kMaxHeight:CGFloat = 250
    private let kCellWidth:CGFloat = 80
    private let kFooterHeight:CGFloat = 90
    private let kAnimationDuration:TimeInterval = 0.3
    private let kDeselectAfter:TimeInterval = 1
    
    init(controller:CChat)
    {
        model = MChatEmojiKeyboard()
        
        super.init(frame:CGRect.zero)
        clipsToBounds = true
        backgroundColor = UIColor.collectionBackground()
        translatesAutoresizingMaskIntoConstraints = false
        self.controller = controller
        
        let cellsHeight:CGFloat = kMaxHeight - kFooterHeight
        let cellLineHeight:CGFloat = cellsHeight / kNumberOfLines
        
        let border:UIView = UIView()
        border.isUserInteractionEnabled = false
        border.backgroundColor = UIColor.bubbleMine()
        border.translatesAutoresizingMaskIntoConstraints = false
        
        let flow:UICollectionViewFlowLayout = UICollectionViewFlowLayout()
        flow.headerReferenceSize = CGSize.zero
        flow.footerReferenceSize = CGSize(width:0, height:kFooterHeight)
        flow.scrollDirection = UICollectionViewScrollDirection.vertical
        flow.minimumLineSpacing = 0
        flow.minimumInteritemSpacing = 0
        flow.itemSize = CGSize(width:kCellWidth, height:cellLineHeight)
        
        let collectionView:UICollectionView = UICollectionView(frame:CGRect.zero, collectionViewLayout:flow)
        collectionView.translatesAutoresizingMaskIntoConstraints = false
        collectionView.clipsToBounds = true
        collectionView.backgroundColor = UIColor.clear
        collectionView.showsVerticalScrollIndicator = false
        collectionView.showsHorizontalScrollIndicator = false
        collectionView.bounces = false
        collectionView.isScrollEnabled = false
        collectionView.delegate = self
        collectionView.dataSource = self
        collectionView.register(
            VChatEmojiKeyboardCell.self,
            forCellWithReuseIdentifier:
            VChatEmojiKeyboardCell.reusableIdentifier())
        collectionView.register(
            VChatEmojiKeyboardFooter.self,
            forSupplementaryViewOfKind:UICollectionElementKindSectionFooter,
            withReuseIdentifier:
            VChatEmojiKeyboardFooter.reusableIdentifier())
        self.collectionView = collectionView
        
        addSubview(border)
        addSubview(collectionView)
        
        let views:[String:UIView] = [
            "border":border,
            "collectionView":collectionView]
        
        let metrics:[String:CGFloat] = [
            "borderHeight":kBorderHeight,
            "collectionHeight":kMaxHeight]
        
        addConstraints(NSLayoutConstraint.constraints(
            withVisualFormat:"H:|-0-[border]-0-|",
            options:[],
            metrics:metrics,
            views:views))
        addConstraints(NSLayoutConstraint.constraints(
            withVisualFormat:"H:|-0-[collectionView]-0-|",
            options:[],
            metrics:metrics,
            views:views))
        addConstraints(NSLayoutConstraint.constraints(
            withVisualFormat:"V:|-0-[border(borderHeight)]",
{'fraction_non_alphanumeric': 0.06797752808988763, 'fraction_numerical': 0.0056179775280898875, 'mean_word_length': 2.8450323974082075, 'pattern_counts': {'":': 8, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1084915', 'n_tokens_mistral': 1832, 'n_tokens_neox': 1853, 'n_words': 292}