presentar-terminal 0.3.5

Terminal backend for Presentar UI framework with zero-allocation rendering
Documentation
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
//! Cell buffer with zero-allocation steady state.
//!
//! Uses `CompactString` to inline small strings (≤24 bytes), avoiding
//! heap allocations for typical terminal content.

use bitvec::prelude::*;
use compact_str::CompactString;
use presentar_core::Color;
use unicode_width::UnicodeWidthStr;

/// Text modifiers for terminal cells.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct Modifiers(u8);

impl Modifiers {
    /// No modifiers.
    pub const NONE: Self = Self(0);
    /// Bold text.
    pub const BOLD: Self = Self(1 << 0);
    /// Italic text.
    pub const ITALIC: Self = Self(1 << 1);
    /// Underlined text.
    pub const UNDERLINE: Self = Self(1 << 2);
    /// Strikethrough text.
    pub const STRIKETHROUGH: Self = Self(1 << 3);
    /// Dim/faint text.
    pub const DIM: Self = Self(1 << 4);
    /// Blinking text.
    pub const BLINK: Self = Self(1 << 5);
    /// Reversed colors.
    pub const REVERSE: Self = Self(1 << 6);
    /// Hidden text.
    pub const HIDDEN: Self = Self(1 << 7);

    /// Create empty modifiers.
    #[must_use]
    pub const fn empty() -> Self {
        Self::NONE
    }

    /// Check if modifiers is empty.
    #[must_use]
    pub const fn is_empty(self) -> bool {
        self.0 == 0
    }

    /// Check if a specific modifier is set.
    #[must_use]
    pub const fn contains(self, other: Self) -> bool {
        (self.0 & other.0) == other.0
    }

    /// Add a modifier.
    #[must_use]
    pub const fn with(self, other: Self) -> Self {
        Self(self.0 | other.0)
    }

    /// Remove a modifier.
    #[must_use]
    pub const fn without(self, other: Self) -> Self {
        Self(self.0 & !other.0)
    }

    /// Get raw bits.
    #[must_use]
    pub const fn bits(self) -> u8 {
        self.0
    }

    /// Create from raw bits.
    #[must_use]
    pub const fn from_bits(bits: u8) -> Self {
        Self(bits)
    }
}

impl std::ops::BitOr for Modifiers {
    type Output = Self;

    fn bitor(self, rhs: Self) -> Self::Output {
        Self(self.0 | rhs.0)
    }
}

impl std::ops::BitOrAssign for Modifiers {
    fn bitor_assign(&mut self, rhs: Self) {
        self.0 |= rhs.0;
    }
}

impl std::ops::BitAnd for Modifiers {
    type Output = Self;

    fn bitand(self, rhs: Self) -> Self::Output {
        Self(self.0 & rhs.0)
    }
}

/// A single terminal cell.
///
/// Uses `CompactString` for zero-allocation storage of typical graphemes.
/// Memory layout is optimized for cache efficiency (40 bytes total).
#[derive(Clone, Debug, PartialEq)]
pub struct Cell {
    /// The symbol displayed in this cell (inlined for ≤24 bytes).
    pub symbol: CompactString,
    /// Foreground color.
    pub fg: Color,
    /// Background color.
    pub bg: Color,
    /// Text modifiers.
    pub modifiers: Modifiers,
    /// Display width of the symbol (1 for normal, 2 for wide chars, 0 for continuation).
    width: u8,
}

impl Default for Cell {
    fn default() -> Self {
        Self {
            symbol: CompactString::const_new(" "),
            fg: Color::WHITE,
            // Use transparent background so unpainted areas don't show black
            bg: Color::TRANSPARENT,
            modifiers: Modifiers::NONE,
            width: 1,
        }
    }
}

impl Cell {
    /// Create a new cell with the given content.
    #[must_use]
    pub fn new(symbol: &str, fg: Color, bg: Color, modifiers: Modifiers) -> Self {
        let width = UnicodeWidthStr::width(symbol).min(255) as u8;
        Self {
            symbol: CompactString::new(symbol),
            fg,
            bg,
            modifiers,
            width: width.max(1),
        }
    }

    /// Update the cell content (zero-allocation for small strings).
    pub fn update(&mut self, symbol: &str, fg: Color, bg: Color, modifiers: Modifiers) {
        self.symbol.clear();
        self.symbol.push_str(symbol);
        self.fg = fg;
        self.bg = bg;
        self.modifiers = modifiers;
        self.width = UnicodeWidthStr::width(symbol).clamp(1, 255) as u8;
    }

    /// Mark this cell as a continuation of a wide character.
    pub fn make_continuation(&mut self) {
        self.symbol.clear();
        self.width = 0;
    }

    /// Check if this is a continuation cell.
    #[must_use]
    pub const fn is_continuation(&self) -> bool {
        self.width == 0
    }

    /// Get the display width of this cell.
    #[must_use]
    pub const fn width(&self) -> u8 {
        self.width
    }

    /// Reset to default (space with transparent background).
    pub fn reset(&mut self) {
        self.symbol.clear();
        self.symbol.push(' ');
        self.fg = Color::WHITE;
        self.bg = Color::TRANSPARENT;
        self.modifiers = Modifiers::NONE;
        self.width = 1;
    }
}

/// Buffer of terminal cells with dirty tracking.
///
/// Memory footprint for 80×24 terminal: ~75KB
/// (1920 cells × 40 bytes per cell ≈ 76KB)
#[derive(Debug)]
pub struct CellBuffer {
    /// The cell storage.
    cells: Vec<Cell>,
    /// Terminal width.
    width: u16,
    /// Terminal height.
    height: u16,
    /// Dirty bit per cell (1 bit per cell).
    dirty: BitVec,
}

impl CellBuffer {
    /// Create a new buffer with the given dimensions.
    #[must_use]
    pub fn new(width: u16, height: u16) -> Self {
        let size = (width as usize) * (height as usize);
        Self {
            cells: vec![Cell::default(); size],
            width,
            height,
            dirty: bitvec![0; size],
        }
    }

    /// Get the buffer width.
    #[must_use]
    pub const fn width(&self) -> u16 {
        self.width
    }

    /// Get the buffer height.
    #[must_use]
    pub const fn height(&self) -> u16 {
        self.height
    }

    /// Get total cell count.
    #[must_use]
    pub fn len(&self) -> usize {
        self.cells.len()
    }

    /// Check if buffer is empty.
    #[must_use]
    pub fn is_empty(&self) -> bool {
        self.cells.is_empty()
    }

    /// Convert (x, y) to linear index.
    #[must_use]
    pub fn index(&self, x: u16, y: u16) -> usize {
        debug_assert!(x < self.width, "x coordinate out of bounds");
        debug_assert!(y < self.height, "y coordinate out of bounds");
        (y as usize) * (self.width as usize) + (x as usize)
    }

    /// Convert linear index to (x, y).
    #[must_use]
    pub fn coords(&self, idx: usize) -> (u16, u16) {
        debug_assert!(idx < self.cells.len(), "index out of bounds");
        let x = (idx % (self.width as usize)) as u16;
        let y = (idx / (self.width as usize)) as u16;
        debug_assert!(
            x < self.width && y < self.height,
            "coords must be in bounds"
        );
        (x, y)
    }

    /// Get a cell reference.
    #[must_use]
    pub fn get(&self, x: u16, y: u16) -> Option<&Cell> {
        if x < self.width && y < self.height {
            Some(&self.cells[self.index(x, y)])
        } else {
            None
        }
    }

    /// Get a mutable cell reference.
    pub fn get_mut(&mut self, x: u16, y: u16) -> Option<&mut Cell> {
        if x < self.width && y < self.height {
            let idx = self.index(x, y);
            Some(&mut self.cells[idx])
        } else {
            None
        }
    }

    /// Set a cell and mark it dirty.
    pub fn set(&mut self, x: u16, y: u16, cell: Cell) {
        if x < self.width && y < self.height {
            let idx = self.index(x, y);
            self.cells[idx] = cell;
            self.dirty.set(idx, true);
        }
    }

    /// Update a cell's content and mark it dirty.
    pub fn update(
        &mut self,
        x: u16,
        y: u16,
        symbol: &str,
        fg: Color,
        bg: Color,
        modifiers: Modifiers,
    ) {
        if x < self.width && y < self.height {
            let idx = self.index(x, y);
            self.cells[idx].update(symbol, fg, bg, modifiers);
            self.dirty.set(idx, true);
        }
    }

    /// Mark a cell as dirty.
    pub fn mark_dirty(&mut self, x: u16, y: u16) {
        if x < self.width && y < self.height {
            let idx = self.index(x, y);
            self.dirty.set(idx, true);
        }
    }

    /// Mark all cells as dirty (for full redraw).
    pub fn mark_all_dirty(&mut self) {
        self.dirty.fill(true);
    }

    /// Clear dirty flags.
    pub fn clear_dirty(&mut self) {
        self.dirty.fill(false);
    }

    /// Count dirty cells.
    #[must_use]
    pub fn dirty_count(&self) -> usize {
        self.dirty.count_ones()
    }

    /// Iterate over dirty cell indices.
    pub fn iter_dirty(&self) -> impl Iterator<Item = usize> + '_ {
        self.dirty.iter_ones()
    }

    /// Get cells slice.
    #[must_use]
    pub fn cells(&self) -> &[Cell] {
        &self.cells
    }

    /// Get cells mutable slice.
    pub fn cells_mut(&mut self) -> &mut [Cell] {
        &mut self.cells
    }

    /// Resize the buffer (clears all content).
    pub fn resize(&mut self, width: u16, height: u16) {
        let size = (width as usize) * (height as usize);
        self.width = width;
        self.height = height;
        self.cells.clear();
        self.cells.resize(size, Cell::default());
        self.dirty = bitvec![0; size];
        self.mark_all_dirty();
    }

    /// Clear the buffer (reset all cells to default).
    pub fn clear(&mut self) {
        for cell in &mut self.cells {
            cell.reset();
        }
        self.mark_all_dirty();
    }

    /// Fill a rectangular region.
    pub fn fill_rect(&mut self, x: u16, y: u16, width: u16, height: u16, fg: Color, bg: Color) {
        let x_end = (x + width).min(self.width);
        let y_end = (y + height).min(self.height);

        for cy in y..y_end {
            for cx in x..x_end {
                self.update(cx, cy, " ", fg, bg, Modifiers::NONE);
            }
        }
    }

    /// Set a single character at the given position (keeps existing colors/modifiers).
    pub fn set_char(&mut self, x: u16, y: u16, ch: char) {
        if let Some(cell) = self.get_mut(x, y) {
            let mut buf = [0u8; 4];
            let s = ch.encode_utf8(&mut buf);
            cell.symbol = CompactString::from(&*s);
            self.mark_dirty(x, y);
        }
    }

    /// Write a string starting at the given position (keeps existing colors/modifiers).
    pub fn write_str(&mut self, x: u16, y: u16, s: &str) {
        let mut cx = x;
        for ch in s.chars() {
            self.set_char(cx, y, ch);
            cx = cx.saturating_add(1);
            if cx >= self.width {
                break;
            }
        }
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_modifiers_empty() {
        let m = Modifiers::empty();
        assert!(m.is_empty());
        assert_eq!(m.bits(), 0);
    }

    #[test]
    fn test_modifiers_with() {
        let m = Modifiers::NONE.with(Modifiers::BOLD);
        assert!(m.contains(Modifiers::BOLD));
        assert!(!m.contains(Modifiers::ITALIC));
    }

    #[test]
    fn test_modifiers_without() {
        let m = Modifiers::BOLD.with(Modifiers::ITALIC);
        let m2 = m.without(Modifiers::BOLD);
        assert!(!m2.contains(Modifiers::BOLD));
        assert!(m2.contains(Modifiers::ITALIC));
    }

    #[test]
    fn test_modifiers_bitor() {
        let m = Modifiers::BOLD | Modifiers::ITALIC;
        assert!(m.contains(Modifiers::BOLD));
        assert!(m.contains(Modifiers::ITALIC));
    }

    #[test]
    fn test_modifiers_bitor_assign() {
        let mut m = Modifiers::BOLD;
        m |= Modifiers::ITALIC;
        assert!(m.contains(Modifiers::BOLD));
        assert!(m.contains(Modifiers::ITALIC));
    }

    #[test]
    fn test_modifiers_bitand() {
        let m1 = Modifiers::BOLD | Modifiers::ITALIC;
        let m2 = Modifiers::BOLD | Modifiers::UNDERLINE;
        let m3 = m1 & m2;
        assert!(m3.contains(Modifiers::BOLD));
        assert!(!m3.contains(Modifiers::ITALIC));
    }

    #[test]
    fn test_modifiers_from_bits() {
        let m = Modifiers::from_bits(0b0000_0011);
        assert!(m.contains(Modifiers::BOLD));
        assert!(m.contains(Modifiers::ITALIC));
    }

    #[test]
    fn test_cell_default() {
        let cell = Cell::default();
        assert_eq!(cell.symbol.as_str(), " ");
        assert_eq!(cell.fg, Color::WHITE);
        assert_eq!(cell.bg, Color::TRANSPARENT);
        assert_eq!(cell.modifiers, Modifiers::NONE);
        assert_eq!(cell.width(), 1);
    }

    #[test]
    fn test_cell_new() {
        let cell = Cell::new("A", Color::RED, Color::BLUE, Modifiers::BOLD);
        assert_eq!(cell.symbol.as_str(), "A");
        assert_eq!(cell.fg, Color::RED);
        assert_eq!(cell.bg, Color::BLUE);
        assert!(cell.modifiers.contains(Modifiers::BOLD));
        assert_eq!(cell.width(), 1);
    }

    #[test]
    fn test_cell_wide_char() {
        let cell = Cell::new("", Color::WHITE, Color::BLACK, Modifiers::NONE);
        assert_eq!(cell.width(), 2);
    }

    #[test]
    fn test_cell_update() {
        let mut cell = Cell::default();
        cell.update("X", Color::GREEN, Color::YELLOW, Modifiers::ITALIC);
        assert_eq!(cell.symbol.as_str(), "X");
        assert_eq!(cell.fg, Color::GREEN);
        assert_eq!(cell.bg, Color::YELLOW);
        assert!(cell.modifiers.contains(Modifiers::ITALIC));
    }

    #[test]
    fn test_cell_continuation() {
        let mut cell = Cell::new("", Color::WHITE, Color::BLACK, Modifiers::NONE);
        cell.make_continuation();
        assert!(cell.is_continuation());
        assert_eq!(cell.width(), 0);
    }

    #[test]
    fn test_cell_reset() {
        let mut cell = Cell::new("X", Color::RED, Color::BLUE, Modifiers::BOLD);
        cell.reset();
        assert_eq!(cell.symbol.as_str(), " ");
        assert_eq!(cell.fg, Color::WHITE);
        assert_eq!(cell.bg, Color::TRANSPARENT);
        assert!(cell.modifiers.is_empty());
    }

    #[test]
    fn test_buffer_creation() {
        let buf = CellBuffer::new(80, 24);
        assert_eq!(buf.width(), 80);
        assert_eq!(buf.height(), 24);
        assert_eq!(buf.len(), 1920);
        assert!(!buf.is_empty());
    }

    #[test]
    fn test_buffer_empty() {
        let buf = CellBuffer::new(0, 0);
        assert!(buf.is_empty());
    }

    #[test]
    fn test_buffer_index() {
        let buf = CellBuffer::new(10, 5);
        assert_eq!(buf.index(0, 0), 0);
        assert_eq!(buf.index(5, 0), 5);
        assert_eq!(buf.index(0, 1), 10);
        assert_eq!(buf.index(5, 2), 25);
    }

    #[test]
    fn test_buffer_coords() {
        let buf = CellBuffer::new(10, 5);
        assert_eq!(buf.coords(0), (0, 0));
        assert_eq!(buf.coords(5), (5, 0));
        assert_eq!(buf.coords(10), (0, 1));
        assert_eq!(buf.coords(25), (5, 2));
    }

    #[test]
    fn test_buffer_get() {
        let buf = CellBuffer::new(10, 5);
        assert!(buf.get(0, 0).is_some());
        assert!(buf.get(9, 4).is_some());
        assert!(buf.get(10, 0).is_none());
        assert!(buf.get(0, 5).is_none());
    }

    #[test]
    fn test_buffer_get_mut() {
        let mut buf = CellBuffer::new(10, 5);
        assert!(buf.get_mut(0, 0).is_some());
        assert!(buf.get_mut(10, 0).is_none());
    }

    #[test]
    fn test_buffer_set() {
        let mut buf = CellBuffer::new(10, 5);
        let cell = Cell::new("X", Color::RED, Color::BLUE, Modifiers::NONE);
        buf.set(5, 2, cell);

        let retrieved = buf.get(5, 2).unwrap();
        assert_eq!(retrieved.symbol.as_str(), "X");
        assert!(buf.dirty_count() > 0);
    }

    #[test]
    fn test_buffer_set_out_of_bounds() {
        let mut buf = CellBuffer::new(10, 5);
        let cell = Cell::new("X", Color::RED, Color::BLUE, Modifiers::NONE);
        buf.set(100, 100, cell); // Should not panic
    }

    #[test]
    fn test_buffer_update() {
        let mut buf = CellBuffer::new(10, 5);
        buf.update(3, 3, "Y", Color::GREEN, Color::BLACK, Modifiers::BOLD);

        let cell = buf.get(3, 3).unwrap();
        assert_eq!(cell.symbol.as_str(), "Y");
        assert_eq!(cell.fg, Color::GREEN);
    }

    #[test]
    fn test_buffer_dirty_tracking() {
        let mut buf = CellBuffer::new(10, 5);
        assert_eq!(buf.dirty_count(), 0);

        buf.mark_dirty(0, 0);
        assert_eq!(buf.dirty_count(), 1);

        buf.mark_all_dirty();
        assert_eq!(buf.dirty_count(), 50);

        buf.clear_dirty();
        assert_eq!(buf.dirty_count(), 0);
    }

    #[test]
    fn test_buffer_iter_dirty() {
        let mut buf = CellBuffer::new(10, 5);
        buf.mark_dirty(1, 1);
        buf.mark_dirty(3, 3);

        let dirty: Vec<usize> = buf.iter_dirty().collect();
        assert_eq!(dirty.len(), 2);
        assert!(dirty.contains(&buf.index(1, 1)));
        assert!(dirty.contains(&buf.index(3, 3)));
    }

    #[test]
    fn test_buffer_resize() {
        let mut buf = CellBuffer::new(10, 5);
        buf.update(0, 0, "X", Color::RED, Color::BLACK, Modifiers::NONE);

        buf.resize(20, 10);
        assert_eq!(buf.width(), 20);
        assert_eq!(buf.height(), 10);
        assert_eq!(buf.len(), 200);
        // Content should be cleared
        assert_eq!(buf.get(0, 0).unwrap().symbol.as_str(), " ");
        // All should be dirty after resize
        assert_eq!(buf.dirty_count(), 200);
    }

    #[test]
    fn test_buffer_clear() {
        let mut buf = CellBuffer::new(10, 5);
        buf.update(0, 0, "X", Color::RED, Color::BLACK, Modifiers::BOLD);
        buf.clear_dirty();

        buf.clear();
        let cell = buf.get(0, 0).unwrap();
        assert_eq!(cell.symbol.as_str(), " ");
        assert!(cell.modifiers.is_empty());
        assert_eq!(buf.dirty_count(), 50);
    }

    #[test]
    fn test_buffer_fill_rect() {
        let mut buf = CellBuffer::new(10, 10);
        buf.fill_rect(2, 2, 3, 3, Color::WHITE, Color::RED);

        // Inside rect
        assert_eq!(buf.get(3, 3).unwrap().bg, Color::RED);
        // Outside rect - default is TRANSPARENT
        assert_eq!(buf.get(0, 0).unwrap().bg, Color::TRANSPARENT);
    }

    #[test]
    fn test_buffer_fill_rect_clipped() {
        let mut buf = CellBuffer::new(10, 10);
        buf.fill_rect(8, 8, 5, 5, Color::WHITE, Color::BLUE);

        // Should be clipped to buffer bounds
        assert_eq!(buf.get(9, 9).unwrap().bg, Color::BLUE);
    }

    #[test]
    fn test_buffer_cells_access() {
        let mut buf = CellBuffer::new(10, 5);
        assert_eq!(buf.cells().len(), 50);
        assert_eq!(buf.cells_mut().len(), 50);
    }

    #[test]
    fn test_cell_empty_string() {
        let cell = Cell::new("", Color::WHITE, Color::BLACK, Modifiers::NONE);
        // Width should be at least 1
        assert_eq!(cell.width(), 1);
    }

    #[test]
    fn test_modifiers_all_flags() {
        let all = Modifiers::BOLD
            | Modifiers::ITALIC
            | Modifiers::UNDERLINE
            | Modifiers::STRIKETHROUGH
            | Modifiers::DIM
            | Modifiers::BLINK
            | Modifiers::REVERSE
            | Modifiers::HIDDEN;

        assert!(all.contains(Modifiers::BOLD));
        assert!(all.contains(Modifiers::ITALIC));
        assert!(all.contains(Modifiers::UNDERLINE));
        assert!(all.contains(Modifiers::STRIKETHROUGH));
        assert!(all.contains(Modifiers::DIM));
        assert!(all.contains(Modifiers::BLINK));
        assert!(all.contains(Modifiers::REVERSE));
        assert!(all.contains(Modifiers::HIDDEN));
    }
}