green-screen-proxy 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +93 -8
- package/dist/cli.js +0 -6
- package/dist/cli.js.map +1 -1
- package/dist/controller.d.ts +3 -0
- package/dist/controller.d.ts.map +1 -1
- package/dist/controller.js +14 -5
- package/dist/controller.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -16
- package/dist/index.js.map +1 -1
- package/dist/protocols/tn3270-handler.d.ts +2 -1
- package/dist/protocols/tn3270-handler.d.ts.map +1 -1
- package/dist/protocols/tn3270-handler.js +10 -2
- package/dist/protocols/tn3270-handler.js.map +1 -1
- package/dist/protocols/tn5250-handler.d.ts +3 -2
- package/dist/protocols/tn5250-handler.d.ts.map +1 -1
- package/dist/protocols/tn5250-handler.js +85 -26
- package/dist/protocols/tn5250-handler.js.map +1 -1
- package/dist/protocols/types.d.ts +30 -2
- package/dist/protocols/types.d.ts.map +1 -1
- package/dist/protocols/types.js +32 -0
- package/dist/protocols/types.js.map +1 -1
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +261 -30
- package/dist/routes.js.map +1 -1
- package/dist/server.js +1 -5
- package/dist/server.js.map +1 -1
- package/dist/session-store.d.ts +68 -0
- package/dist/session-store.d.ts.map +1 -0
- package/dist/session-store.js +40 -0
- package/dist/session-store.js.map +1 -0
- package/dist/session.d.ts +32 -2
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +105 -9
- package/dist/session.js.map +1 -1
- package/dist/standalone.d.ts +3 -0
- package/dist/standalone.d.ts.map +1 -0
- package/dist/standalone.js +6 -0
- package/dist/standalone.js.map +1 -0
- package/dist/tn3270/connection.d.ts +1 -1
- package/dist/tn3270/connection.d.ts.map +1 -1
- package/dist/tn3270/connection.js +2 -2
- package/dist/tn3270/connection.js.map +1 -1
- package/dist/tn3270/screen.d.ts +1 -0
- package/dist/tn3270/screen.d.ts.map +1 -1
- package/dist/tn3270/screen.js +1 -0
- package/dist/tn3270/screen.js.map +1 -1
- package/dist/tn5250/connection.d.ts +6 -1
- package/dist/tn5250/connection.d.ts.map +1 -1
- package/dist/tn5250/connection.js +27 -3
- package/dist/tn5250/connection.js.map +1 -1
- package/dist/tn5250/constants.d.ts +39 -3
- package/dist/tn5250/constants.d.ts.map +1 -1
- package/dist/tn5250/constants.js +51 -3
- package/dist/tn5250/constants.js.map +1 -1
- package/dist/tn5250/ebcdic-jp-builtin.d.ts +45 -0
- package/dist/tn5250/ebcdic-jp-builtin.d.ts.map +1 -0
- package/dist/tn5250/ebcdic-jp-builtin.js +124 -0
- package/dist/tn5250/ebcdic-jp-builtin.js.map +1 -0
- package/dist/tn5250/ebcdic-jp.d.ts +61 -0
- package/dist/tn5250/ebcdic-jp.d.ts.map +1 -0
- package/dist/tn5250/ebcdic-jp.js +188 -0
- package/dist/tn5250/ebcdic-jp.js.map +1 -0
- package/dist/tn5250/ebcdic.d.ts +13 -4
- package/dist/tn5250/ebcdic.d.ts.map +1 -1
- package/dist/tn5250/ebcdic.js +30 -8
- package/dist/tn5250/ebcdic.js.map +1 -1
- package/dist/tn5250/encoder.d.ts +41 -9
- package/dist/tn5250/encoder.d.ts.map +1 -1
- package/dist/tn5250/encoder.js +228 -41
- package/dist/tn5250/encoder.js.map +1 -1
- package/dist/tn5250/parser.d.ts +14 -0
- package/dist/tn5250/parser.d.ts.map +1 -1
- package/dist/tn5250/parser.js +428 -53
- package/dist/tn5250/parser.js.map +1 -1
- package/dist/tn5250/screen.d.ts +144 -24
- package/dist/tn5250/screen.d.ts.map +1 -1
- package/dist/tn5250/screen.js +245 -13
- package/dist/tn5250/screen.js.map +1 -1
- package/dist/ui/assets/index-B51sr7HL.js +56 -0
- package/dist/ui/assets/index-B9wpEWAh.css +1 -0
- package/dist/ui/assets/index-BrUnECmE.css +1 -0
- package/dist/ui/assets/index-CDBbEXbH.js +56 -0
- package/dist/ui/index.html +16 -0
- package/dist/websocket.d.ts +3 -0
- package/dist/websocket.d.ts.map +1 -1
- package/dist/websocket.js +90 -1
- package/dist/websocket.js.map +1 -1
- package/dist/worker/index.js +5573 -0
- package/package.json +1 -1
|
@@ -13,6 +13,9 @@ export class TN5250Connection extends EventEmitter {
|
|
|
13
13
|
recvBuffer = Buffer.alloc(0);
|
|
14
14
|
negotiationDone = false;
|
|
15
15
|
terminalType = DEFAULT_TERMINAL_TYPE;
|
|
16
|
+
keepAliveTimer = null;
|
|
17
|
+
static KEEP_ALIVE_INTERVAL = 15_000; // 15s — well under PUB400's ~30s idle timeout
|
|
18
|
+
static KEEP_ALIVE_NOP = Buffer.from([TELNET.IAC, TELNET.NOP]);
|
|
16
19
|
get isConnected() {
|
|
17
20
|
return this.connected;
|
|
18
21
|
}
|
|
@@ -22,7 +25,7 @@ export class TN5250Connection extends EventEmitter {
|
|
|
22
25
|
get remotePort() {
|
|
23
26
|
return this.port;
|
|
24
27
|
}
|
|
25
|
-
connect(host, port, terminalType) {
|
|
28
|
+
connect(host, port, terminalType, connectTimeout) {
|
|
26
29
|
return new Promise((resolve, reject) => {
|
|
27
30
|
if (this.socket) {
|
|
28
31
|
this.disconnect();
|
|
@@ -33,7 +36,7 @@ export class TN5250Connection extends EventEmitter {
|
|
|
33
36
|
this.negotiationDone = false;
|
|
34
37
|
this.terminalType = terminalType || DEFAULT_TERMINAL_TYPE;
|
|
35
38
|
this.socket = new net.Socket();
|
|
36
|
-
this.socket.setTimeout(30000);
|
|
39
|
+
this.socket.setTimeout(connectTimeout ?? 30000);
|
|
37
40
|
const onError = (err) => {
|
|
38
41
|
this.cleanup();
|
|
39
42
|
reject(err);
|
|
@@ -54,6 +57,7 @@ export class TN5250Connection extends EventEmitter {
|
|
|
54
57
|
this.emit('error', new Error('Connection timeout'));
|
|
55
58
|
});
|
|
56
59
|
this.socket.on('data', (data) => this.onData(data));
|
|
60
|
+
this.startKeepAlive();
|
|
57
61
|
this.emit('connected');
|
|
58
62
|
resolve();
|
|
59
63
|
});
|
|
@@ -61,7 +65,12 @@ export class TN5250Connection extends EventEmitter {
|
|
|
61
65
|
}
|
|
62
66
|
disconnect() {
|
|
63
67
|
if (this.socket) {
|
|
64
|
-
this.socket.
|
|
68
|
+
console.log(`[tn5250] Disconnecting socket to ${this.socket.remoteAddress}:${this.socket.remotePort}`);
|
|
69
|
+
// Send FIN first, then destroy to ensure TCP session closes on the host
|
|
70
|
+
try {
|
|
71
|
+
this.socket.end();
|
|
72
|
+
}
|
|
73
|
+
catch { /* ignore */ }
|
|
65
74
|
this.cleanup();
|
|
66
75
|
}
|
|
67
76
|
}
|
|
@@ -71,7 +80,22 @@ export class TN5250Connection extends EventEmitter {
|
|
|
71
80
|
this.socket.write(data);
|
|
72
81
|
}
|
|
73
82
|
}
|
|
83
|
+
startKeepAlive() {
|
|
84
|
+
this.stopKeepAlive();
|
|
85
|
+
this.keepAliveTimer = setInterval(() => {
|
|
86
|
+
if (this.socket && this.connected) {
|
|
87
|
+
this.sendRaw(TN5250Connection.KEEP_ALIVE_NOP);
|
|
88
|
+
}
|
|
89
|
+
}, TN5250Connection.KEEP_ALIVE_INTERVAL);
|
|
90
|
+
}
|
|
91
|
+
stopKeepAlive() {
|
|
92
|
+
if (this.keepAliveTimer) {
|
|
93
|
+
clearInterval(this.keepAliveTimer);
|
|
94
|
+
this.keepAliveTimer = null;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
74
97
|
cleanup() {
|
|
98
|
+
this.stopKeepAlive();
|
|
75
99
|
this.connected = false;
|
|
76
100
|
if (this.socket) {
|
|
77
101
|
this.socket.removeAllListeners();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../src/tn5250/connection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,a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AClC,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC;YACtB,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,eAAe;YAC7C,IAAI,EAAE,KAAK;YACX,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE;SACtB,CAAC,CAAC;QACH,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACpB,CAAC;IAEO,mBAAmB,CAAC,KAAa;QACvC,8EAA8E;QAC9E,qEAAqE;IACvE,CAAC;IAEO,UAAU,CAAC,GAAW,EAAE,MAAc;QAC5C,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IACvD,CAAC"}
|
|
@@ -43,14 +43,37 @@ export declare const CMD: {
|
|
|
43
43
|
readonly WRITE_TO_DISPLAY: 17;
|
|
44
44
|
readonly WRITE_ERROR_CODE: 33;
|
|
45
45
|
readonly WRITE_ERROR_CODE_WIN: 34;
|
|
46
|
-
readonly READ_MDT_FIELDS: 82;
|
|
47
46
|
readonly READ_INPUT_FIELDS: 66;
|
|
47
|
+
readonly READ_MDT_FIELDS: 82;
|
|
48
|
+
readonly READ_MDT_FIELDS_ALT: 130;
|
|
49
|
+
readonly READ_SCREEN_IMMEDIATE: 98;
|
|
48
50
|
readonly READ_IMMEDIATE: 114;
|
|
51
|
+
readonly READ_IMMEDIATE_ALT: 131;
|
|
49
52
|
readonly WRITE_STRUCTURED_FIELD: 243;
|
|
50
53
|
readonly SAVE_SCREEN: 2;
|
|
51
54
|
readonly RESTORE_SCREEN: 18;
|
|
52
55
|
readonly ROLL: 35;
|
|
53
56
|
};
|
|
57
|
+
export declare const RECORD_H: {
|
|
58
|
+
readonly NONE: 0;
|
|
59
|
+
readonly HLP: 1;
|
|
60
|
+
readonly TRQ: 2;
|
|
61
|
+
readonly SRQ: 4;
|
|
62
|
+
readonly ATN: 64;
|
|
63
|
+
};
|
|
64
|
+
export declare const RECORD_OPCODE: {
|
|
65
|
+
readonly NO_OP: 0;
|
|
66
|
+
readonly INVITE: 1;
|
|
67
|
+
readonly OUTPUT_ONLY: 2;
|
|
68
|
+
readonly PUT_GET: 3;
|
|
69
|
+
readonly SAVE_SCREEN: 4;
|
|
70
|
+
readonly RESTORE_SCREEN: 5;
|
|
71
|
+
readonly READ_IMMEDIATE: 6;
|
|
72
|
+
readonly READ_SCREEN: 8;
|
|
73
|
+
readonly CANCEL_INVITE: 10;
|
|
74
|
+
readonly TURN_ON_MSG_LIGHT: 11;
|
|
75
|
+
readonly TURN_OFF_MSG_LIGHT: 12;
|
|
76
|
+
};
|
|
54
77
|
export declare const ORDER: {
|
|
55
78
|
readonly SBA: 17;
|
|
56
79
|
readonly IC: 19;
|
|
@@ -59,7 +82,7 @@ export declare const ORDER: {
|
|
|
59
82
|
readonly EA: 3;
|
|
60
83
|
readonly SOH: 1;
|
|
61
84
|
readonly TD: 16;
|
|
62
|
-
readonly WEA:
|
|
85
|
+
readonly WEA: 18;
|
|
63
86
|
readonly SF: 29;
|
|
64
87
|
readonly WDSF: 21;
|
|
65
88
|
readonly SA: 40;
|
|
@@ -96,7 +119,9 @@ export declare const AID: {
|
|
|
96
119
|
readonly HELP: 243;
|
|
97
120
|
readonly PRINT: 246;
|
|
98
121
|
readonly RECORD_BACKSPACE: 248;
|
|
99
|
-
readonly SYS_REQUEST:
|
|
122
|
+
readonly SYS_REQUEST: 257;
|
|
123
|
+
readonly ATTN: 258;
|
|
124
|
+
readonly TEST_REQUEST: 259;
|
|
100
125
|
};
|
|
101
126
|
export declare const KEY_TO_AID: Record<string, number>;
|
|
102
127
|
export declare const FFW: {
|
|
@@ -104,6 +129,14 @@ export declare const FFW: {
|
|
|
104
129
|
readonly DUP_ENABLE: 16;
|
|
105
130
|
readonly MDT: 8;
|
|
106
131
|
readonly SHIFT_MASK: 7;
|
|
132
|
+
readonly SHIFT_ALPHA: 0;
|
|
133
|
+
readonly SHIFT_ALPHA_ONLY: 1;
|
|
134
|
+
readonly SHIFT_NUMERIC_SHIFT: 2;
|
|
135
|
+
readonly SHIFT_NUMERIC_ONLY: 3;
|
|
136
|
+
readonly SHIFT_KATAKANA: 4;
|
|
137
|
+
readonly SHIFT_DIGITS_ONLY: 5;
|
|
138
|
+
readonly SHIFT_IO: 6;
|
|
139
|
+
readonly SHIFT_SIGNED_NUM: 7;
|
|
107
140
|
readonly AUTO_ENTER: 128;
|
|
108
141
|
readonly FER: 64;
|
|
109
142
|
readonly MONOCASE: 32;
|
|
@@ -125,7 +158,10 @@ export declare const WDSF_TYPE: {
|
|
|
125
158
|
readonly UNRESTRICT_CURSOR: 82;
|
|
126
159
|
readonly DEFINE_SCROLL_BAR: 83;
|
|
127
160
|
readonly WRITE_DATA: 84;
|
|
161
|
+
readonly PROGRAMMABLE_MOUSE_BUTTONS: 85;
|
|
162
|
+
readonly REM_GUI_SEL_FIELD: 88;
|
|
128
163
|
readonly REM_GUI_WINDOW: 89;
|
|
164
|
+
readonly REM_GUI_SCROLL_BAR: 91;
|
|
129
165
|
readonly REM_ALL_GUI_CONSTRUCTS: 95;
|
|
130
166
|
};
|
|
131
167
|
export declare const WDSF_CLASS = 217;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/tn5250/constants.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;CAwBT,CAAC;AAKX,eAAO,MAAM,WAAW;;CAEd,CAAC;AAGX,eAAO,MAAM,MAAM;;;;;;;;;;;;;CAaT,CAAC;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/tn5250/constants.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;CAwBT,CAAC;AAKX,eAAO,MAAM,WAAW;;CAEd,CAAC;AAGX,eAAO,MAAM,MAAM;;;;;;;;;;;;;CAaT,CAAC;AAIX,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;CAiBN,CAAC;AAIX,eAAO,MAAM,QAAQ;;;;;;CAMX,CAAC;AAIX,eAAO,MAAM,aAAa;;;;;;;;;;;;CAYhB,CAAC;AAGX,eAAO,MAAM,KAAK;;;;;;;;;;;;CAYR,CAAC;AAGX,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCN,CAAC;AAGX,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAgB7C,CAAC;AAGF,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;CAsBN,CAAC;AAGX,eAAO,MAAM,IAAI;;;;;;;;CAQP,CAAC;AAGX,eAAO,MAAM,SAAS;;;;;;;;;;;CAWZ,CAAC;AAGX,eAAO,MAAM,UAAU,MAAO,CAAC;AAG/B,eAAO,MAAM,MAAM;;;;;CAKT,CAAC;AAGX,eAAO,MAAM,aAAa,eAAe,CAAC;AAC1C,eAAO,MAAM,kBAAkB,gBAAgB,CAAC;AAGhD,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAG9E,CAAC"}
|
package/dist/tn5250/constants.js
CHANGED
|
@@ -43,6 +43,7 @@ export const OPCODE = {
|
|
|
43
43
|
TURN_OFF_MSG_LIGHT: 0x0C,
|
|
44
44
|
};
|
|
45
45
|
// 5250 command codes (within WTD, etc.)
|
|
46
|
+
// Per lib5250 codes5250.h:38-55
|
|
46
47
|
export const CMD = {
|
|
47
48
|
CLEAR_UNIT: 0x40,
|
|
48
49
|
CLEAR_FORMAT_TABLE: 0x50,
|
|
@@ -50,14 +51,41 @@ export const CMD = {
|
|
|
50
51
|
WRITE_TO_DISPLAY: 0x11, // WTD
|
|
51
52
|
WRITE_ERROR_CODE: 0x21,
|
|
52
53
|
WRITE_ERROR_CODE_WIN: 0x22,
|
|
53
|
-
READ_MDT_FIELDS: 0x52,
|
|
54
54
|
READ_INPUT_FIELDS: 0x42,
|
|
55
|
+
READ_MDT_FIELDS: 0x52,
|
|
56
|
+
READ_MDT_FIELDS_ALT: 0x82,
|
|
57
|
+
READ_SCREEN_IMMEDIATE: 0x62,
|
|
55
58
|
READ_IMMEDIATE: 0x72,
|
|
59
|
+
READ_IMMEDIATE_ALT: 0x83,
|
|
56
60
|
WRITE_STRUCTURED_FIELD: 0xF3,
|
|
57
61
|
SAVE_SCREEN: 0x02,
|
|
58
62
|
RESTORE_SCREEN: 0x12,
|
|
59
63
|
ROLL: 0x23,
|
|
60
64
|
};
|
|
65
|
+
// Record header flag byte values (byte 8 of the GDS header).
|
|
66
|
+
// Per lib5250 record.h:60-68.
|
|
67
|
+
export const RECORD_H = {
|
|
68
|
+
NONE: 0x00,
|
|
69
|
+
HLP: 0x01, // Help
|
|
70
|
+
TRQ: 0x02, // Test request
|
|
71
|
+
SRQ: 0x04, // System request
|
|
72
|
+
ATN: 0x40, // Attention
|
|
73
|
+
};
|
|
74
|
+
// Record header opcode byte (byte 10).
|
|
75
|
+
// Per lib5250 record.h:70-78.
|
|
76
|
+
export const RECORD_OPCODE = {
|
|
77
|
+
NO_OP: 0x00,
|
|
78
|
+
INVITE: 0x01,
|
|
79
|
+
OUTPUT_ONLY: 0x02,
|
|
80
|
+
PUT_GET: 0x03,
|
|
81
|
+
SAVE_SCREEN: 0x04,
|
|
82
|
+
RESTORE_SCREEN: 0x05,
|
|
83
|
+
READ_IMMEDIATE: 0x06,
|
|
84
|
+
READ_SCREEN: 0x08,
|
|
85
|
+
CANCEL_INVITE: 0x0A,
|
|
86
|
+
TURN_ON_MSG_LIGHT: 0x0B,
|
|
87
|
+
TURN_OFF_MSG_LIGHT: 0x0C,
|
|
88
|
+
};
|
|
61
89
|
// 5250 order codes
|
|
62
90
|
export const ORDER = {
|
|
63
91
|
SBA: 0x11, // Set Buffer Address
|
|
@@ -67,7 +95,7 @@ export const ORDER = {
|
|
|
67
95
|
EA: 0x03, // Erase to Address
|
|
68
96
|
SOH: 0x01, // Start of Header
|
|
69
97
|
TD: 0x10, // Transparent Data
|
|
70
|
-
WEA:
|
|
98
|
+
WEA: 0x12, // Write Extended Attribute (per lib5250 codes5250.h)
|
|
71
99
|
SF: 0x1D, // Start Field (used in field attribute)
|
|
72
100
|
WDSF: 0x15, // Write Display Structured Field (within WTD)
|
|
73
101
|
SA: 0x28, // Set Attribute
|
|
@@ -105,7 +133,12 @@ export const AID = {
|
|
|
105
133
|
HELP: 0xF3,
|
|
106
134
|
PRINT: 0xF6,
|
|
107
135
|
RECORD_BACKSPACE: 0xF8,
|
|
108
|
-
|
|
136
|
+
// Sentinel values (not real AID bytes — dispatched via record flags).
|
|
137
|
+
// Per lib5250 session.h: these are negative in C; TS uses values outside
|
|
138
|
+
// the 0x00-0xFF AID range so they cannot collide with real AID bytes.
|
|
139
|
+
SYS_REQUEST: 0x101,
|
|
140
|
+
ATTN: 0x102,
|
|
141
|
+
TEST_REQUEST: 0x103,
|
|
109
142
|
};
|
|
110
143
|
// Map key names (from frontend) to AID bytes
|
|
111
144
|
export const KEY_TO_AID = {
|
|
@@ -121,6 +154,9 @@ export const KEY_TO_AID = {
|
|
|
121
154
|
'Clear': AID.CLEAR,
|
|
122
155
|
'Help': AID.HELP,
|
|
123
156
|
'Print': AID.PRINT,
|
|
157
|
+
'SysReq': AID.SYS_REQUEST,
|
|
158
|
+
'Attn': AID.ATTN,
|
|
159
|
+
'TestReq': AID.TEST_REQUEST,
|
|
124
160
|
};
|
|
125
161
|
// Field attribute bits (in the FFW - Field Format Word)
|
|
126
162
|
export const FFW = {
|
|
@@ -128,6 +164,15 @@ export const FFW = {
|
|
|
128
164
|
DUP_ENABLE: 0x10,
|
|
129
165
|
MDT: 0x08, // Modified Data Tag
|
|
130
166
|
SHIFT_MASK: 0x07, // Data type shift bits
|
|
167
|
+
// Shift-type values (FFW1 & SHIFT_MASK)
|
|
168
|
+
SHIFT_ALPHA: 0x00,
|
|
169
|
+
SHIFT_ALPHA_ONLY: 0x01,
|
|
170
|
+
SHIFT_NUMERIC_SHIFT: 0x02,
|
|
171
|
+
SHIFT_NUMERIC_ONLY: 0x03,
|
|
172
|
+
SHIFT_KATAKANA: 0x04,
|
|
173
|
+
SHIFT_DIGITS_ONLY: 0x05,
|
|
174
|
+
SHIFT_IO: 0x06,
|
|
175
|
+
SHIFT_SIGNED_NUM: 0x07, // Signed numeric (last position is sign)
|
|
131
176
|
// Second byte flags
|
|
132
177
|
AUTO_ENTER: 0x80,
|
|
133
178
|
FER: 0x40, // Field Exit Required
|
|
@@ -152,7 +197,10 @@ export const WDSF_TYPE = {
|
|
|
152
197
|
UNRESTRICT_CURSOR: 0x52,
|
|
153
198
|
DEFINE_SCROLL_BAR: 0x53,
|
|
154
199
|
WRITE_DATA: 0x54,
|
|
200
|
+
PROGRAMMABLE_MOUSE_BUTTONS: 0x55,
|
|
201
|
+
REM_GUI_SEL_FIELD: 0x58,
|
|
155
202
|
REM_GUI_WINDOW: 0x59,
|
|
203
|
+
REM_GUI_SCROLL_BAR: 0x5B,
|
|
156
204
|
REM_ALL_GUI_CONSTRUCTS: 0x5F,
|
|
157
205
|
};
|
|
158
206
|
// Structured field class byte (IBM Display class)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/tn5250/constants.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,GAAG,EAAE,IAAI,EAAI,uBAAuB;IACpC,IAAI,EAAE,IAAI;IACV,EAAE,EAAE,IAAI;IACR,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI;IACV,EAAE,EAAE,IAAI,EAAK,uBAAuB;IACpC,EAAE,EAAE,IAAI,EAAK,qBAAqB;IAClC,GAAG,EAAE,IAAI,EAAI,gBAAgB;IAC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wC;AACxC,MAAM,CAAC,MAAM,aAAa,GAAG,YAAY,CAAC;AAC1C,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAC;AAEhD,2CAA2C;AAC3C,MAAM,CAAC,MAAM,mBAAmB,GAAmD;IACjF,CAAC,aAAa,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,OAAO,EAAE;IAC/D,CAAC,kBAAkB,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,QAAQ,EAAE;CACtE,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in minimum IBM-Kanji (CCSID 300) → Unicode table.
|
|
3
|
+
*
|
|
4
|
+
* This covers the **non-Kanji** portion of the IBM host double-byte code
|
|
5
|
+
* set — the rows that contain the DBCS space, full-width ASCII, Hiragana,
|
|
6
|
+
* Katakana (full-width), and common CJK punctuation / symbols.
|
|
7
|
+
*
|
|
8
|
+
* These are the characters you see on typical IBM i Japanese system
|
|
9
|
+
* screens (menu titles, field labels, error messages), which are mostly
|
|
10
|
+
* rendered in hiragana/katakana rather than kanji. The full Kanji plane
|
|
11
|
+
* (~7000 characters in rows 0x4F–0xFE of CCSID 300) is NOT included here
|
|
12
|
+
* — register the full table separately via `registerDbcsTable()` after
|
|
13
|
+
* generating it with `scripts/generate-ibm-kanji-table.mjs`.
|
|
14
|
+
*
|
|
15
|
+
* Layout notes (per IBM CCSID 300 mapping):
|
|
16
|
+
* Row 0x41 — CJK/IBM special symbols
|
|
17
|
+
* Row 0x42 — DBCS space + full-width ASCII 0x20-0x7E (full-width)
|
|
18
|
+
* Row 0x43 — Hiragana (あ-ん + voiced)
|
|
19
|
+
* Row 0x44 — Katakana (ア-ン + voiced)
|
|
20
|
+
* Row 0x45 — Greek (Α-Ω, α-ω)
|
|
21
|
+
* Row 0x46 — Cyrillic
|
|
22
|
+
* Row 0x47 — Box-drawing characters
|
|
23
|
+
*
|
|
24
|
+
* The bytes that follow row bytes are 0x41..0xFE (column selector).
|
|
25
|
+
* IBM CCSID 300 tables start at column 0x41 = JIS column 1.
|
|
26
|
+
*
|
|
27
|
+
* Rather than hand-transcribing every entry (error-prone), this file
|
|
28
|
+
* builds the mapping arithmetically from the well-known Unicode ranges
|
|
29
|
+
* using the IBM → JIS column offset of (byte2 - 0x41).
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* Register the built-in minimum IBM-Kanji table with the DBCS decoder.
|
|
33
|
+
* Call this once at proxy startup to get hiragana/katakana/symbol
|
|
34
|
+
* rendering without shipping the full Kanji table.
|
|
35
|
+
*
|
|
36
|
+
* The full Kanji plane (~7000 characters) still falls back to the geta
|
|
37
|
+
* mark until you register a complete table via `registerDbcsTable()`.
|
|
38
|
+
*
|
|
39
|
+
* Idempotent — safe to call multiple times; later entries overwrite
|
|
40
|
+
* earlier ones, so calling `registerDbcsTable(fullTable)` AFTER
|
|
41
|
+
* `registerBuiltinDbcsTable()` will layer the full table on top of the
|
|
42
|
+
* minimum.
|
|
43
|
+
*/
|
|
44
|
+
export declare function registerBuiltinDbcsTable(): void;
|
|
45
|
+
//# sourceMappingURL=ebcdic-jp-builtin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ebcdic-jp-builtin.d.ts","sourceRoot":"","sources":["../../src/tn5250/ebcdic-jp-builtin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AA8FH;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,IAAI,IAAI,CAE/C"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in minimum IBM-Kanji (CCSID 300) → Unicode table.
|
|
3
|
+
*
|
|
4
|
+
* This covers the **non-Kanji** portion of the IBM host double-byte code
|
|
5
|
+
* set — the rows that contain the DBCS space, full-width ASCII, Hiragana,
|
|
6
|
+
* Katakana (full-width), and common CJK punctuation / symbols.
|
|
7
|
+
*
|
|
8
|
+
* These are the characters you see on typical IBM i Japanese system
|
|
9
|
+
* screens (menu titles, field labels, error messages), which are mostly
|
|
10
|
+
* rendered in hiragana/katakana rather than kanji. The full Kanji plane
|
|
11
|
+
* (~7000 characters in rows 0x4F–0xFE of CCSID 300) is NOT included here
|
|
12
|
+
* — register the full table separately via `registerDbcsTable()` after
|
|
13
|
+
* generating it with `scripts/generate-ibm-kanji-table.mjs`.
|
|
14
|
+
*
|
|
15
|
+
* Layout notes (per IBM CCSID 300 mapping):
|
|
16
|
+
* Row 0x41 — CJK/IBM special symbols
|
|
17
|
+
* Row 0x42 — DBCS space + full-width ASCII 0x20-0x7E (full-width)
|
|
18
|
+
* Row 0x43 — Hiragana (あ-ん + voiced)
|
|
19
|
+
* Row 0x44 — Katakana (ア-ン + voiced)
|
|
20
|
+
* Row 0x45 — Greek (Α-Ω, α-ω)
|
|
21
|
+
* Row 0x46 — Cyrillic
|
|
22
|
+
* Row 0x47 — Box-drawing characters
|
|
23
|
+
*
|
|
24
|
+
* The bytes that follow row bytes are 0x41..0xFE (column selector).
|
|
25
|
+
* IBM CCSID 300 tables start at column 0x41 = JIS column 1.
|
|
26
|
+
*
|
|
27
|
+
* Rather than hand-transcribing every entry (error-prone), this file
|
|
28
|
+
* builds the mapping arithmetically from the well-known Unicode ranges
|
|
29
|
+
* using the IBM → JIS column offset of (byte2 - 0x41).
|
|
30
|
+
*/
|
|
31
|
+
import { registerDbcsTable } from './ebcdic-jp.js';
|
|
32
|
+
/** Build a range of entries from a starting Unicode code point. */
|
|
33
|
+
function range(ibmByte1, ibmCol1, ibmCol2, startCp, skip = []) {
|
|
34
|
+
const out = {};
|
|
35
|
+
let cp = startCp;
|
|
36
|
+
for (let c = ibmCol1; c <= ibmCol2; c++) {
|
|
37
|
+
if (skip.includes(c))
|
|
38
|
+
continue;
|
|
39
|
+
const key = ((ibmByte1 << 8) | c).toString(16).toUpperCase().padStart(4, '0');
|
|
40
|
+
try {
|
|
41
|
+
out[key] = String.fromCodePoint(cp);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
// invalid code point — skip
|
|
45
|
+
}
|
|
46
|
+
cp++;
|
|
47
|
+
}
|
|
48
|
+
return out;
|
|
49
|
+
}
|
|
50
|
+
/** Assemble the built-in table. */
|
|
51
|
+
function buildBuiltinTable() {
|
|
52
|
+
const t = {};
|
|
53
|
+
// --- Row 0x41 — CJK symbols + IBM specials ---
|
|
54
|
+
// 0x4141 — DBCS space (ideographic space U+3000)
|
|
55
|
+
t['4141'] = '\u3000';
|
|
56
|
+
// Common CJK punctuation (subset — most-used entries)
|
|
57
|
+
// 0x4144 → 、 (U+3001)
|
|
58
|
+
// 0x4145 → 。 (U+3002)
|
|
59
|
+
// 0x4146 → , (U+FF0C) — overlaps but shows intent
|
|
60
|
+
// 0x4149 → 「 (U+300C)
|
|
61
|
+
// 0x414A → 」 (U+300D)
|
|
62
|
+
// 0x4150 → ・ (U+30FB) middle dot
|
|
63
|
+
t['4144'] = '\u3001'; // 、
|
|
64
|
+
t['4145'] = '\u3002'; // 。
|
|
65
|
+
t['4149'] = '\u300C'; // 「
|
|
66
|
+
t['414A'] = '\u300D'; // 」
|
|
67
|
+
t['4150'] = '\u30FB'; // ・
|
|
68
|
+
// 0x4151 → ー (U+30FC) prolonged sound mark
|
|
69
|
+
t['4151'] = '\u30FC';
|
|
70
|
+
// --- Row 0x42 — Full-width ASCII ---
|
|
71
|
+
// IBM col 0x4A = U+FF01 '!', col 0x4B = U+FF02 '"', ... through 0x7E range.
|
|
72
|
+
// Standard JIS: full-width printable ASCII is U+FF01..U+FF5E mapped to
|
|
73
|
+
// JIS row 3 columns 1..94. In IBM CCSID 300, these sit at row 0x42
|
|
74
|
+
// columns 0x4A..0xA7 with some gaps. Use a safe arithmetic span:
|
|
75
|
+
// byte2 0x4B..0x7F → U+FF01..U+FF35 (letters + digits + basic punct)
|
|
76
|
+
// This is an approximation — load the full JSON table for perfect
|
|
77
|
+
// fidelity. Covers uppercase, digits, common punctuation.
|
|
78
|
+
Object.assign(t, range(0x42, 0x4B, 0x7F, 0xFF01));
|
|
79
|
+
// Full-width lowercase letters span the next block
|
|
80
|
+
Object.assign(t, range(0x42, 0x81, 0xA9, 0xFF36));
|
|
81
|
+
// --- Row 0x43 — Hiragana ---
|
|
82
|
+
// JIS row 4 col 1 = U+3041 (ぁ) through col 83 = U+3093 (ん).
|
|
83
|
+
// IBM layout puts these at 0x43 columns 0x4F..0xA2 (contiguous in practice).
|
|
84
|
+
// We map the exact Unicode hiragana block starting at 0x3041.
|
|
85
|
+
Object.assign(t, range(0x43, 0x4F, 0x4F + (0x3093 - 0x3041), 0x3041));
|
|
86
|
+
// --- Row 0x44 — Katakana (full-width) ---
|
|
87
|
+
// JIS row 5 col 1 = U+30A1 (ァ) through col 86 = U+30F6 (ヶ).
|
|
88
|
+
// IBM: 0x44 columns 0x4F..0xA4 approximately.
|
|
89
|
+
Object.assign(t, range(0x44, 0x4F, 0x4F + (0x30F6 - 0x30A1), 0x30A1));
|
|
90
|
+
// --- Row 0x45 — Greek ---
|
|
91
|
+
// JIS row 6 col 1 = U+0391 (Α, uppercase Alpha) through col 24 = U+03A9 (Ω),
|
|
92
|
+
// then col 33 = U+03B1 (α) through col 56 = U+03C9 (ω).
|
|
93
|
+
Object.assign(t, range(0x45, 0x41, 0x58, 0x0391));
|
|
94
|
+
Object.assign(t, range(0x45, 0x62, 0x79, 0x03B1));
|
|
95
|
+
// --- Row 0x46 — Cyrillic ---
|
|
96
|
+
// JIS row 7 col 1 = U+0410 (А) .. col 32 = U+042F (Я),
|
|
97
|
+
// then col 49 = U+0430 (а) .. col 80 = U+044F (я).
|
|
98
|
+
Object.assign(t, range(0x46, 0x41, 0x60, 0x0410));
|
|
99
|
+
Object.assign(t, range(0x46, 0x70, 0x8F, 0x0430));
|
|
100
|
+
// --- Row 0x47 — Box drawing ---
|
|
101
|
+
// JIS row 8 col 1 = U+2500 (─) .. col 32 = U+253F (broadly).
|
|
102
|
+
// Not all positions are assigned in JIS X 0208; we map the first 32
|
|
103
|
+
// contiguous characters as a best-effort. The built-in rendering via
|
|
104
|
+
// the Japanese monospace fonts listed in terminal.css aligns well.
|
|
105
|
+
Object.assign(t, range(0x47, 0x41, 0x60, 0x2500));
|
|
106
|
+
return t;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Register the built-in minimum IBM-Kanji table with the DBCS decoder.
|
|
110
|
+
* Call this once at proxy startup to get hiragana/katakana/symbol
|
|
111
|
+
* rendering without shipping the full Kanji table.
|
|
112
|
+
*
|
|
113
|
+
* The full Kanji plane (~7000 characters) still falls back to the geta
|
|
114
|
+
* mark until you register a complete table via `registerDbcsTable()`.
|
|
115
|
+
*
|
|
116
|
+
* Idempotent — safe to call multiple times; later entries overwrite
|
|
117
|
+
* earlier ones, so calling `registerDbcsTable(fullTable)` AFTER
|
|
118
|
+
* `registerBuiltinDbcsTable()` will layer the full table on top of the
|
|
119
|
+
* minimum.
|
|
120
|
+
*/
|
|
121
|
+
export function registerBuiltinDbcsTable() {
|
|
122
|
+
registerDbcsTable(buildBuiltinTable());
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=ebcdic-jp-builtin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ebcdic-jp-builtin.js","sourceRoot":"","sources":["../../src/tn5250/ebcdic-jp-builtin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,mEAAmE;AACnE,SAAS,KAAK,CACZ,QAAgB,EAChB,OAAe,EACf,OAAe,EACf,OAAe,EACf,OAAiB,EAAE;IAEnB,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,IAAI,EAAE,GAAG,OAAO,CAAC;IACjB,KAAK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,MAAM,CAAC,CAAC,CAAC;IAElD,iCAAiC;IACjC,6DAA6D;IAC7D,oEAAoE;IACpE,qEAAqE;IACrE,mEAAmE;IACnE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAElD,OAAO,CAAC,CAAC;AACX,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,wBAAwB;IACtC,iBAAiB,CAAC,iBAAiB,EAAE,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Japanese EBCDIC code pages for IBM i.
|
|
3
|
+
*
|
|
4
|
+
* Japanese IBM i systems typically use one of:
|
|
5
|
+
* - CCSID 290 — Japanese Katakana Extended (single-byte, host ROMAN)
|
|
6
|
+
* - CCSID 1027 — Japanese English Extended (single-byte, Latin)
|
|
7
|
+
* - CCSID 930 — Katakana-Kanji Mixed (SBCS 290 + DBCS)
|
|
8
|
+
* - CCSID 939 — Latin-Kanji Mixed (SBCS 1027 + DBCS)
|
|
9
|
+
*
|
|
10
|
+
* This module provides:
|
|
11
|
+
* 1. Single-byte CP290 katakana translation table (the "SO off" plane)
|
|
12
|
+
* 2. DBCS (Double-Byte Character Set) Kanji mapping hooks with a default
|
|
13
|
+
* converter that leverages Node's built-in Shift-JIS decoder via an
|
|
14
|
+
* IBM-Kanji → JIS X 0208 formula.
|
|
15
|
+
* 3. SI / SO control byte handling helpers.
|
|
16
|
+
*
|
|
17
|
+
* The DBCS converter covers the base JIS X 0208 plane. IBM-specific
|
|
18
|
+
* kanji extensions (user-defined characters, IBM selected kanji) that fall
|
|
19
|
+
* outside JIS X 0208 will render as the geta mark "〓" which is the
|
|
20
|
+
* conventional Japanese typographic substitution and preserves layout.
|
|
21
|
+
*
|
|
22
|
+
* Layout note: DBCS characters occupy 2 screen cells. The caller is
|
|
23
|
+
* responsible for writing the resolved glyph into the first cell and
|
|
24
|
+
* marking the second cell as a continuation (empty string).
|
|
25
|
+
*/
|
|
26
|
+
/** Shift-In: return to single-byte mode (EBCDIC SBCS). */
|
|
27
|
+
export declare const SI = 15;
|
|
28
|
+
/** Shift-Out: enter double-byte mode (EBCDIC DBCS Kanji). */
|
|
29
|
+
export declare const SO = 14;
|
|
30
|
+
export declare const EBCDIC_CP290_TO_UNICODE: number[];
|
|
31
|
+
/**
|
|
32
|
+
* Convert a single CP290 EBCDIC byte to a Unicode character.
|
|
33
|
+
* Unmapped positions fall back to SPACE.
|
|
34
|
+
*/
|
|
35
|
+
export declare function cp290ToChar(byte: number): string;
|
|
36
|
+
/** Unicode "geta mark" — conventional Japanese placeholder for unmapped kanji. */
|
|
37
|
+
export declare const DBCS_PLACEHOLDER = "\u3013";
|
|
38
|
+
/** Shift-Out / Shift-In markers rendered as invisible in output. */
|
|
39
|
+
export declare const DBCS_SHIFT_INVISIBLE = "";
|
|
40
|
+
/** Register a single DBCS byte-pair → Unicode mapping. */
|
|
41
|
+
export declare function registerDbcsMapping(byte1: number, byte2: number, unicode: string): void;
|
|
42
|
+
/**
|
|
43
|
+
* Bulk-register a DBCS table. The input may be either:
|
|
44
|
+
* - A Record<string, string> where keys are 4-hex-digit pair codes (e.g. "4141")
|
|
45
|
+
* - A Record<number, string> where keys are (byte1<<8)|byte2 integers
|
|
46
|
+
* - A Map<number, string>
|
|
47
|
+
*
|
|
48
|
+
* Use this to load a full IBM-Kanji → Unicode table from a JSON file:
|
|
49
|
+
*
|
|
50
|
+
* import kanjiTable from './ibm-kanji-jisx0208.json';
|
|
51
|
+
* registerDbcsTable(kanjiTable);
|
|
52
|
+
*/
|
|
53
|
+
export declare function registerDbcsTable(table: Record<string, string> | Record<number, string> | Map<number, string>): void;
|
|
54
|
+
/**
|
|
55
|
+
* Decode a single IBM EBCDIC DBCS byte pair to a Unicode string.
|
|
56
|
+
* Returns a single-character string (kanji or replacement) — never empty.
|
|
57
|
+
*/
|
|
58
|
+
export declare function decodeDbcsPair(byte1: number, byte2: number): string;
|
|
59
|
+
/** Return true if a byte is in the valid DBCS range (0x41-0xFE). */
|
|
60
|
+
export declare function isValidDbcsByte(byte: number): boolean;
|
|
61
|
+
//# sourceMappingURL=ebcdic-jp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ebcdic-jp.d.ts","sourceRoot":"","sources":["../../src/tn5250/ebcdic-jp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH,0DAA0D;AAC1D,eAAO,MAAM,EAAE,KAAO,CAAC;AACvB,6DAA6D;AAC7D,eAAO,MAAM,EAAE,KAAO,CAAC;AAsBvB,eAAO,MAAM,uBAAuB,EAAE,MAAM,EAiD3C,CAAC;AAEF;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGhD;AA8BD,kFAAkF;AAClF,eAAO,MAAM,gBAAgB,WAAW,CAAC;AAEzC,oEAAoE;AACpE,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAKvC,0DAA0D;AAC1D,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAEvF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAC3E,IAAI,CASN;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAWnE;AAED,oEAAoE;AACpE,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAErD"}
|