@yume-chan/adb 0.0.17 → 0.0.19

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.
Files changed (177) hide show
  1. package/CHANGELOG.json +27 -0
  2. package/CHANGELOG.md +16 -1
  3. package/LICENSE +1 -1
  4. package/esm/adb.d.ts +63 -60
  5. package/esm/adb.d.ts.map +1 -1
  6. package/esm/adb.js +257 -229
  7. package/esm/adb.js.map +1 -1
  8. package/esm/auth.d.ts +51 -51
  9. package/esm/auth.d.ts.map +1 -1
  10. package/esm/auth.js +95 -96
  11. package/esm/auth.js.map +1 -1
  12. package/esm/backend.d.ts +8 -8
  13. package/esm/backend.d.ts.map +1 -1
  14. package/esm/backend.js +1 -1
  15. package/esm/commands/base.d.ts +6 -6
  16. package/esm/commands/base.js +8 -8
  17. package/esm/commands/framebuffer.d.ts +53 -53
  18. package/esm/commands/framebuffer.d.ts.map +1 -1
  19. package/esm/commands/framebuffer.js +46 -47
  20. package/esm/commands/framebuffer.js.map +1 -1
  21. package/esm/commands/index.d.ts +7 -8
  22. package/esm/commands/index.d.ts.map +1 -1
  23. package/esm/commands/index.js +7 -8
  24. package/esm/commands/index.js.map +1 -1
  25. package/esm/commands/install.d.ts +9 -3
  26. package/esm/commands/install.d.ts.map +1 -1
  27. package/esm/commands/install.js +27 -21
  28. package/esm/commands/install.js.map +1 -1
  29. package/esm/commands/power.d.ts +22 -22
  30. package/esm/commands/power.d.ts.map +1 -1
  31. package/esm/commands/power.js +48 -44
  32. package/esm/commands/power.js.map +1 -1
  33. package/esm/commands/reverse.d.ts +41 -28
  34. package/esm/commands/reverse.d.ts.map +1 -1
  35. package/esm/commands/reverse.js +125 -98
  36. package/esm/commands/reverse.js.map +1 -1
  37. package/esm/commands/subprocess/command.d.ts +57 -51
  38. package/esm/commands/subprocess/command.d.ts.map +1 -1
  39. package/esm/commands/subprocess/command.js +86 -82
  40. package/esm/commands/subprocess/command.js.map +1 -1
  41. package/esm/commands/subprocess/index.d.ts +3 -3
  42. package/esm/commands/subprocess/index.js +3 -3
  43. package/esm/commands/subprocess/protocols/index.d.ts +3 -3
  44. package/esm/commands/subprocess/protocols/index.js +3 -3
  45. package/esm/commands/subprocess/protocols/none.d.ts +35 -35
  46. package/esm/commands/subprocess/protocols/none.d.ts.map +1 -1
  47. package/esm/commands/subprocess/protocols/none.js +65 -55
  48. package/esm/commands/subprocess/protocols/none.js.map +1 -1
  49. package/esm/commands/subprocess/protocols/shell.d.ts +39 -38
  50. package/esm/commands/subprocess/protocols/shell.d.ts.map +1 -1
  51. package/esm/commands/subprocess/protocols/shell.js +166 -154
  52. package/esm/commands/subprocess/protocols/shell.js.map +1 -1
  53. package/esm/commands/subprocess/protocols/types.d.ts +49 -49
  54. package/esm/commands/subprocess/protocols/types.d.ts.map +1 -1
  55. package/esm/commands/subprocess/protocols/types.js +1 -1
  56. package/esm/commands/subprocess/utils.d.ts +1 -1
  57. package/esm/commands/subprocess/utils.js +18 -18
  58. package/esm/commands/sync/index.d.ts +8 -7
  59. package/esm/commands/sync/index.d.ts.map +1 -1
  60. package/esm/commands/sync/index.js +8 -7
  61. package/esm/commands/sync/index.js.map +1 -1
  62. package/esm/commands/sync/list.d.ts +42 -40
  63. package/esm/commands/sync/list.d.ts.map +1 -1
  64. package/esm/commands/sync/list.js +67 -35
  65. package/esm/commands/sync/list.js.map +1 -1
  66. package/esm/commands/sync/pull.d.ts +13 -11
  67. package/esm/commands/sync/pull.d.ts.map +1 -1
  68. package/esm/commands/sync/pull.js +35 -36
  69. package/esm/commands/sync/pull.js.map +1 -1
  70. package/esm/commands/sync/push.d.ts +46 -7
  71. package/esm/commands/sync/push.d.ts.map +1 -1
  72. package/esm/commands/sync/push.js +89 -23
  73. package/esm/commands/sync/push.js.map +1 -1
  74. package/esm/commands/sync/request.d.ts +26 -23
  75. package/esm/commands/sync/request.d.ts.map +1 -1
  76. package/esm/commands/sync/request.js +40 -42
  77. package/esm/commands/sync/request.js.map +1 -1
  78. package/esm/commands/sync/response.d.ts +19 -19
  79. package/esm/commands/sync/response.d.ts.map +1 -1
  80. package/esm/commands/sync/response.js +54 -54
  81. package/esm/commands/sync/response.js.map +1 -1
  82. package/esm/commands/sync/socket.d.ts +27 -0
  83. package/esm/commands/sync/socket.d.ts.map +1 -0
  84. package/esm/commands/sync/socket.js +66 -0
  85. package/esm/commands/sync/socket.js.map +1 -0
  86. package/esm/commands/sync/stat.d.ts +72 -72
  87. package/esm/commands/sync/stat.d.ts.map +1 -1
  88. package/esm/commands/sync/stat.js +116 -94
  89. package/esm/commands/sync/stat.js.map +1 -1
  90. package/esm/commands/sync/sync.d.ts +72 -60
  91. package/esm/commands/sync/sync.d.ts.map +1 -1
  92. package/esm/commands/sync/sync.js +127 -148
  93. package/esm/commands/sync/sync.js.map +1 -1
  94. package/esm/commands/tcpip.d.ts +5 -5
  95. package/esm/commands/tcpip.js +18 -18
  96. package/esm/crypto.d.ts +36 -36
  97. package/esm/crypto.d.ts.map +1 -1
  98. package/esm/crypto.js +248 -238
  99. package/esm/crypto.js.map +1 -1
  100. package/esm/features.d.ts +10 -7
  101. package/esm/features.d.ts.map +1 -1
  102. package/esm/features.js +13 -10
  103. package/esm/features.js.map +1 -1
  104. package/esm/index.d.ts +9 -9
  105. package/esm/index.d.ts.map +1 -1
  106. package/esm/index.js +9 -9
  107. package/esm/index.js.map +1 -1
  108. package/esm/packet.d.ts +45 -46
  109. package/esm/packet.d.ts.map +1 -1
  110. package/esm/packet.js +43 -46
  111. package/esm/packet.js.map +1 -1
  112. package/esm/socket/dispatcher.d.ts +59 -59
  113. package/esm/socket/dispatcher.d.ts.map +1 -1
  114. package/esm/socket/dispatcher.js +223 -231
  115. package/esm/socket/dispatcher.js.map +1 -1
  116. package/esm/socket/index.d.ts +2 -2
  117. package/esm/socket/index.js +2 -2
  118. package/esm/socket/socket.d.ts +59 -59
  119. package/esm/socket/socket.d.ts.map +1 -1
  120. package/esm/socket/socket.js +118 -98
  121. package/esm/socket/socket.js.map +1 -1
  122. package/esm/utils/auto-reset-event.d.ts +9 -9
  123. package/esm/utils/auto-reset-event.d.ts.map +1 -1
  124. package/esm/utils/auto-reset-event.js +33 -33
  125. package/esm/utils/auto-reset-event.js.map +1 -1
  126. package/esm/utils/base64.d.ts +27 -27
  127. package/esm/utils/base64.d.ts.map +1 -1
  128. package/esm/utils/base64.js +246 -245
  129. package/esm/utils/base64.js.map +1 -1
  130. package/esm/utils/conditional-variable.d.ts +9 -0
  131. package/esm/utils/conditional-variable.d.ts.map +1 -0
  132. package/esm/utils/conditional-variable.js +34 -0
  133. package/esm/utils/conditional-variable.js.map +1 -0
  134. package/esm/utils/index.d.ts +4 -3
  135. package/esm/utils/index.d.ts.map +1 -1
  136. package/esm/utils/index.js +4 -3
  137. package/esm/utils/index.js.map +1 -1
  138. package/package.json +17 -13
  139. package/src/adb.ts +160 -101
  140. package/src/auth.ts +31 -22
  141. package/src/backend.ts +6 -4
  142. package/src/commands/base.ts +2 -2
  143. package/src/commands/framebuffer.ts +37 -41
  144. package/src/commands/index.ts +7 -8
  145. package/src/commands/power.ts +15 -11
  146. package/src/commands/reverse.ts +74 -30
  147. package/src/commands/subprocess/command.ts +34 -23
  148. package/src/commands/subprocess/index.ts +3 -3
  149. package/src/commands/subprocess/protocols/index.ts +3 -3
  150. package/src/commands/subprocess/protocols/none.ts +26 -11
  151. package/src/commands/subprocess/protocols/shell.ts +110 -56
  152. package/src/commands/subprocess/protocols/types.ts +10 -6
  153. package/src/commands/subprocess/utils.ts +1 -1
  154. package/src/commands/sync/index.ts +8 -7
  155. package/src/commands/sync/list.ts +74 -28
  156. package/src/commands/sync/pull.ts +49 -37
  157. package/src/commands/sync/push.ts +153 -32
  158. package/src/commands/sync/request.ts +37 -34
  159. package/src/commands/sync/response.ts +34 -27
  160. package/src/commands/sync/socket.ts +97 -0
  161. package/src/commands/sync/stat.ts +98 -70
  162. package/src/commands/sync/sync.ts +78 -97
  163. package/src/commands/tcpip.ts +5 -5
  164. package/src/crypto.ts +60 -32
  165. package/src/features.ts +9 -6
  166. package/src/index.ts +9 -10
  167. package/src/packet.ts +41 -46
  168. package/src/socket/dispatcher.ts +130 -108
  169. package/src/socket/index.ts +2 -2
  170. package/src/socket/socket.ts +84 -34
  171. package/src/utils/auto-reset-event.ts +16 -17
  172. package/src/utils/base64.ts +51 -41
  173. package/src/utils/conditional-variable.ts +45 -0
  174. package/src/utils/index.ts +4 -3
  175. package/tsconfig.build.json +1 -1
  176. package/tsconfig.build.tsbuildinfo +1 -1
  177. package/src/commands/install.ts +0 -32
@@ -1,246 +1,247 @@
1
- // Prepare maps for O(1) searching
2
- const charToIndex = {};
3
- const indexToChar = [];
4
- const paddingChar = '='.charCodeAt(0);
5
- function addRange(start, end) {
6
- const charCodeStart = start.charCodeAt(0);
7
- const charCodeEnd = end.charCodeAt(0);
8
- for (let charCode = charCodeStart; charCode <= charCodeEnd; charCode += 1) {
9
- charToIndex[String.fromCharCode(charCode)] = indexToChar.length;
10
- indexToChar.push(charCode);
11
- }
12
- }
13
- addRange('A', 'Z');
14
- addRange('a', 'z');
15
- addRange('0', '9');
16
- addRange('+', '+');
17
- addRange('/', '/');
18
- /**
19
- * Calculate the required length of the output buffer for the given input length.
20
- *
21
- * @param inputLength Length of the input in bytes
22
- * @returns Length of the output in bytes
23
- */
24
- export function calculateBase64EncodedLength(inputLength) {
25
- const remainder = inputLength % 3;
26
- const paddingLength = remainder !== 0 ? 3 - remainder : 0;
27
- return [(inputLength + paddingLength) / 3 * 4, paddingLength];
28
- }
29
- export function encodeBase64(input, output) {
30
- const [outputLength, paddingLength] = calculateBase64EncodedLength(input.length);
31
- if (!output) {
32
- output = new Uint8Array(outputLength);
33
- encodeForward(input, output, paddingLength);
34
- return output;
35
- }
36
- else {
37
- if (output.length < outputLength) {
38
- throw new Error('output buffer is too small');
39
- }
40
- output = output.subarray(0, outputLength);
41
- // When input and output are on same ArrayBuffer,
42
- // we check if it's possible to encode in-place.
43
- if (input.buffer !== output.buffer) {
44
- encodeForward(input, output, paddingLength);
45
- }
46
- else if (output.byteOffset + output.length - (paddingLength + 1) <= input.byteOffset + input.length) {
47
- // Output ends before input ends
48
- // So output won't catch up with input.
49
- // Depends on padding length,
50
- // it's possible to write 1-3 bytes after input ends.
51
- // spell: disable-next-line
52
- // | aaaaaabb | | | |
53
- // | aaaaaa | bb0000 | = | = |
54
- //
55
- // spell: disable-next-line
56
- // | aaaaaabb | bbbbcccc | | |
57
- // | aaaaaa | bbbbbb | cccc00 | = |
58
- //
59
- // spell: disable-next-line
60
- // | aaaaaabb | bbbbcccc | ccdddddd | |
61
- // | aaaaaa | bbbbbb | cccccc | dddddd |
62
- // Must encode forwards.
63
- encodeForward(input, output, paddingLength);
64
- }
65
- else if (output.byteOffset >= input.byteOffset - 1) {
66
- // Output starts after input starts
67
- // So in backwards, output can't catch up with input.
68
- // Because first 3 bytes becomes 4 bytes,
69
- // it's possible to write 1 byte before input starts.
70
- // spell: disable-next-line
71
- // | | aaaaaabb | bbbbcccc | ccdddddd |
72
- // | aaaaaa | bbbbbb | cccccc | dddddd |
73
- // Must encode backwards.
74
- encodeBackward(input, output, paddingLength);
75
- }
76
- else {
77
- // Input is in the middle of output,
78
- // not possible to read neither first or last three bytes,
79
- throw new Error('input and output cannot overlap');
80
- }
81
- return outputLength;
82
- }
83
- }
84
- function encodeForward(input, output, paddingLength) {
85
- let inputIndex = 0;
86
- let outputIndex = 0;
87
- while (inputIndex < input.length - 2) {
88
- /* cspell: disable-next-line */
89
- // aaaaaabb
90
- const x = input[inputIndex];
91
- inputIndex += 1;
92
- /* cspell: disable-next-line */
93
- // bbbbcccc
94
- const y = input[inputIndex];
95
- inputIndex += 1;
96
- /* cspell: disable-next-line */
97
- // ccdddddd
98
- const z = input[inputIndex];
99
- inputIndex += 1;
100
- output[outputIndex] = indexToChar[x >> 2];
101
- outputIndex += 1;
102
- output[outputIndex] = indexToChar[((x & 0b11) << 4) | (y >> 4)];
103
- outputIndex += 1;
104
- output[outputIndex] = indexToChar[((y & 0b1111) << 2) | (z >> 6)];
105
- outputIndex += 1;
106
- output[outputIndex] = indexToChar[z & 0b111111];
107
- outputIndex += 1;
108
- }
109
- if (paddingLength === 2) {
110
- /* cspell: disable-next-line */
111
- // aaaaaabb
112
- const x = input[inputIndex];
113
- inputIndex += 1;
114
- output[outputIndex] = indexToChar[x >> 2];
115
- outputIndex += 1;
116
- output[outputIndex] = indexToChar[((x & 0b11) << 4)];
117
- outputIndex += 1;
118
- output[outputIndex] = paddingChar;
119
- outputIndex += 1;
120
- output[outputIndex] = paddingChar;
121
- }
122
- else if (paddingLength === 1) {
123
- /* cspell: disable-next-line */
124
- // aaaaaabb
125
- const x = input[inputIndex];
126
- inputIndex += 1;
127
- /* cspell: disable-next-line */
128
- // bbbbcccc
129
- const y = input[inputIndex];
130
- inputIndex += 1;
131
- output[outputIndex] = indexToChar[x >> 2];
132
- outputIndex += 1;
133
- output[outputIndex] = indexToChar[((x & 0b11) << 4) | (y >> 4)];
134
- outputIndex += 1;
135
- output[outputIndex] = indexToChar[((y & 0b1111) << 2)];
136
- outputIndex += 1;
137
- output[outputIndex] = paddingChar;
138
- }
139
- }
140
- function encodeBackward(input, output, paddingLength) {
141
- let inputIndex = input.length - 1;
142
- let outputIndex = output.length - 1;
143
- if (paddingLength === 2) {
144
- /* cspell: disable-next-line */
145
- // aaaaaabb
146
- const x = input[inputIndex];
147
- inputIndex -= 1;
148
- output[outputIndex] = paddingChar;
149
- outputIndex -= 1;
150
- output[outputIndex] = paddingChar;
151
- outputIndex -= 1;
152
- output[outputIndex] = indexToChar[((x & 0b11) << 4)];
153
- outputIndex -= 1;
154
- output[outputIndex] = indexToChar[x >> 2];
155
- outputIndex -= 1;
156
- }
157
- else if (paddingLength === 1) {
158
- /* cspell: disable-next-line */
159
- // bbbbcccc
160
- const y = input[inputIndex];
161
- inputIndex -= 1;
162
- /* cspell: disable-next-line */
163
- // aaaaaabb
164
- const x = input[inputIndex];
165
- inputIndex -= 1;
166
- output[outputIndex] = paddingChar;
167
- outputIndex -= 1;
168
- output[outputIndex] = indexToChar[((y & 0b1111) << 2)];
169
- outputIndex -= 1;
170
- output[outputIndex] = indexToChar[((x & 0b11) << 4) | (y >> 4)];
171
- outputIndex -= 1;
172
- output[outputIndex] = indexToChar[x >> 2];
173
- outputIndex -= 1;
174
- }
175
- while (inputIndex >= 0) {
176
- /* cspell: disable-next-line */
177
- // ccdddddd
178
- const z = input[inputIndex];
179
- inputIndex -= 1;
180
- /* cspell: disable-next-line */
181
- // bbbbcccc
182
- const y = input[inputIndex];
183
- inputIndex -= 1;
184
- /* cspell: disable-next-line */
185
- // aaaaaabb
186
- const x = input[inputIndex];
187
- inputIndex -= 1;
188
- output[outputIndex] = indexToChar[z & 0b111111];
189
- outputIndex -= 1;
190
- output[outputIndex] = indexToChar[((y & 0b1111) << 2) | (z >> 6)];
191
- outputIndex -= 1;
192
- output[outputIndex] = indexToChar[((x & 0b11) << 4) | (y >> 4)];
193
- outputIndex -= 1;
194
- output[outputIndex] = indexToChar[x >> 2];
195
- outputIndex -= 1;
196
- }
197
- }
198
- export function decodeBase64(input) {
199
- let padding;
200
- if (input[input.length - 2] === '=') {
201
- padding = 2;
202
- }
203
- else if (input[input.length - 1] === '=') {
204
- padding = 1;
205
- }
206
- else {
207
- padding = 0;
208
- }
209
- const result = new Uint8Array(input.length / 4 * 3 - padding);
210
- let sIndex = 0;
211
- let dIndex = 0;
212
- while (sIndex < input.length - (padding !== 0 ? 4 : 0)) {
213
- const a = charToIndex[input[sIndex]];
214
- sIndex += 1;
215
- const b = charToIndex[input[sIndex]];
216
- sIndex += 1;
217
- const c = charToIndex[input[sIndex]];
218
- sIndex += 1;
219
- const d = charToIndex[input[sIndex]];
220
- sIndex += 1;
221
- result[dIndex] = (a << 2) | ((b & 48) >> 4);
222
- dIndex += 1;
223
- result[dIndex] = ((b & 0b1111) << 4) | ((c & 60) >> 2);
224
- dIndex += 1;
225
- result[dIndex] = ((c & 0b11) << 6) | d;
226
- dIndex += 1;
227
- }
228
- if (padding === 1) {
229
- const a = charToIndex[input[sIndex]];
230
- sIndex += 1;
231
- const b = charToIndex[input[sIndex]];
232
- sIndex += 1;
233
- const c = charToIndex[input[sIndex]];
234
- result[dIndex] = (a << 2) | ((b & 48) >> 4);
235
- dIndex += 1;
236
- result[dIndex] = ((b & 0b1111) << 4) | ((c & 60) >> 2);
237
- }
238
- else if (padding === 2) {
239
- const a = charToIndex[input[sIndex]];
240
- sIndex += 1;
241
- const b = charToIndex[input[sIndex]];
242
- result[dIndex] = (a << 2) | ((b & 48) >> 4);
243
- }
244
- return result;
245
- }
1
+ // Array is faster than object literal or `Map`
2
+ const charToIndex = [];
3
+ const indexToChar = [];
4
+ const paddingChar = "=".charCodeAt(0);
5
+ function addRange(start, end) {
6
+ const charCodeStart = start.charCodeAt(0);
7
+ const charCodeEnd = end.charCodeAt(0);
8
+ for (let charCode = charCodeStart; charCode <= charCodeEnd; charCode += 1) {
9
+ charToIndex[charCode] = indexToChar.length;
10
+ indexToChar.push(charCode);
11
+ }
12
+ }
13
+ addRange("A", "Z");
14
+ addRange("a", "z");
15
+ addRange("0", "9");
16
+ addRange("+", "+");
17
+ addRange("/", "/");
18
+ /**
19
+ * Calculate the required length of the output buffer for the given input length.
20
+ *
21
+ * @param inputLength Length of the input in bytes
22
+ * @returns Length of the output in bytes
23
+ */
24
+ export function calculateBase64EncodedLength(inputLength) {
25
+ const remainder = inputLength % 3;
26
+ const paddingLength = remainder !== 0 ? 3 - remainder : 0;
27
+ return [((inputLength + paddingLength) / 3) * 4, paddingLength];
28
+ }
29
+ export function encodeBase64(input, output) {
30
+ const [outputLength, paddingLength] = calculateBase64EncodedLength(input.length);
31
+ if (!output) {
32
+ output = new Uint8Array(outputLength);
33
+ encodeForward(input, output, paddingLength);
34
+ return output;
35
+ }
36
+ else {
37
+ if (output.length < outputLength) {
38
+ throw new Error("output buffer is too small");
39
+ }
40
+ output = output.subarray(0, outputLength);
41
+ // When input and output are on same ArrayBuffer,
42
+ // we check if it's possible to encode in-place.
43
+ if (input.buffer !== output.buffer) {
44
+ encodeForward(input, output, paddingLength);
45
+ }
46
+ else if (output.byteOffset + output.length - (paddingLength + 1) <=
47
+ input.byteOffset + input.length) {
48
+ // Output ends before input ends
49
+ // So output won't catch up with input.
50
+ // Depends on padding length,
51
+ // it's possible to write 1-3 bytes after input ends.
52
+ // spell: disable-next-line
53
+ // | aaaaaabb | | | |
54
+ // | aaaaaa | bb0000 | = | = |
55
+ //
56
+ // spell: disable-next-line
57
+ // | aaaaaabb | bbbbcccc | | |
58
+ // | aaaaaa | bbbbbb | cccc00 | = |
59
+ //
60
+ // spell: disable-next-line
61
+ // | aaaaaabb | bbbbcccc | ccdddddd | |
62
+ // | aaaaaa | bbbbbb | cccccc | dddddd |
63
+ // Must encode forwards.
64
+ encodeForward(input, output, paddingLength);
65
+ }
66
+ else if (output.byteOffset >= input.byteOffset - 1) {
67
+ // Output starts after input starts
68
+ // So in backwards, output can't catch up with input.
69
+ // Because first 3 bytes becomes 4 bytes,
70
+ // it's possible to write 1 byte before input starts.
71
+ // spell: disable-next-line
72
+ // | | aaaaaabb | bbbbcccc | ccdddddd |
73
+ // | aaaaaa | bbbbbb | cccccc | dddddd |
74
+ // Must encode backwards.
75
+ encodeBackward(input, output, paddingLength);
76
+ }
77
+ else {
78
+ // Input is in the middle of output,
79
+ // not possible to read neither first or last three bytes,
80
+ throw new Error("input and output cannot overlap");
81
+ }
82
+ return outputLength;
83
+ }
84
+ }
85
+ function encodeForward(input, output, paddingLength) {
86
+ let inputIndex = 0;
87
+ let outputIndex = 0;
88
+ while (inputIndex < input.length - 2) {
89
+ /* cspell: disable-next-line */
90
+ // aaaaaabb
91
+ const x = input[inputIndex];
92
+ inputIndex += 1;
93
+ /* cspell: disable-next-line */
94
+ // bbbbcccc
95
+ const y = input[inputIndex];
96
+ inputIndex += 1;
97
+ /* cspell: disable-next-line */
98
+ // ccdddddd
99
+ const z = input[inputIndex];
100
+ inputIndex += 1;
101
+ output[outputIndex] = indexToChar[x >> 2];
102
+ outputIndex += 1;
103
+ output[outputIndex] = indexToChar[((x & 0b11) << 4) | (y >> 4)];
104
+ outputIndex += 1;
105
+ output[outputIndex] = indexToChar[((y & 0b1111) << 2) | (z >> 6)];
106
+ outputIndex += 1;
107
+ output[outputIndex] = indexToChar[z & 0b111111];
108
+ outputIndex += 1;
109
+ }
110
+ if (paddingLength === 2) {
111
+ /* cspell: disable-next-line */
112
+ // aaaaaabb
113
+ const x = input[inputIndex];
114
+ inputIndex += 1;
115
+ output[outputIndex] = indexToChar[x >> 2];
116
+ outputIndex += 1;
117
+ output[outputIndex] = indexToChar[(x & 0b11) << 4];
118
+ outputIndex += 1;
119
+ output[outputIndex] = paddingChar;
120
+ outputIndex += 1;
121
+ output[outputIndex] = paddingChar;
122
+ }
123
+ else if (paddingLength === 1) {
124
+ /* cspell: disable-next-line */
125
+ // aaaaaabb
126
+ const x = input[inputIndex];
127
+ inputIndex += 1;
128
+ /* cspell: disable-next-line */
129
+ // bbbbcccc
130
+ const y = input[inputIndex];
131
+ inputIndex += 1;
132
+ output[outputIndex] = indexToChar[x >> 2];
133
+ outputIndex += 1;
134
+ output[outputIndex] = indexToChar[((x & 0b11) << 4) | (y >> 4)];
135
+ outputIndex += 1;
136
+ output[outputIndex] = indexToChar[(y & 0b1111) << 2];
137
+ outputIndex += 1;
138
+ output[outputIndex] = paddingChar;
139
+ }
140
+ }
141
+ function encodeBackward(input, output, paddingLength) {
142
+ let inputIndex = input.length - 1;
143
+ let outputIndex = output.length - 1;
144
+ if (paddingLength === 2) {
145
+ /* cspell: disable-next-line */
146
+ // aaaaaabb
147
+ const x = input[inputIndex];
148
+ inputIndex -= 1;
149
+ output[outputIndex] = paddingChar;
150
+ outputIndex -= 1;
151
+ output[outputIndex] = paddingChar;
152
+ outputIndex -= 1;
153
+ output[outputIndex] = indexToChar[(x & 0b11) << 4];
154
+ outputIndex -= 1;
155
+ output[outputIndex] = indexToChar[x >> 2];
156
+ outputIndex -= 1;
157
+ }
158
+ else if (paddingLength === 1) {
159
+ /* cspell: disable-next-line */
160
+ // bbbbcccc
161
+ const y = input[inputIndex];
162
+ inputIndex -= 1;
163
+ /* cspell: disable-next-line */
164
+ // aaaaaabb
165
+ const x = input[inputIndex];
166
+ inputIndex -= 1;
167
+ output[outputIndex] = paddingChar;
168
+ outputIndex -= 1;
169
+ output[outputIndex] = indexToChar[(y & 0b1111) << 2];
170
+ outputIndex -= 1;
171
+ output[outputIndex] = indexToChar[((x & 0b11) << 4) | (y >> 4)];
172
+ outputIndex -= 1;
173
+ output[outputIndex] = indexToChar[x >> 2];
174
+ outputIndex -= 1;
175
+ }
176
+ while (inputIndex >= 0) {
177
+ /* cspell: disable-next-line */
178
+ // ccdddddd
179
+ const z = input[inputIndex];
180
+ inputIndex -= 1;
181
+ /* cspell: disable-next-line */
182
+ // bbbbcccc
183
+ const y = input[inputIndex];
184
+ inputIndex -= 1;
185
+ /* cspell: disable-next-line */
186
+ // aaaaaabb
187
+ const x = input[inputIndex];
188
+ inputIndex -= 1;
189
+ output[outputIndex] = indexToChar[z & 0b111111];
190
+ outputIndex -= 1;
191
+ output[outputIndex] = indexToChar[((y & 0b1111) << 2) | (z >> 6)];
192
+ outputIndex -= 1;
193
+ output[outputIndex] = indexToChar[((x & 0b11) << 4) | (y >> 4)];
194
+ outputIndex -= 1;
195
+ output[outputIndex] = indexToChar[x >> 2];
196
+ outputIndex -= 1;
197
+ }
198
+ }
199
+ export function decodeBase64(input) {
200
+ let padding;
201
+ if (input[input.length - 2] === "=") {
202
+ padding = 2;
203
+ }
204
+ else if (input[input.length - 1] === "=") {
205
+ padding = 1;
206
+ }
207
+ else {
208
+ padding = 0;
209
+ }
210
+ const result = new Uint8Array((input.length / 4) * 3 - padding);
211
+ let sIndex = 0;
212
+ let dIndex = 0;
213
+ while (sIndex < input.length - (padding !== 0 ? 4 : 0)) {
214
+ const a = charToIndex[input.charCodeAt(sIndex)];
215
+ sIndex += 1;
216
+ const b = charToIndex[input.charCodeAt(sIndex)];
217
+ sIndex += 1;
218
+ const c = charToIndex[input.charCodeAt(sIndex)];
219
+ sIndex += 1;
220
+ const d = charToIndex[input.charCodeAt(sIndex)];
221
+ sIndex += 1;
222
+ result[dIndex] = (a << 2) | ((b & 48) >> 4);
223
+ dIndex += 1;
224
+ result[dIndex] = ((b & 0b1111) << 4) | ((c & 60) >> 2);
225
+ dIndex += 1;
226
+ result[dIndex] = ((c & 0b11) << 6) | d;
227
+ dIndex += 1;
228
+ }
229
+ if (padding === 1) {
230
+ const a = charToIndex[input.charCodeAt(sIndex)];
231
+ sIndex += 1;
232
+ const b = charToIndex[input.charCodeAt(sIndex)];
233
+ sIndex += 1;
234
+ const c = charToIndex[input.charCodeAt(sIndex)];
235
+ result[dIndex] = (a << 2) | ((b & 48) >> 4);
236
+ dIndex += 1;
237
+ result[dIndex] = ((b & 0b1111) << 4) | ((c & 60) >> 2);
238
+ }
239
+ else if (padding === 2) {
240
+ const a = charToIndex[input.charCodeAt(sIndex)];
241
+ sIndex += 1;
242
+ const b = charToIndex[input.charCodeAt(sIndex)];
243
+ result[dIndex] = (a << 2) | ((b & 48) >> 4);
244
+ }
245
+ return result;
246
+ }
246
247
  //# sourceMappingURL=base64.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"base64.js","sourceRoot":"","sources":["../../src/utils/base64.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,MAAM,WAAW,GAA2B,EAAE,CAAC;AAC/C,MAAM,WAAW,GAAa,EAAE,CAAC;AACjC,MAAM,WAAW,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAEtC,SAAS,QAAQ,CAAC,KAAa,EAAE,GAAW;IACxC,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAC1C,MAAM,WAAW,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAEtC,KAAK,IAAI,QAAQ,GAA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AW,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAE,CAAC;QACjD,MAAM,IAAI,CAAC,CAAC;QAEZ,MAAM,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAE,CAAC;QAEjD,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAS,CAAC,IAAI,CAAC,CAAC,CAAC;KACtD;IAED,OAAO,MAAM,CAAC;AAClB,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { Disposable } from "@yume-chan/event";
2
+ export declare class ConditionalVariable implements Disposable {
3
+ private _locked;
4
+ private readonly _queue;
5
+ wait(condition: () => boolean): Promise<void>;
6
+ notifyOne(): void;
7
+ dispose(): void;
8
+ }
9
+ //# sourceMappingURL=conditional-variable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditional-variable.d.ts","sourceRoot":"","sources":["../../src/utils/conditional-variable.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAOnD,qBAAa,mBAAoB,YAAW,UAAU;IAClD,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmB;IAEnC,IAAI,CAAC,SAAS,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAa7C,SAAS;IAWT,OAAO,IAAI,IAAI;CAQzB"}
@@ -0,0 +1,34 @@
1
+ import { PromiseResolver } from "@yume-chan/async";
2
+ export class ConditionalVariable {
3
+ _locked = false;
4
+ _queue = [];
5
+ wait(condition) {
6
+ if (!this._locked) {
7
+ this._locked = true;
8
+ if (this._queue.length === 0 && condition()) {
9
+ return Promise.resolve();
10
+ }
11
+ }
12
+ const resolver = new PromiseResolver();
13
+ this._queue.push({ condition, resolver });
14
+ return resolver.promise;
15
+ }
16
+ notifyOne() {
17
+ const entry = this._queue.shift();
18
+ if (entry) {
19
+ if (entry.condition()) {
20
+ entry.resolver.resolve();
21
+ }
22
+ }
23
+ else {
24
+ this._locked = false;
25
+ }
26
+ }
27
+ dispose() {
28
+ for (const item of this._queue) {
29
+ item.resolver.reject(new Error("The ConditionalVariable has been disposed"));
30
+ }
31
+ this._queue.length = 0;
32
+ }
33
+ }
34
+ //# sourceMappingURL=conditional-variable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditional-variable.js","sourceRoot":"","sources":["../../src/utils/conditional-variable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAQnD,MAAM,OAAO,mBAAmB;IACpB,OAAO,GAAG,KAAK,CAAC;IACP,MAAM,GAAgB,EAAE,CAAC;IAEnC,IAAI,CAAC,SAAwB;QAChC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACf,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;YACpB,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,SAAS,EAAE,EAAE;gBACzC,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;aAC5B;SACJ;QAED,MAAM,QAAQ,GAAG,IAAI,eAAe,EAAQ,CAAC;QAC7C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC1C,OAAO,QAAQ,CAAC,OAAO,CAAC;IAC5B,CAAC;IAEM,SAAS;QACZ,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAClC,IAAI,KAAK,EAAE;YACP,IAAI,KAAK,CAAC,SAAS,EAAE,EAAE;gBACnB,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;aAC5B;SACJ;aAAM;YACH,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;SACxB;IACL,CAAC;IAEM,OAAO;QACV,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE;YAC5B,IAAI,CAAC,QAAQ,CAAC,MAAM,CAChB,IAAI,KAAK,CAAC,2CAA2C,CAAC,CACzD,CAAC;SACL;QACD,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IAC3B,CAAC;CACJ"}
@@ -1,4 +1,5 @@
1
- export { decodeUtf8, encodeUtf8 } from '@yume-chan/struct';
2
- export * from './auto-reset-event.js';
3
- export * from './base64.js';
1
+ export { decodeUtf8, encodeUtf8 } from "@yume-chan/struct";
2
+ export * from "./auto-reset-event.js";
3
+ export * from "./base64.js";
4
+ export * from "./conditional-variable.js";
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC3D,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC3D,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC"}
@@ -1,4 +1,5 @@
1
- export { decodeUtf8, encodeUtf8 } from '@yume-chan/struct';
2
- export * from './auto-reset-event.js';
3
- export * from './base64.js';
1
+ export { decodeUtf8, encodeUtf8 } from "@yume-chan/struct";
2
+ export * from "./auto-reset-event.js";
3
+ export * from "./base64.js";
4
+ export * from "./conditional-variable.js";
4
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC3D,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC3D,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC"}