-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathiocraft.mts
More file actions
901 lines (845 loc) · 21.4 KB
/
iocraft.mts
File metadata and controls
901 lines (845 loc) · 21.4 KB
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
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
/**
* @fileoverview iocraft abstraction layer for terminal UI.
*
* Provides a React-like API for building terminal interfaces using iocraft native bindings.
* This layer is designed to be a drop-in replacement for the Ink-based UI.
*/
import { createRequire } from 'node:module'
import type iocraft from '@socketaddon/iocraft'
// Re-export iocraft types for direct access when needed.
export type { default as IocraftNative } from '@socketaddon/iocraft'
/**
* Lazy-load iocraft to avoid import errors if the native module isn't available.
*/
let iocraftInstance: typeof iocraft | undefined
function getIocraft(): typeof iocraft {
if (!iocraftInstance) {
try {
// Use createRequire to load native .node module from ESM.
const require = createRequire(import.meta.url)
// Try opentui first (yoga-layout + opentui.node renderer),
// fall back to iocraft if not available.
let loaded
try {
loaded = require('@socketaddon/opentui')
} catch {
loaded = require('@socketaddon/iocraft')
}
// Handle ESM default export when loaded via require().
iocraftInstance = loaded.default || loaded
} catch (e) {
throw new Error(
`Failed to load terminal UI module: ${e}\n` +
`Make sure @socketaddon/opentui or @socketaddon/iocraft is installed and your platform is supported.`,
)
}
}
return iocraftInstance!
}
/**
* Text weight values for controlling font boldness.
*
* @example
* ```typescript
* Text({ children: 'Normal', weight: 'normal' })
* Text({ children: 'Bold', weight: 'bold' })
* Text({ children: 'Light', weight: 'light' })
* ```
*/
export type TextWeight = 'normal' | 'bold' | 'light'
/**
* Text alignment options for horizontal positioning.
*
* @example
* ```typescript
* Text({ children: 'Left aligned', align: 'left' })
* Text({ children: 'Centered', align: 'center' })
* Text({ children: 'Right aligned', align: 'right' })
* ```
*/
export type TextAlign = 'left' | 'center' | 'right'
/**
* Text wrapping behavior for long text content.
*
* @example
* ```typescript
* Text({ children: 'Wraps at width', wrap: 'wrap' })
* Text({ children: 'No wrapping', wrap: 'nowrap' })
* ```
*/
export type TextWrap = 'wrap' | 'nowrap'
/**
* Text styling options for visual appearance.
*
* @example
* ```typescript
* // Named colors
* Text({ children: 'Red text', color: 'red' })
*
* // Hex colors
* Text({ children: 'Custom', color: '#FF5733' })
*
* // ANSI 256 colors
* Text({ children: 'Orange', color: 'ansi:208' })
* Text({ children: 'Pink', color: '213' }) // Bare number also works
* ```
*/
export interface TextStyle {
/** Apply bold styling to text */
bold?: boolean
/** Set text color (named colors like 'red', hex like '#FF0000', or ANSI 256 codes like 'ansi:123' or '196') */
color?: string
/** Apply dim/faded styling to text (maps to light weight) */
dimColor?: boolean
/** Apply italic styling to text */
italic?: boolean
/** Apply strikethrough decoration to text */
strikethrough?: boolean
/** Apply underline decoration to text */
underline?: boolean
/** Set text weight (overrides bold if specified) */
weight?: TextWeight
}
/**
* Display type for layout positioning.
*
* @example
* ```typescript
* Box({ display: 'flex' }) // Default, enables flexbox layout
* Box({ display: 'none' }) // Hides the element
* ```
*/
export type DisplayType = 'flex' | 'none'
/**
* Position type for element positioning in layout.
*
* @example
* ```typescript
* Box({ position: 'relative' }) // Normal document flow
* Box({ position: 'absolute', top: 0, left: 0 }) // Absolute positioning
* ```
*/
export type PositionType = 'relative' | 'absolute'
/**
* Overflow behavior for content that exceeds container bounds.
*
* @example
* ```typescript
* Box({ overflow: 'visible' }) // Content can overflow
* Box({ overflow: 'hidden' }) // Clip overflow content
* Box({ overflowX: 'hidden', overflowY: 'visible' }) // Per-axis control
* ```
*/
export type OverflowType = 'visible' | 'hidden'
/**
* Border edges configuration for selective border rendering.
*
* @example
* ```typescript
* Box({ borderEdges: { top: true, bottom: true } }) // Top and bottom only
* Box({ borderEdges: { left: false, right: false } }) // Hide left/right
* ```
*/
export interface BorderEdges {
/** Show border on bottom edge */
bottom?: boolean
/** Show border on left edge */
left?: boolean
/** Show border on right edge */
right?: boolean
/** Show border on top edge */
top?: boolean
}
/**
* Custom border characters for completely custom border rendering.
*
* @example
* ```typescript
* Box({
* customBorderChars: {
* topLeft: '╔',
* topRight: '╗',
* bottomLeft: '╚',
* bottomRight: '╝',
* top: '═',
* bottom: '═',
* left: '║',
* right: '║'
* }
* })
* ```
*/
export interface CustomBorderChars {
/** Bottom border character */
bottom: string
/** Bottom-left corner character */
bottomLeft: string
/** Bottom-right corner character */
bottomRight: string
/** Left border character */
left: string
/** Right border character */
right: string
/** Top border character */
top: string
/** Top-left corner character */
topLeft: string
/** Top-right corner character */
topRight: string
}
/**
* Border style for Box/View components.
*
* @example
* ```typescript
* Box({ borderStyle: 'single' }) // ┌──┐
* Box({ borderStyle: 'double' }) // ╔══╗
* Box({ borderStyle: 'rounded' }) // ╭──╮
* Box({ borderStyle: 'bold' }) // ┏━━┓
* Box({ borderStyle: 'double-left-right' }) // ╓──╖
* Box({ borderStyle: 'double-top-bottom' }) // ╒══╕
* Box({ borderStyle: 'classic' }) // +--+
* ```
*/
export type BorderStyle =
| 'none'
| 'single'
| 'double'
| 'rounded'
| 'bold'
| 'double-left-right'
| 'double-top-bottom'
| 'classic'
/**
* Mixed text content with individual styling per section.
*
* @example
* ```typescript
* {
* text: 'Error:',
* color: 'red',
* weight: 'bold',
* decoration: 'underline',
* italic: false
* }
* ```
*/
export interface MixedTextContentSection {
/** Text color (named colors, hex, or ANSI codes) */
color?: string
/** Text decoration (underline, strikethrough, or none) */
decoration?: 'underline' | 'strikethrough' | 'none'
/** Apply italic styling */
italic?: boolean
/** The text content for this section */
text: string
/** Text weight (normal, bold, or light) */
weight?: TextWeight
}
/**
* Box/View layout properties (flexbox).
*
* Supports comprehensive flexbox layout with positioning, dimensions, spacing, and styling.
*
* @example
* ```typescript
* // Simple container
* Box({ padding: 2, children: [Text({ children: 'Hello' })] })
*
* // Flex layout
* Box({
* flexDirection: 'row',
* gap: 1,
* justifyContent: 'space-between',
* alignItems: 'center',
* children: [...]
* })
*
* // Absolute positioning
* Box({
* position: 'absolute',
* top: 0,
* right: 0,
* width: 20,
* height: 10
* })
* ```
*/
export interface BoxProps {
/** Align flex lines when there's extra space on the cross axis */
alignContent?:
| 'flex-start'
| 'flex-end'
| 'center'
| 'stretch'
| 'space-between'
| 'space-around'
/** Align items on the cross axis */
alignItems?: 'flex-start' | 'flex-end' | 'center' | 'stretch'
/** Background color (named colors or hex) */
backgroundColor?: string
/** Border color (named colors, hex, or ANSI codes like 'ansi:123' or '196') */
borderColor?: string
/** Configure which border edges to render */
borderEdges?: BorderEdges
/** Border style (supports all variants including double-left-right, double-top-bottom, classic) */
borderStyle?: BorderStyle
/** Bottom inset for absolute positioning (can be negative) */
bottom?: number
/** Custom border characters (when using custom border style) */
customBorderChars?: CustomBorderChars
/** Child elements to render inside this box */
children?: Element | Element[]
/** Gap between columns in flex layout */
columnGap?: number
/** Display type (flex or none) */
display?: DisplayType
/** Initial size on the main axis (number, 'auto', or percentage string) */
flexBasis?: number | string
/** Main axis direction (row or column) */
flexDirection?: 'row' | 'column'
/** Flex grow factor (how much to grow relative to siblings) */
flexGrow?: number
/** Flex shrink factor (how much to shrink relative to siblings) */
flexShrink?: number
/** Flex wrap behavior (wrap or nowrap) */
flexWrap?: 'wrap' | 'nowrap'
/** Gap between children (shorthand for rowGap and columnGap) */
gap?: number
/** Height in characters */
height?: number
/** Inset for all sides (shorthand for top/right/bottom/left) */
inset?: number
/** Align items on the main axis */
justifyContent?:
| 'flex-start'
| 'flex-end'
| 'center'
| 'space-between'
| 'space-around'
/** Left inset for absolute positioning (can be negative) */
left?: number
/** Margin on all sides */
margin?: number
/** Margin on bottom */
marginBottom?: number
/** Margin on left */
marginLeft?: number
/** Margin on right */
marginRight?: number
/** Margin on top */
marginTop?: number
/** Margin on left and right */
marginX?: number
/** Margin on top and bottom */
marginY?: number
/** Maximum height constraint */
maxHeight?: number
/** Maximum width constraint */
maxWidth?: number
/** Minimum height constraint */
minHeight?: number
/** Minimum width constraint */
minWidth?: number
/** Overflow behavior for both axes (shorthand) */
overflow?: OverflowType
/** Overflow behavior on horizontal axis */
overflowX?: OverflowType
/** Overflow behavior on vertical axis */
overflowY?: OverflowType
/** Padding on all sides */
padding?: number
/** Padding on bottom */
paddingBottom?: number
/** Padding on left */
paddingLeft?: number
/** Padding on right */
paddingRight?: number
/** Padding on top */
paddingTop?: number
/** Padding on left and right */
paddingX?: number
/** Padding on top and bottom */
paddingY?: number
/** Position type (relative or absolute) */
position?: PositionType
/** Right inset for absolute positioning (can be negative) */
right?: number
/** Gap between rows in flex layout */
rowGap?: number
/** Top inset for absolute positioning (can be negative) */
top?: number
/** Width in characters */
width?: number
}
/**
* Text properties for rendering styled text content.
*
* @example
* ```typescript
* // Simple text
* Text({ children: 'Hello, world!' })
*
* // Styled text
* Text({
* children: 'Important',
* color: 'red',
* weight: 'bold',
* align: 'center'
* })
*
* // Decorated text
* Text({
* children: 'Completed',
* strikethrough: true,
* dimColor: true
* })
* ```
*/
export interface TextProps extends TextStyle {
/** Horizontal text alignment (left, center, right) */
align?: TextAlign
/** Text content to display (string or array of strings) */
children?: string | string[]
/** Text wrapping behavior (wrap or nowrap) */
wrap?: TextWrap
}
/**
* Mixed text properties for rendering text with multiple styles.
*
* @example
* ```typescript
* MixedText({
* contents: [
* { text: 'Error: ', color: 'red', weight: 'bold' },
* { text: 'File not found', color: 'white', italic: true }
* ]
* })
* ```
*/
export interface MixedTextProps {
/** Horizontal text alignment */
align?: TextAlign
/** Array of text sections with individual styling */
contents: MixedTextContentSection[]
/** Text wrapping behavior */
wrap?: TextWrap
}
/**
* Fragment properties for grouping elements without layout impact.
*
* @example
* ```typescript
* Fragment({
* children: [
* Text({ children: 'Line 1' }),
* Text({ children: 'Line 2' })
* ]
* })
* ```
*/
export interface FragmentProps {
/** Child elements to group */
children: Element | Element[]
}
/**
* Element type (iocraft element).
* We define our own interface instead of using ComponentNode directly
* because we need to support all properties when building elements.
*/
export interface Element {
type: 'Text' | 'View' | 'MixedText' | 'Fragment'
children?: Element[]
// Text properties
content?: string
align?: string
bold?: boolean
color?: string
dim_color?: boolean
italic?: boolean
strikethrough?: boolean
underline?: boolean
weight?: string
wrap?: string
// View properties
display?: string
position?: string
bottom?: number
inset?: number
left?: number
right?: number
top?: number
// Flex layout
align_content?: string
align_items?: string
column_gap?: number
flex_basis?: number | string
flex_direction?: string
flex_grow?: number
flex_shrink?: number
flex_wrap?: string
gap?: number
justify_content?: string
row_gap?: number
// Dimensions
height?: number
max_height?: number
max_width?: number
min_height?: number
min_width?: number
width?: number
// Overflow
overflow_x?: string
overflow_y?: string
// Padding
padding?: number
padding_x?: number
padding_y?: number
padding_top?: number
padding_right?: number
padding_bottom?: number
padding_left?: number
// Margin
margin?: number
margin_x?: number
margin_y?: number
margin_top?: number
margin_right?: number
margin_bottom?: number
margin_left?: number
// Border
border_color?: string
border_edges?: {
top?: boolean
right?: boolean
bottom?: boolean
left?: boolean
}
border_style?: string
custom_border_chars?: {
top_left: string
top_right: string
bottom_left: string
bottom_right: string
top: string
bottom: string
left: string
right: string
}
// Background
background_color?: string
// MixedText
mixed_text_contents?: Array<{
text: string
color?: string | undefined
weight?: string | undefined
decoration?: string | undefined
italic?: boolean | undefined
}>
}
/**
* Create a text element with styling.
*/
export function Text(props: TextProps): Element {
const content =
typeof props.children === 'string'
? props.children
: Array.isArray(props.children)
? props.children.join('')
: ''
// Create text node as plain object to avoid NAPI deserialization bugs
const node: Element = {
type: 'Text',
content,
}
// Apply styling properties
if (props.align) {
node.align = props.align
}
if (props.bold) {
node.bold = true
}
if (props.color) {
node.color = props.color
}
if (props.dimColor) {
node.dim_color = true
}
if (props.italic) {
node.italic = true
}
if (props.strikethrough) {
node.strikethrough = true
}
if (props.underline) {
node.underline = true
}
if (props.weight) {
node.weight = props.weight
}
if (props.wrap) {
node.wrap = props.wrap
}
return node
}
/**
* Create a box/view element with layout properties.
*/
export function Box(props: BoxProps): Element {
const children = Array.isArray(props.children)
? props.children
: props.children
? [props.children]
: []
// Create view node as plain object to avoid NAPI deserialization bugs
const node: Element = {
type: 'View',
children,
}
// Display and positioning
if (props.display) {
node.display = props.display
}
if (props.position) {
node.position = props.position
}
// Inset positioning
if (props.bottom !== undefined) {
node.bottom = props.bottom
}
if (props.inset !== undefined) {
node.inset = props.inset
}
if (props.left !== undefined) {
node.left = props.left
}
if (props.right !== undefined) {
node.right = props.right
}
if (props.top !== undefined) {
node.top = props.top
}
// Flex layout
if (props.alignContent) {
node.align_content = props.alignContent
}
if (props.alignItems) {
node.align_items = props.alignItems
}
if (props.columnGap !== undefined) {
node.column_gap = props.columnGap
}
if (props.flexBasis !== undefined) {
node.flex_basis = props.flexBasis
}
if (props.flexDirection) {
node.flex_direction = props.flexDirection
}
if (props.flexGrow !== undefined) {
node.flex_grow = props.flexGrow
}
if (props.flexShrink !== undefined) {
node.flex_shrink = props.flexShrink
}
if (props.flexWrap) {
node.flex_wrap = props.flexWrap
}
if (props.gap !== undefined) {
node.gap = props.gap
}
if (props.justifyContent) {
node.justify_content = props.justifyContent
}
if (props.rowGap !== undefined) {
node.row_gap = props.rowGap
}
// Dimensions
if (props.height !== undefined) {
node.height = props.height
}
if (props.maxHeight !== undefined) {
node.max_height = props.maxHeight
}
if (props.maxWidth !== undefined) {
node.max_width = props.maxWidth
}
if (props.minHeight !== undefined) {
node.min_height = props.minHeight
}
if (props.minWidth !== undefined) {
node.min_width = props.minWidth
}
if (props.width !== undefined) {
node.width = props.width
}
// Overflow
if (props.overflow) {
node.overflow_x = props.overflow
node.overflow_y = props.overflow
}
if (props.overflowX) {
node.overflow_x = props.overflowX
}
if (props.overflowY) {
node.overflow_y = props.overflowY
}
// Padding (handle both individual and shorthand)
if (props.padding !== undefined) {
node.padding = props.padding
}
if (props.paddingX !== undefined) {
node.padding_x = props.paddingX
}
if (props.paddingY !== undefined) {
node.padding_y = props.paddingY
}
if (props.paddingTop !== undefined) {
node.padding_top = props.paddingTop
}
if (props.paddingRight !== undefined) {
node.padding_right = props.paddingRight
}
if (props.paddingBottom !== undefined) {
node.padding_bottom = props.paddingBottom
}
if (props.paddingLeft !== undefined) {
node.padding_left = props.paddingLeft
}
// Margin (handle both individual and shorthand)
if (props.margin !== undefined) {
node.margin = props.margin
}
if (props.marginX !== undefined) {
node.margin_x = props.marginX
}
if (props.marginY !== undefined) {
node.margin_y = props.marginY
}
if (props.marginTop !== undefined) {
node.margin_top = props.marginTop
}
if (props.marginRight !== undefined) {
node.margin_right = props.marginRight
}
if (props.marginBottom !== undefined) {
node.margin_bottom = props.marginBottom
}
if (props.marginLeft !== undefined) {
node.margin_left = props.marginLeft
}
// Border
if (props.borderColor) {
node.border_color = props.borderColor
}
if (props.borderEdges) {
node.border_edges = props.borderEdges
}
if (props.borderStyle) {
node.border_style = props.borderStyle
}
if (props.customBorderChars) {
node.custom_border_chars = {
top_left: props.customBorderChars.topLeft,
top_right: props.customBorderChars.topRight,
bottom_left: props.customBorderChars.bottomLeft,
bottom_right: props.customBorderChars.bottomRight,
top: props.customBorderChars.top,
bottom: props.customBorderChars.bottom,
left: props.customBorderChars.left,
right: props.customBorderChars.right,
}
}
// Background
if (props.backgroundColor) {
node.background_color = props.backgroundColor
}
return node
}
/**
* Create a mixed text element with multiple styled sections.
*
* @example
* ```typescript
* MixedText({
* contents: [
* { text: 'Success: ', color: 'green', weight: 'bold' },
* { text: 'Operation completed', color: 'white' }
* ],
* align: 'center'
* })
* ```
*/
export function MixedText(props: MixedTextProps): Element {
const node: Element = {
type: 'MixedText',
mixed_text_contents: props.contents.map((section) => ({
text: section.text,
color: section.color,
weight: section.weight,
decoration: section.decoration,
italic: section.italic,
})),
}
if (props.align) {
node.align = props.align
}
if (props.wrap) {
node.wrap = props.wrap
}
return node
}
/**
* Create a fragment element that groups children without layout impact.
*
* Fragments are transparent wrappers that allow returning multiple elements
* without affecting the layout hierarchy.
*
* @example
* ```typescript
* Fragment({
* children: [
* Text({ children: 'Line 1' }),
* Text({ children: 'Line 2' }),
* Text({ children: 'Line 3' })
* ]
* })
* ```
*/
export function Fragment(props: FragmentProps): Element {
const children = Array.isArray(props.children)
? props.children
: [props.children]
return {
type: 'Fragment',
children,
}
}
/**
* Render an element to a string.
*/
export function renderToString(element: Element): string {
const io = getIocraft()
return io.renderToString(element as import('@socketaddon/iocraft').ComponentNode)
}
/**
* Print an element to stdout.
*/
export function print(element: Element): void {
const io = getIocraft()
io.printComponent(element as import('@socketaddon/iocraft').ComponentNode)
}
/**
* Print an element to stderr.
*/
export function eprint(element: Element): void {
const io = getIocraft()
io.eprintComponent(element as import('@socketaddon/iocraft').ComponentNode)
}
/**
* Get terminal size.
*/
export function getTerminalSize(): { columns: number; rows: number } {
const io = getIocraft()
const size = io.getTerminalSize()
return { columns: size[0], rows: size[1] }
}