@yume-chan/adb 2.6.0 → 3.0.0-beta.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.
Files changed (449) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/esm/adb.d.ts +18 -15
  4. package/esm/adb.d.ts.map +1 -1
  5. package/esm/adb.js +18 -11
  6. package/esm/adb.js.map +1 -1
  7. package/esm/banner.d.ts +1 -1
  8. package/esm/banner.d.ts.map +1 -1
  9. package/esm/daemon/auth/authenticator.d.ts +28 -0
  10. package/esm/daemon/auth/authenticator.d.ts.map +1 -0
  11. package/esm/daemon/auth/authenticator.js +108 -0
  12. package/esm/daemon/auth/authenticator.js.map +1 -0
  13. package/esm/daemon/auth/index.d.ts +5 -0
  14. package/esm/daemon/auth/index.d.ts.map +1 -0
  15. package/esm/daemon/auth/index.js +5 -0
  16. package/esm/daemon/auth/index.js.map +1 -0
  17. package/esm/daemon/auth/packet-processor.d.ts +42 -0
  18. package/esm/daemon/auth/packet-processor.d.ts.map +1 -0
  19. package/esm/daemon/auth/packet-processor.js +129 -0
  20. package/esm/daemon/auth/packet-processor.js.map +1 -0
  21. package/esm/daemon/auth/public-key.d.ts +8 -0
  22. package/esm/daemon/auth/public-key.d.ts.map +1 -0
  23. package/esm/daemon/auth/public-key.js +74 -0
  24. package/esm/daemon/auth/public-key.js.map +1 -0
  25. package/esm/daemon/auth/type.d.ts +5 -0
  26. package/esm/daemon/auth/type.d.ts.map +1 -0
  27. package/esm/daemon/auth/type.js +2 -0
  28. package/esm/daemon/auth/type.js.map +1 -0
  29. package/esm/daemon/crypto.d.ts +6 -5
  30. package/esm/daemon/crypto.d.ts.map +1 -1
  31. package/esm/daemon/crypto.js +23 -73
  32. package/esm/daemon/crypto.js.map +1 -1
  33. package/esm/daemon/dispatcher.d.ts +3 -3
  34. package/esm/daemon/dispatcher.d.ts.map +1 -1
  35. package/esm/daemon/dispatcher.js +11 -4
  36. package/esm/daemon/dispatcher.js.map +1 -1
  37. package/esm/daemon/index.d.ts +1 -1
  38. package/esm/daemon/index.d.ts.map +1 -1
  39. package/esm/daemon/index.js +1 -1
  40. package/esm/daemon/index.js.map +1 -1
  41. package/esm/daemon/socket.d.ts +3 -3
  42. package/esm/daemon/socket.d.ts.map +1 -1
  43. package/esm/daemon/transport.d.ts +13 -65
  44. package/esm/daemon/transport.d.ts.map +1 -1
  45. package/esm/daemon/transport.js +18 -140
  46. package/esm/daemon/transport.js.map +1 -1
  47. package/esm/device-observer.d.ts +2 -3
  48. package/esm/device-observer.d.ts.map +1 -1
  49. package/esm/features-value.d.ts +40 -0
  50. package/esm/features-value.d.ts.map +1 -0
  51. package/esm/features-value.js +46 -0
  52. package/esm/features-value.js.map +1 -0
  53. package/esm/features.d.ts +4 -12
  54. package/esm/features.d.ts.map +1 -1
  55. package/esm/features.js +27 -13
  56. package/esm/features.js.map +1 -1
  57. package/esm/index.d.ts +1 -1
  58. package/esm/index.d.ts.map +1 -1
  59. package/esm/index.js +1 -1
  60. package/esm/index.js.map +1 -1
  61. package/esm/server/client.d.ts +7 -7
  62. package/esm/server/client.d.ts.map +1 -1
  63. package/esm/server/client.js +69 -86
  64. package/esm/server/client.js.map +1 -1
  65. package/esm/server/commands/wireless.js +1 -1
  66. package/esm/server/commands/wireless.js.map +1 -1
  67. package/esm/server/{stream.d.ts → data-connection.d.ts} +5 -5
  68. package/esm/server/data-connection.d.ts.map +1 -0
  69. package/esm/server/{stream.js → data-connection.js} +4 -4
  70. package/esm/server/data-connection.js.map +1 -0
  71. package/esm/server/index.d.ts +1 -1
  72. package/esm/server/index.d.ts.map +1 -1
  73. package/esm/server/index.js +1 -1
  74. package/esm/server/index.js.map +1 -1
  75. package/esm/server/observer.d.ts.map +1 -1
  76. package/esm/server/observer.js +14 -13
  77. package/esm/server/observer.js.map +1 -1
  78. package/esm/server/transport.d.ts +4 -6
  79. package/esm/server/transport.d.ts.map +1 -1
  80. package/esm/server/transport.js +9 -24
  81. package/esm/server/transport.js.map +1 -1
  82. package/esm/service/framebuffer.d.ts.map +1 -0
  83. package/esm/service/framebuffer.js.map +1 -0
  84. package/esm/{commands → service}/index.d.ts +1 -2
  85. package/esm/service/index.d.ts.map +1 -0
  86. package/esm/{commands → service}/index.js +1 -2
  87. package/esm/service/index.js.map +1 -0
  88. package/esm/{commands → service}/power.d.ts +4 -2
  89. package/esm/service/power.d.ts.map +1 -0
  90. package/esm/{commands → service}/power.js +11 -5
  91. package/esm/service/power.js.map +1 -0
  92. package/esm/service/reverse/error.d.ts +14 -0
  93. package/esm/service/reverse/error.d.ts.map +1 -0
  94. package/esm/service/reverse/error.js +21 -0
  95. package/esm/service/reverse/error.js.map +1 -0
  96. package/esm/service/reverse/index.d.ts +3 -0
  97. package/esm/service/reverse/index.d.ts.map +1 -0
  98. package/esm/service/reverse/index.js +4 -0
  99. package/esm/service/reverse/index.js.map +1 -0
  100. package/esm/service/reverse/response.d.ts +2 -0
  101. package/esm/service/reverse/response.d.ts.map +1 -0
  102. package/esm/service/reverse/response.js +30 -0
  103. package/esm/service/reverse/response.js.map +1 -0
  104. package/esm/service/reverse/service.d.ts +59 -0
  105. package/esm/service/reverse/service.d.ts.map +1 -0
  106. package/esm/{commands/reverse.js → service/reverse/service.js} +16 -45
  107. package/esm/service/reverse/service.js.map +1 -0
  108. package/esm/{commands → service}/subprocess/index.d.ts +1 -0
  109. package/esm/service/subprocess/index.d.ts.map +1 -0
  110. package/esm/{commands → service}/subprocess/index.js +1 -0
  111. package/esm/service/subprocess/index.js.map +1 -0
  112. package/esm/service/subprocess/none/index.d.ts.map +1 -0
  113. package/esm/service/subprocess/none/index.js.map +1 -0
  114. package/esm/{commands → service}/subprocess/none/process.d.ts +2 -2
  115. package/esm/service/subprocess/none/process.d.ts.map +1 -0
  116. package/esm/service/subprocess/none/process.js.map +1 -0
  117. package/esm/{commands → service}/subprocess/none/pty.d.ts +4 -4
  118. package/esm/service/subprocess/none/pty.d.ts.map +1 -0
  119. package/esm/{commands → service}/subprocess/none/pty.js +1 -1
  120. package/esm/service/subprocess/none/pty.js.map +1 -0
  121. package/esm/service/subprocess/none/service.d.ts +10 -0
  122. package/esm/service/subprocess/none/service.d.ts.map +1 -0
  123. package/esm/service/subprocess/none/service.js +44 -0
  124. package/esm/service/subprocess/none/service.js.map +1 -0
  125. package/esm/service/subprocess/none/spawner.d.ts +15 -0
  126. package/esm/service/subprocess/none/spawner.d.ts.map +1 -0
  127. package/esm/service/subprocess/none/spawner.js +31 -0
  128. package/esm/service/subprocess/none/spawner.js.map +1 -0
  129. package/esm/{commands → service}/subprocess/pty.d.ts +1 -1
  130. package/esm/service/subprocess/pty.d.ts.map +1 -0
  131. package/esm/{commands → service}/subprocess/pty.js.map +1 -1
  132. package/esm/service/subprocess/service.d.ts.map +1 -0
  133. package/esm/{commands → service}/subprocess/service.js +1 -1
  134. package/esm/service/subprocess/service.js.map +1 -0
  135. package/esm/service/subprocess/shell/index.d.ts +5 -0
  136. package/esm/{commands/subprocess/none → service/subprocess/shell}/index.d.ts.map +1 -1
  137. package/esm/service/subprocess/shell/index.js +6 -0
  138. package/esm/{commands/subprocess/none → service/subprocess/shell}/index.js.map +1 -1
  139. package/esm/{commands → service}/subprocess/shell/process.d.ts +2 -2
  140. package/esm/service/subprocess/shell/process.d.ts.map +1 -0
  141. package/esm/{commands → service}/subprocess/shell/process.js +4 -6
  142. package/esm/service/subprocess/shell/process.js.map +1 -0
  143. package/esm/{commands → service}/subprocess/shell/pty.d.ts +4 -4
  144. package/esm/service/subprocess/shell/pty.d.ts.map +1 -0
  145. package/esm/{commands → service}/subprocess/shell/pty.js +11 -9
  146. package/esm/service/subprocess/shell/pty.js.map +1 -0
  147. package/esm/service/subprocess/shell/service.d.ts +34 -0
  148. package/esm/service/subprocess/shell/service.d.ts.map +1 -0
  149. package/esm/service/subprocess/shell/service.js +52 -0
  150. package/esm/service/subprocess/shell/service.js.map +1 -0
  151. package/esm/service/subprocess/shell/shared.d.ts +2 -0
  152. package/esm/service/subprocess/shell/shared.d.ts.map +1 -0
  153. package/esm/{commands → service}/subprocess/shell/shared.js +2 -0
  154. package/esm/service/subprocess/shell/shared.js.map +1 -0
  155. package/esm/{commands → service}/subprocess/shell/spawner.d.ts +3 -7
  156. package/esm/service/subprocess/shell/spawner.d.ts.map +1 -0
  157. package/esm/service/subprocess/shell/spawner.js +45 -0
  158. package/esm/service/subprocess/shell/spawner.js.map +1 -0
  159. package/esm/service/subprocess/types.d.ts +14 -0
  160. package/esm/service/subprocess/types.d.ts.map +1 -0
  161. package/esm/service/subprocess/types.js +2 -0
  162. package/esm/service/subprocess/types.js.map +1 -0
  163. package/esm/service/subprocess/utils.d.ts +39 -0
  164. package/esm/service/subprocess/utils.d.ts.map +1 -0
  165. package/esm/service/subprocess/utils.js +142 -0
  166. package/esm/service/subprocess/utils.js.map +1 -0
  167. package/esm/service/sync/android.d.ts +34 -0
  168. package/esm/service/sync/android.d.ts.map +1 -0
  169. package/esm/service/sync/android.js +34 -0
  170. package/esm/service/sync/android.js.map +1 -0
  171. package/esm/service/sync/compression/compression.d.ts +17 -0
  172. package/esm/service/sync/compression/compression.d.ts.map +1 -0
  173. package/esm/service/sync/compression/compression.js +92 -0
  174. package/esm/service/sync/compression/compression.js.map +1 -0
  175. package/esm/service/sync/compression/format-ns.d.ts +5 -0
  176. package/esm/service/sync/compression/format-ns.d.ts.map +1 -0
  177. package/esm/service/sync/compression/format-ns.js +5 -0
  178. package/esm/service/sync/compression/format-ns.js.map +1 -0
  179. package/esm/service/sync/compression/format.d.ts +4 -0
  180. package/esm/service/sync/compression/format.d.ts.map +1 -0
  181. package/esm/service/sync/compression/format.js +3 -0
  182. package/esm/service/sync/compression/format.js.map +1 -0
  183. package/esm/service/sync/compression/index.d.ts +2 -0
  184. package/esm/service/sync/compression/index.d.ts.map +1 -0
  185. package/esm/service/sync/compression/index.js +2 -0
  186. package/esm/service/sync/compression/index.js.map +1 -0
  187. package/esm/service/sync/id/common.d.ts +17 -0
  188. package/esm/service/sync/id/common.d.ts.map +1 -0
  189. package/esm/service/sync/id/common.js +29 -0
  190. package/esm/service/sync/id/common.js.map +1 -0
  191. package/esm/service/sync/id/index.d.ts +4 -0
  192. package/esm/service/sync/id/index.d.ts.map +1 -0
  193. package/esm/service/sync/id/index.js +6 -0
  194. package/esm/service/sync/id/index.js.map +1 -0
  195. package/esm/service/sync/id/request.d.ts +7 -0
  196. package/esm/service/sync/id/request.d.ts.map +1 -0
  197. package/esm/service/sync/id/request.js +9 -0
  198. package/esm/service/sync/id/request.js.map +1 -0
  199. package/esm/service/sync/id/response.d.ts +6 -0
  200. package/esm/service/sync/id/response.d.ts.map +1 -0
  201. package/esm/service/sync/id/response.js +8 -0
  202. package/esm/service/sync/id/response.js.map +1 -0
  203. package/esm/service/sync/index-ns.d.ts +7 -0
  204. package/esm/service/sync/index-ns.d.ts.map +1 -0
  205. package/esm/service/sync/index-ns.js +7 -0
  206. package/esm/service/sync/index-ns.js.map +1 -0
  207. package/esm/service/sync/index.d.ts +3 -0
  208. package/esm/service/sync/index.d.ts.map +1 -0
  209. package/esm/service/sync/index.js +3 -0
  210. package/esm/service/sync/index.js.map +1 -0
  211. package/esm/service/sync/request/index.d.ts +5 -0
  212. package/esm/service/sync/request/index.d.ts.map +1 -0
  213. package/esm/service/sync/request/index.js +5 -0
  214. package/esm/service/sync/request/index.js.map +1 -0
  215. package/esm/{commands/sync → service/sync/request}/list.d.ts +21 -19
  216. package/esm/service/sync/request/list.d.ts.map +1 -0
  217. package/esm/service/sync/request/list.js +77 -0
  218. package/esm/service/sync/request/list.js.map +1 -0
  219. package/esm/service/sync/request/pull.d.ts +12 -0
  220. package/esm/service/sync/request/pull.d.ts.map +1 -0
  221. package/esm/service/sync/request/pull.js +28 -0
  222. package/esm/service/sync/request/pull.js.map +1 -0
  223. package/esm/service/sync/request/push.d.ts +54 -0
  224. package/esm/service/sync/request/push.d.ts.map +1 -0
  225. package/esm/service/sync/request/push.js +95 -0
  226. package/esm/service/sync/request/push.js.map +1 -0
  227. package/esm/{commands/sync → service/sync/request}/stat.d.ts +40 -50
  228. package/esm/service/sync/request/stat.d.ts.map +1 -0
  229. package/esm/service/sync/request/stat.js +89 -0
  230. package/esm/service/sync/request/stat.js.map +1 -0
  231. package/esm/service/sync/service.d.ts +123 -0
  232. package/esm/service/sync/service.d.ts.map +1 -0
  233. package/esm/service/sync/service.js +170 -0
  234. package/esm/service/sync/service.js.map +1 -0
  235. package/esm/service/sync/socket-pool.d.ts +11 -0
  236. package/esm/service/sync/socket-pool.d.ts.map +1 -0
  237. package/esm/service/sync/socket-pool.js +80 -0
  238. package/esm/service/sync/socket-pool.js.map +1 -0
  239. package/esm/service/sync/socket.d.ts +40 -0
  240. package/esm/service/sync/socket.d.ts.map +1 -0
  241. package/esm/service/sync/socket.js +153 -0
  242. package/esm/service/sync/socket.js.map +1 -0
  243. package/esm/{commands → service}/tcpip.d.ts +4 -2
  244. package/esm/service/tcpip.d.ts.map +1 -0
  245. package/esm/{commands → service}/tcpip.js +10 -7
  246. package/esm/service/tcpip.js.map +1 -0
  247. package/esm/utils/array-buffer.d.ts.map +1 -1
  248. package/esm/utils/array-buffer.js +2 -3
  249. package/esm/utils/array-buffer.js.map +1 -1
  250. package/esm/utils/base64.d.ts.map +1 -1
  251. package/esm/utils/base64.js +22 -12
  252. package/esm/utils/base64.js.map +1 -1
  253. package/esm/utils/index.d.ts +1 -0
  254. package/esm/utils/index.d.ts.map +1 -1
  255. package/esm/utils/index.js +1 -0
  256. package/esm/utils/index.js.map +1 -1
  257. package/esm/utils/md5.d.ts +8 -0
  258. package/esm/utils/md5.d.ts.map +1 -0
  259. package/esm/utils/md5.js +149 -0
  260. package/esm/utils/md5.js.map +1 -0
  261. package/package.json +10 -10
  262. package/src/adb.ts +44 -34
  263. package/src/daemon/auth/authenticator.ts +186 -0
  264. package/src/daemon/auth/index.ts +4 -0
  265. package/src/daemon/auth/packet-processor.ts +212 -0
  266. package/src/daemon/auth/public-key.ts +112 -0
  267. package/src/daemon/auth/type.ts +5 -0
  268. package/src/daemon/crypto.ts +36 -102
  269. package/src/daemon/dispatcher.ts +15 -8
  270. package/src/daemon/index.ts +1 -1
  271. package/src/daemon/socket.ts +3 -3
  272. package/src/daemon/transport.ts +35 -253
  273. package/src/device-observer.ts +3 -3
  274. package/src/features-value.ts +47 -0
  275. package/src/features.ts +31 -14
  276. package/src/index.ts +1 -1
  277. package/src/server/client.ts +96 -94
  278. package/src/server/commands/wireless.ts +1 -1
  279. package/src/server/{stream.ts → data-connection.ts} +4 -4
  280. package/src/server/index.ts +1 -1
  281. package/src/server/observer.ts +21 -19
  282. package/src/server/transport.ts +13 -34
  283. package/src/{commands → service}/index.ts +1 -2
  284. package/src/{commands → service}/power.ts +14 -5
  285. package/src/service/reverse/error.ts +35 -0
  286. package/src/service/reverse/index.ts +3 -0
  287. package/src/service/reverse/response.ts +38 -0
  288. package/src/{commands/reverse.ts → service/reverse/service.ts} +32 -72
  289. package/src/{commands → service}/subprocess/index.ts +1 -0
  290. package/src/{commands → service}/subprocess/none/process.ts +3 -3
  291. package/src/{commands → service}/subprocess/none/pty.ts +5 -5
  292. package/src/service/subprocess/none/service.ts +57 -0
  293. package/src/service/subprocess/none/spawner.ts +81 -0
  294. package/src/{commands → service}/subprocess/pty.ts +1 -1
  295. package/src/{commands → service}/subprocess/service.ts +1 -1
  296. package/src/{commands → service}/subprocess/shell/index.ts +1 -1
  297. package/src/{commands → service}/subprocess/shell/process.ts +6 -7
  298. package/src/{commands → service}/subprocess/shell/pty.ts +15 -13
  299. package/src/service/subprocess/shell/service.ts +75 -0
  300. package/src/{commands → service}/subprocess/shell/shared.ts +5 -0
  301. package/src/service/subprocess/shell/spawner.ts +109 -0
  302. package/src/service/subprocess/types.ts +19 -0
  303. package/src/service/subprocess/utils.ts +166 -0
  304. package/src/service/sync/android.ts +43 -0
  305. package/src/service/sync/compression/compression.ts +126 -0
  306. package/src/service/sync/compression/format-ns.ts +4 -0
  307. package/src/service/sync/compression/format.ts +5 -0
  308. package/src/service/sync/compression/index.ts +1 -0
  309. package/src/service/sync/id/common.ts +33 -0
  310. package/src/service/sync/id/index.ts +7 -0
  311. package/src/service/sync/id/request.ts +12 -0
  312. package/src/service/sync/id/response.ts +11 -0
  313. package/src/service/sync/index-ns.ts +6 -0
  314. package/src/service/sync/index.ts +2 -0
  315. package/src/service/sync/request/index.ts +4 -0
  316. package/src/service/sync/request/list.ts +110 -0
  317. package/src/service/sync/request/pull.ts +49 -0
  318. package/src/service/sync/request/push.ts +184 -0
  319. package/src/service/sync/request/stat.ts +127 -0
  320. package/src/service/sync/service.ts +255 -0
  321. package/src/service/sync/socket-pool.ts +97 -0
  322. package/src/service/sync/socket.ts +201 -0
  323. package/src/{commands → service}/tcpip.ts +13 -7
  324. package/src/utils/array-buffer.ts +2 -3
  325. package/src/utils/base64.ts +24 -12
  326. package/src/utils/index.ts +1 -0
  327. package/src/utils/md5.ts +185 -0
  328. package/yume-chan-adb-3.0.0-beta.0.tgz +0 -0
  329. package/CHANGELOG.md +0 -251
  330. package/esm/commands/base.d.ts +0 -8
  331. package/esm/commands/base.d.ts.map +0 -1
  332. package/esm/commands/base.js +0 -12
  333. package/esm/commands/base.js.map +0 -1
  334. package/esm/commands/framebuffer.d.ts.map +0 -1
  335. package/esm/commands/framebuffer.js.map +0 -1
  336. package/esm/commands/index.d.ts.map +0 -1
  337. package/esm/commands/index.js.map +0 -1
  338. package/esm/commands/power.d.ts.map +0 -1
  339. package/esm/commands/power.js.map +0 -1
  340. package/esm/commands/reverse.d.ts +0 -48
  341. package/esm/commands/reverse.d.ts.map +0 -1
  342. package/esm/commands/reverse.js.map +0 -1
  343. package/esm/commands/subprocess/index.d.ts.map +0 -1
  344. package/esm/commands/subprocess/index.js.map +0 -1
  345. package/esm/commands/subprocess/none/process.d.ts.map +0 -1
  346. package/esm/commands/subprocess/none/process.js.map +0 -1
  347. package/esm/commands/subprocess/none/pty.d.ts.map +0 -1
  348. package/esm/commands/subprocess/none/pty.js.map +0 -1
  349. package/esm/commands/subprocess/none/service.d.ts +0 -10
  350. package/esm/commands/subprocess/none/service.d.ts.map +0 -1
  351. package/esm/commands/subprocess/none/service.js +0 -34
  352. package/esm/commands/subprocess/none/service.js.map +0 -1
  353. package/esm/commands/subprocess/none/spawner.d.ts +0 -19
  354. package/esm/commands/subprocess/none/spawner.d.ts.map +0 -1
  355. package/esm/commands/subprocess/none/spawner.js +0 -26
  356. package/esm/commands/subprocess/none/spawner.js.map +0 -1
  357. package/esm/commands/subprocess/pty.d.ts.map +0 -1
  358. package/esm/commands/subprocess/service.d.ts.map +0 -1
  359. package/esm/commands/subprocess/service.js.map +0 -1
  360. package/esm/commands/subprocess/shell/index.d.ts +0 -6
  361. package/esm/commands/subprocess/shell/index.d.ts.map +0 -1
  362. package/esm/commands/subprocess/shell/index.js +0 -6
  363. package/esm/commands/subprocess/shell/index.js.map +0 -1
  364. package/esm/commands/subprocess/shell/process.d.ts.map +0 -1
  365. package/esm/commands/subprocess/shell/process.js.map +0 -1
  366. package/esm/commands/subprocess/shell/pty.d.ts.map +0 -1
  367. package/esm/commands/subprocess/shell/pty.js.map +0 -1
  368. package/esm/commands/subprocess/shell/service.d.ts +0 -14
  369. package/esm/commands/subprocess/shell/service.d.ts.map +0 -1
  370. package/esm/commands/subprocess/shell/service.js +0 -41
  371. package/esm/commands/subprocess/shell/service.js.map +0 -1
  372. package/esm/commands/subprocess/shell/shared.d.ts +0 -19
  373. package/esm/commands/subprocess/shell/shared.d.ts.map +0 -1
  374. package/esm/commands/subprocess/shell/shared.js.map +0 -1
  375. package/esm/commands/subprocess/shell/spawner.d.ts.map +0 -1
  376. package/esm/commands/subprocess/shell/spawner.js +0 -38
  377. package/esm/commands/subprocess/shell/spawner.js.map +0 -1
  378. package/esm/commands/subprocess/utils.d.ts +0 -3
  379. package/esm/commands/subprocess/utils.d.ts.map +0 -1
  380. package/esm/commands/subprocess/utils.js +0 -56
  381. package/esm/commands/subprocess/utils.js.map +0 -1
  382. package/esm/commands/sync/index.d.ts +0 -9
  383. package/esm/commands/sync/index.d.ts.map +0 -1
  384. package/esm/commands/sync/index.js +0 -9
  385. package/esm/commands/sync/index.js.map +0 -1
  386. package/esm/commands/sync/list.d.ts.map +0 -1
  387. package/esm/commands/sync/list.js +0 -64
  388. package/esm/commands/sync/list.js.map +0 -1
  389. package/esm/commands/sync/pull.d.ts +0 -12
  390. package/esm/commands/sync/pull.d.ts.map +0 -1
  391. package/esm/commands/sync/pull.js +0 -33
  392. package/esm/commands/sync/pull.js.map +0 -1
  393. package/esm/commands/sync/push.d.ts +0 -61
  394. package/esm/commands/sync/push.d.ts.map +0 -1
  395. package/esm/commands/sync/push.js +0 -83
  396. package/esm/commands/sync/push.js.map +0 -1
  397. package/esm/commands/sync/request.d.ts +0 -24
  398. package/esm/commands/sync/request.d.ts.map +0 -1
  399. package/esm/commands/sync/request.js +0 -32
  400. package/esm/commands/sync/request.js.map +0 -1
  401. package/esm/commands/sync/response.d.ts +0 -28
  402. package/esm/commands/sync/response.d.ts.map +0 -1
  403. package/esm/commands/sync/response.js +0 -81
  404. package/esm/commands/sync/response.js.map +0 -1
  405. package/esm/commands/sync/socket.d.ts +0 -22
  406. package/esm/commands/sync/socket.d.ts.map +0 -1
  407. package/esm/commands/sync/socket.js +0 -78
  408. package/esm/commands/sync/socket.js.map +0 -1
  409. package/esm/commands/sync/stat.d.ts.map +0 -1
  410. package/esm/commands/sync/stat.js +0 -121
  411. package/esm/commands/sync/stat.js.map +0 -1
  412. package/esm/commands/sync/sync.d.ts +0 -82
  413. package/esm/commands/sync/sync.d.ts.map +0 -1
  414. package/esm/commands/sync/sync.js +0 -138
  415. package/esm/commands/sync/sync.js.map +0 -1
  416. package/esm/commands/tcpip.d.ts.map +0 -1
  417. package/esm/commands/tcpip.js.map +0 -1
  418. package/esm/daemon/auth.d.ts +0 -54
  419. package/esm/daemon/auth.d.ts.map +0 -1
  420. package/esm/daemon/auth.js +0 -104
  421. package/esm/daemon/auth.js.map +0 -1
  422. package/esm/server/stream.d.ts.map +0 -1
  423. package/esm/server/stream.js.map +0 -1
  424. package/src/commands/base.ts +0 -15
  425. package/src/commands/subprocess/none/service.ts +0 -45
  426. package/src/commands/subprocess/none/spawner.ts +0 -68
  427. package/src/commands/subprocess/shell/service.ts +0 -58
  428. package/src/commands/subprocess/shell/spawner.ts +0 -90
  429. package/src/commands/subprocess/utils.ts +0 -61
  430. package/src/commands/sync/index.ts +0 -8
  431. package/src/commands/sync/list.ts +0 -99
  432. package/src/commands/sync/pull.ts +0 -55
  433. package/src/commands/sync/push.ts +0 -172
  434. package/src/commands/sync/request.ts +0 -53
  435. package/src/commands/sync/response.ts +0 -105
  436. package/src/commands/sync/socket.ts +0 -109
  437. package/src/commands/sync/stat.ts +0 -177
  438. package/src/commands/sync/sync.ts +0 -175
  439. package/src/daemon/auth.ts +0 -204
  440. package/tsconfig.build.tsbuildinfo +0 -1
  441. /package/esm/{commands → service}/framebuffer.d.ts +0 -0
  442. /package/esm/{commands → service}/framebuffer.js +0 -0
  443. /package/esm/{commands → service}/subprocess/none/index.d.ts +0 -0
  444. /package/esm/{commands → service}/subprocess/none/index.js +0 -0
  445. /package/esm/{commands → service}/subprocess/none/process.js +0 -0
  446. /package/esm/{commands → service}/subprocess/pty.js +0 -0
  447. /package/esm/{commands → service}/subprocess/service.d.ts +0 -0
  448. /package/src/{commands → service}/framebuffer.ts +0 -0
  449. /package/src/{commands → service}/subprocess/none/index.ts +0 -0
@@ -0,0 +1,34 @@
1
+ // https://github.com/python/cpython/blob/4e581d64b8aff3e2eda99b12f080c877bb78dfca/Lib/stat.py#L36
2
+ export const LinuxFileType = {
3
+ Directory: 0o04,
4
+ File: 0o10,
5
+ Link: 0o12,
6
+ };
7
+ export const AndroidSyscallErrorCode = {
8
+ SUCCESS: 0,
9
+ EACCES: 13,
10
+ EEXIST: 17,
11
+ EFAULT: 14,
12
+ EFBIG: 27,
13
+ EINTR: 4,
14
+ EINVAL: 22,
15
+ EIO: 5,
16
+ EISDIR: 21,
17
+ ELOOP: 40,
18
+ EMFILE: 24,
19
+ ENAMETOOLONG: 36,
20
+ ENFILE: 23,
21
+ ENOENT: 2,
22
+ ENOMEM: 12,
23
+ ENOSPC: 28,
24
+ ENOTDIR: 20,
25
+ EOVERFLOW: 75,
26
+ EPERM: 1,
27
+ EROFS: 30,
28
+ ETXTBSY: 26,
29
+ };
30
+ export const AndroidSyscallErrorNameMap = /* #__PURE__ */ (() => Object.fromEntries(Object.entries(AndroidSyscallErrorCode).map(([key, value]) => [
31
+ value,
32
+ key,
33
+ ])))();
34
+ //# sourceMappingURL=android.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"android.js","sourceRoot":"","sources":["../../../src/service/sync/android.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,MAAM,CAAC,MAAM,aAAa,GAAG;IACzB,SAAS,EAAE,IAAI;IACf,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI;CACJ,CAAC;AAIX,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACnC,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,EAAE;IACT,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,EAAE;IACV,GAAG,EAAE,CAAC;IACN,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE;IACV,YAAY,EAAE,EAAE;IAChB,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,EAAE;IACX,SAAS,EAAE,EAAE;IACb,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,EAAE;IACT,OAAO,EAAE,EAAE;CACL,CAAC;AAKX,MAAM,CAAC,MAAM,0BAA0B,GAAG,eAAe,CAAC,CAAC,GAAG,EAAE,CAC5D,MAAM,CAAC,WAAW,CACd,MAAM,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;IAC1D,KAAK;IACL,GAAG;CACN,CAAC,CACL,CAAC,EAAE,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { CompressionStream } from "@yume-chan/stream-extra";
2
+ import type { Adb } from "../../../adb.js";
3
+ import { Format } from "./format.js";
4
+ export { Format };
5
+ export declare const Mode: {
6
+ readonly Compress: 0;
7
+ readonly Decompress: 1;
8
+ };
9
+ export type Mode = (typeof Mode)[keyof typeof Mode];
10
+ export declare function hasRuntimeSupport(format: Format, mode: Mode): boolean;
11
+ export declare function canUseBrotli(adb: Adb, mode: Mode): boolean;
12
+ export declare function canUseLz4(adb: Adb, mode: Mode): boolean;
13
+ export declare function canUseZstd(adb: Adb, mode: Mode): boolean;
14
+ export declare function canUseFormat(adb: Adb, format: Format, mode: Mode): boolean;
15
+ export declare function chooseFormat(adb: Adb, mode: Mode): 0 | 3 | 4 | 2;
16
+ export declare function createCompressionStream(format: Format): CompressionStream;
17
+ //# sourceMappingURL=compression.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compression.d.ts","sourceRoot":"","sources":["../../../../src/service/sync/compression/compression.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,iBAAiB,EAGpB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAI3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB,eAAO,MAAM,IAAI;;;CAGP,CAAC;AAEX,MAAM,MAAM,IAAI,GAAG,CAAC,OAAO,IAAI,CAAC,CAAC,MAAM,OAAO,IAAI,CAAC,CAAC;AAepD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,WA4B3D;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,WAKhD;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,WAK7C;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,WAK9C;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,WAahE;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,iBAiBhD;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAMzE"}
@@ -0,0 +1,92 @@
1
+ import { CompressionStream, DecompressionStream, TransformStream, } from "@yume-chan/stream-extra";
2
+ import { AdbFeature } from "../../../features.js";
3
+ import { NOOP } from "../../../utils/no-op.js";
4
+ import { Format } from "./format.js";
5
+ export { Format };
6
+ export const Mode = {
7
+ Compress: 0,
8
+ Decompress: 1,
9
+ };
10
+ const FormatMap = {
11
+ [Format.None]: "",
12
+ // https://github.com/whatwg/compression/pull/80
13
+ [Format.Zstd]: "zstd",
14
+ // placeholder
15
+ [Format.Lz4]: "lz4",
16
+ // https://github.com/whatwg/compression/pull/80
17
+ [Format.Brotli]: "brotli",
18
+ };
19
+ const CompressionFormatCache = new Map();
20
+ const DecompressionFormatCache = new Map();
21
+ export function hasRuntimeSupport(format, mode) {
22
+ if (format === Format.None) {
23
+ return true;
24
+ }
25
+ const Cache = mode === Mode.Compress
26
+ ? CompressionFormatCache
27
+ : DecompressionFormatCache;
28
+ if (Cache.has(format)) {
29
+ return Cache.get(format);
30
+ }
31
+ const Stream = mode === Mode.Compress ? CompressionStream : DecompressionStream;
32
+ if (!Stream) {
33
+ return false;
34
+ }
35
+ try {
36
+ const stream = new Stream(FormatMap[format]);
37
+ void stream.writable.abort().catch(NOOP);
38
+ Cache.set(format, true);
39
+ return true;
40
+ }
41
+ catch {
42
+ Cache.set(format, false);
43
+ return false;
44
+ }
45
+ }
46
+ export function canUseBrotli(adb, mode) {
47
+ return (adb.canUseFeature(AdbFeature.SendReceive2Brotli) &&
48
+ hasRuntimeSupport(Format.Brotli, mode));
49
+ }
50
+ export function canUseLz4(adb, mode) {
51
+ return (adb.canUseFeature(AdbFeature.SendReceive2Lz4) &&
52
+ hasRuntimeSupport(Format.Lz4, mode));
53
+ }
54
+ export function canUseZstd(adb, mode) {
55
+ return (adb.canUseFeature(AdbFeature.SendReceive2Zstd) &&
56
+ hasRuntimeSupport(Format.Zstd, mode));
57
+ }
58
+ export function canUseFormat(adb, format, mode) {
59
+ switch (format) {
60
+ case Format.None:
61
+ return true;
62
+ case Format.Brotli:
63
+ return canUseBrotli(adb, mode);
64
+ case Format.Lz4:
65
+ return canUseLz4(adb, mode);
66
+ case Format.Zstd:
67
+ return canUseZstd(adb, mode);
68
+ default:
69
+ return false;
70
+ }
71
+ }
72
+ export function chooseFormat(adb, mode) {
73
+ // The order follows
74
+ // https://android.googlesource.com/platform/packages/modules/adb/+/3da39565cad412a743a58b94b875a43ed3c640d3/client/file_sync_client.cpp#277
75
+ if (canUseZstd(adb, mode)) {
76
+ return Format.Zstd;
77
+ }
78
+ if (canUseLz4(adb, mode)) {
79
+ return Format.Lz4;
80
+ }
81
+ if (canUseBrotli(adb, mode)) {
82
+ return Format.Brotli;
83
+ }
84
+ return Format.None;
85
+ }
86
+ export function createCompressionStream(format) {
87
+ if (format === Format.None) {
88
+ return new TransformStream();
89
+ }
90
+ return new CompressionStream(FormatMap[format]);
91
+ }
92
+ //# sourceMappingURL=compression.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compression.js","sourceRoot":"","sources":["../../../../src/service/sync/compression/compression.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,GAClB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE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SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAChC,KAAK,MAAM,CAAC,IAAI;YACZ,OAAO,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACjC;YACI,OAAO,KAAK,CAAC;IACrB,CAAC;AACL,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,GAAQ,EAAE,IAAU;IAC7C,oBAAoB;IACpB,4IAA4I;IAE5I,IAAI,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC;QACxB,OAAO,MAAM,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,IAAI,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC;QACvB,OAAO,MAAM,CAAC,GAAG,CAAC;IACtB,CAAC;IAED,IAAI,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC;QAC1B,OAAO,MAAM,CAAC,MAAM,CAAC;IACzB,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,MAAc;IAClD,IAAI,MAAM,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC;QACzB,OAAO,IAAI,eAAe,EAAE,CAAC;IACjC,CAAC;IAED,OAAO,IAAI,iBAAiB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;AACpD,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const None = 0;
2
+ export declare const Brotli = 2;
3
+ export declare const Lz4 = 3;
4
+ export declare const Zstd = 4;
5
+ //# sourceMappingURL=format-ns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-ns.d.ts","sourceRoot":"","sources":["../../../../src/service/sync/compression/format-ns.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,IAAI,CAAC;AACtB,eAAO,MAAM,MAAM,IAAI,CAAC;AACxB,eAAO,MAAM,GAAG,IAAI,CAAC;AACrB,eAAO,MAAM,IAAI,IAAI,CAAC"}
@@ -0,0 +1,5 @@
1
+ export const None = 0;
2
+ export const Brotli = 2;
3
+ export const Lz4 = 3;
4
+ export const Zstd = 4;
5
+ //# sourceMappingURL=format-ns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-ns.js","sourceRoot":"","sources":["../../../../src/service/sync/compression/format-ns.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC;AACtB,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAC;AACxB,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC;AACrB,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import * as Format from "./format-ns.js";
2
+ type Format = (typeof Format)[keyof typeof Format];
3
+ export { Format };
4
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../src/service/sync/compression/format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AAEzC,KAAK,MAAM,GAAG,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,OAAO,MAAM,CAAC,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ import * as Format from "./format-ns.js";
2
+ export { Format };
3
+ //# sourceMappingURL=format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.js","sourceRoot":"","sources":["../../../../src/service/sync/compression/format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AAIzC,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * as Compression from "./compression.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/service/sync/compression/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * as Compression from "./compression.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/service/sync/compression/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Encode ID to numbers for faster comparison.
3
+ *
4
+ * This function skips all checks. The caller must ensure the input is valid.
5
+ *
6
+ * @param value A 4 ASCII character string.
7
+ * @returns A 32-bit integer by encoding the string as little-endian
8
+ *
9
+ * #__NO_SIDE_EFFECTS__
10
+ */
11
+ export declare function encodeId(value: string): number;
12
+ export declare const Lstat: number;
13
+ export declare const Stat: number;
14
+ export declare const LstatV2: number;
15
+ export declare const Done: number;
16
+ export declare const Data: number;
17
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/service/sync/id/common.ts"],"names":[],"mappings":"AAUA;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAG9C;AAID,eAAO,MAAM,KAAK,QAAmB,CAAC;AACtC,eAAO,MAAM,IAAI,QAAmB,CAAC;AACrC,eAAO,MAAM,OAAO,QAAmB,CAAC;AAExC,eAAO,MAAM,IAAI,QAAmB,CAAC;AACrC,eAAO,MAAM,IAAI,QAAmB,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { getUint32LittleEndian } from "@yume-chan/no-data-view";
2
+ function encodeAsciiUnchecked(value) {
3
+ const result = new Uint8Array(value.length);
4
+ for (let i = 0; i < value.length; i += 1) {
5
+ result[i] = value.charCodeAt(i);
6
+ }
7
+ return result;
8
+ }
9
+ /**
10
+ * Encode ID to numbers for faster comparison.
11
+ *
12
+ * This function skips all checks. The caller must ensure the input is valid.
13
+ *
14
+ * @param value A 4 ASCII character string.
15
+ * @returns A 32-bit integer by encoding the string as little-endian
16
+ *
17
+ * #__NO_SIDE_EFFECTS__
18
+ */
19
+ export function encodeId(value) {
20
+ const buffer = encodeAsciiUnchecked(value);
21
+ return getUint32LittleEndian(buffer, 0);
22
+ }
23
+ // https://cs.android.com/android/platform/superproject/main/+/main:packages/modules/adb/file_sync_protocol.h;l=23;drc=888a54dcbf954fdffacc8283a793290abcc589cd
24
+ export const Lstat = encodeId("STAT");
25
+ export const Stat = encodeId("STA2");
26
+ export const LstatV2 = encodeId("LST2");
27
+ export const Done = encodeId("DONE");
28
+ export const Data = encodeId("DATA");
29
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/service/sync/id/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,SAAS,oBAAoB,CAAC,KAAa;IACvC,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACvC,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACpC,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAa;IAClC,MAAM,MAAM,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAC3C,OAAO,qBAAqB,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AAC5C,CAAC;AAED,+JAA+J;AAE/J,MAAM,CAAC,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;AACtC,MAAM,CAAC,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;AACrC,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;AAExC,MAAM,CAAC,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;AACrC,MAAM,CAAC,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import * as RequestId from "./request.js";
2
+ import * as ResponseId from "./response.js";
3
+ export { RequestId, ResponseId };
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/service/sync/id/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAK5C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC"}
@@ -0,0 +1,6 @@
1
+ import * as RequestId from "./request.js";
2
+ import * as ResponseId from "./response.js";
3
+ // Values of `RequestId` and `ResponseId` are all generic `number`s
4
+ // so there is no point creating types for them
5
+ export { RequestId, ResponseId };
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/service/sync/id/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAE5C,mEAAmE;AACnE,+CAA+C;AAE/C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { Data, Done, Lstat, LstatV2, Stat } from "./common.js";
2
+ export declare const List: number;
3
+ export declare const ListV2: number;
4
+ export declare const Send: number;
5
+ export declare const SendV2: number;
6
+ export declare const Receive: number;
7
+ //# sourceMappingURL=request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../../src/service/sync/id/request.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAI/D,eAAO,MAAM,IAAI,QAAmB,CAAC;AACrC,eAAO,MAAM,MAAM,QAAmB,CAAC;AAEvC,eAAO,MAAM,IAAI,QAAmB,CAAC;AACrC,eAAO,MAAM,MAAM,QAAmB,CAAC;AACvC,eAAO,MAAM,OAAO,QAAmB,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { encodeId } from "./common.js";
2
+ export { Data, Done, Lstat, LstatV2, Stat } from "./common.js";
3
+ // https://cs.android.com/android/platform/superproject/main/+/main:packages/modules/adb/file_sync_protocol.h;l=23;drc=888a54dcbf954fdffacc8283a793290abcc589cd
4
+ export const List = encodeId("LIST");
5
+ export const ListV2 = encodeId("LIS2");
6
+ export const Send = encodeId("SEND");
7
+ export const SendV2 = encodeId("SND2");
8
+ export const Receive = encodeId("RECV");
9
+ //# sourceMappingURL=request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../src/service/sync/id/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAE/D,+JAA+J;AAE/J,MAAM,CAAC,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;AACrC,MAAM,CAAC,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;AAEvC,MAAM,CAAC,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;AACrC,MAAM,CAAC,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;AACvC,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { Data, Done, Lstat, LstatV2, Stat } from "./common.js";
2
+ export declare const Entry: number;
3
+ export declare const EntryV2: number;
4
+ export declare const Ok: number;
5
+ export declare const Fail: number;
6
+ //# sourceMappingURL=response.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../../../src/service/sync/id/response.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAI/D,eAAO,MAAM,KAAK,QAAmB,CAAC;AACtC,eAAO,MAAM,OAAO,QAAmB,CAAC;AAExC,eAAO,MAAM,EAAE,QAAmB,CAAC;AACnC,eAAO,MAAM,IAAI,QAAmB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { encodeId } from "./common.js";
2
+ export { Data, Done, Lstat, LstatV2, Stat } from "./common.js";
3
+ // https://cs.android.com/android/platform/superproject/main/+/main:packages/modules/adb/file_sync_protocol.h;l=23;drc=888a54dcbf954fdffacc8283a793290abcc589cd
4
+ export const Entry = encodeId("DENT");
5
+ export const EntryV2 = encodeId("DNT2");
6
+ export const Ok = encodeId("OKAY");
7
+ export const Fail = encodeId("FAIL");
8
+ //# sourceMappingURL=response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.js","sourceRoot":"","sources":["../../../../src/service/sync/id/response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAE/D,+JAA+J;AAE/J,MAAM,CAAC,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;AACtC,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;AAExC,MAAM,CAAC,MAAM,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;AACnC,MAAM,CAAC,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export * from "./compression/index.js";
2
+ export * from "./id/index.js";
3
+ export * from "./request/index.js";
4
+ export * from "./service.js";
5
+ export * from "./socket-pool.js";
6
+ export * from "./socket.js";
7
+ //# sourceMappingURL=index-ns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-ns.d.ts","sourceRoot":"","sources":["../../../src/service/sync/index-ns.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC"}
@@ -0,0 +1,7 @@
1
+ export * from "./compression/index.js";
2
+ export * from "./id/index.js";
3
+ export * from "./request/index.js";
4
+ export * from "./service.js";
5
+ export * from "./socket-pool.js";
6
+ export * from "./socket.js";
7
+ //# sourceMappingURL=index-ns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-ns.js","sourceRoot":"","sources":["../../../src/service/sync/index-ns.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./android.js";
2
+ export * as AdbSync from "./index-ns.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/service/sync/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./android.js";
2
+ export * as AdbSync from "./index-ns.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/service/sync/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * as OpenDir from "./list.js";
2
+ export * as Receive from "./pull.js";
3
+ export * as Send from "./push.js";
4
+ export * as Stat from "./stat.js";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/service/sync/request/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * as OpenDir from "./list.js";
2
+ export * as Receive from "./pull.js";
3
+ export * as Send from "./push.js";
4
+ export * as Stat from "./stat.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/service/sync/request/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC"}
@@ -1,18 +1,15 @@
1
1
  import type { StructValue } from "@yume-chan/struct";
2
- import type { AdbSyncSocket } from "./socket.js";
3
- import type { AdbSyncStat } from "./stat.js";
4
- import { AdbSyncStatErrorCode } from "./stat.js";
5
- export interface AdbSyncEntry extends AdbSyncStat {
6
- name: string;
7
- }
8
- export declare const AdbSyncEntryResponse: import("@yume-chan/struct").Struct<{
2
+ import { AndroidSyscallErrorCode } from "../android.js";
3
+ import type { SocketPool } from "../socket-pool.js";
4
+ import type { Stat } from "./stat.js";
5
+ export declare const EntryResponse: import("@yume-chan/struct").Struct<{
9
6
  mode: import("@yume-chan/struct").NumberField<number>;
10
7
  size: import("@yume-chan/struct").NumberField<number>;
11
8
  mtime: import("@yume-chan/struct").NumberField<number>;
12
9
  } & {
13
10
  name: import("@yume-chan/struct").Field<string, string, never, string>;
14
11
  }, {
15
- readonly type: import("./stat.js").LinuxFileType;
12
+ readonly type: import("../android.js").LinuxFileType;
16
13
  readonly permission: number;
17
14
  }, import("@yume-chan/struct").FieldsValue<{
18
15
  mode: import("@yume-chan/struct").NumberField<number>;
@@ -21,12 +18,13 @@ export declare const AdbSyncEntryResponse: import("@yume-chan/struct").Struct<{
21
18
  } & {
22
19
  name: import("@yume-chan/struct").Field<string, string, never, string>;
23
20
  }> & {
24
- readonly type: import("./stat.js").LinuxFileType;
21
+ readonly type: import("../android.js").LinuxFileType;
25
22
  readonly permission: number;
26
23
  }>;
27
- export type AdbSyncEntryResponse = StructValue<typeof AdbSyncEntryResponse>;
28
- export declare const AdbSyncEntry2Response: import("@yume-chan/struct").Struct<{
29
- error: import("@yume-chan/struct").Field<AdbSyncStatErrorCode, never, never, number>;
24
+ export type EntryResponse = StructValue<typeof EntryResponse>;
25
+ export declare function v1(pool: SocketPool, path: string): AsyncGenerator<EntryResponse, void, void>;
26
+ export declare const EntryV2Response: import("@yume-chan/struct").Struct<{
27
+ error: import("@yume-chan/struct").Field<AndroidSyscallErrorCode, never, never, number>;
30
28
  dev: import("@yume-chan/struct").NumberField<bigint>;
31
29
  ino: import("@yume-chan/struct").NumberField<bigint>;
32
30
  mode: import("@yume-chan/struct").NumberField<number>;
@@ -40,10 +38,10 @@ export declare const AdbSyncEntry2Response: import("@yume-chan/struct").Struct<{
40
38
  } & {
41
39
  name: import("@yume-chan/struct").Field<string, string, never, string>;
42
40
  }, {
43
- readonly type: import("./stat.js").LinuxFileType;
41
+ readonly type: import("../android.js").LinuxFileType;
44
42
  readonly permission: number;
45
43
  }, import("@yume-chan/struct").FieldsValue<{
46
- error: import("@yume-chan/struct").Field<AdbSyncStatErrorCode, never, never, number>;
44
+ error: import("@yume-chan/struct").Field<AndroidSyscallErrorCode, never, never, number>;
47
45
  dev: import("@yume-chan/struct").NumberField<bigint>;
48
46
  ino: import("@yume-chan/struct").NumberField<bigint>;
49
47
  mode: import("@yume-chan/struct").NumberField<number>;
@@ -57,11 +55,15 @@ export declare const AdbSyncEntry2Response: import("@yume-chan/struct").Struct<{
57
55
  } & {
58
56
  name: import("@yume-chan/struct").Field<string, string, never, string>;
59
57
  }> & {
60
- readonly type: import("./stat.js").LinuxFileType;
58
+ readonly type: import("../android.js").LinuxFileType;
61
59
  readonly permission: number;
62
60
  }>;
63
- export type AdbSyncEntry2Response = StructValue<typeof AdbSyncEntry2Response>;
64
- export declare function adbSyncOpenDirV2(socket: AdbSyncSocket, path: string): AsyncGenerator<AdbSyncEntry2Response, void, void>;
65
- export declare function adbSyncOpenDirV1(socket: AdbSyncSocket, path: string): AsyncGenerator<AdbSyncEntryResponse, void, void>;
66
- export declare function adbSyncOpenDir(socket: AdbSyncSocket, path: string, v2: boolean): AsyncGenerator<AdbSyncEntry, void, void>;
61
+ export type EntryV2Response = StructValue<typeof EntryV2Response>;
62
+ export declare function v2(pool: SocketPool, path: string): AsyncGenerator<EntryV2Response, void, void>;
63
+ export interface Entry extends Stat {
64
+ name: string;
65
+ }
66
+ export declare function opendir(pool: SocketPool, path: string, { version }: {
67
+ version: 1 | 2;
68
+ }): AsyncGenerator<Entry, void, void>;
67
69
  //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/service/sync/request/list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGpD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGtC,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;EAExB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,aAAa,CAAC,CAAC;AAE9D,wBAAuB,EAAE,CACrB,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,GACb,cAAc,CAAC,aAAa,EAAE,IAAI,EAAE,IAAI,CAAC,CAkB3C;AAED,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAE1B,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,OAAO,eAAe,CAAC,CAAC;AAElE,wBAAuB,EAAE,CACrB,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,GACb,cAAc,CAAC,eAAe,EAAE,IAAI,EAAE,IAAI,CAAC,CA6B7C;AAED,MAAM,WAAW,KAAM,SAAQ,IAAI;IAC/B,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,wBAAuB,OAAO,CAC1B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,EACZ,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CAAA;CAAE,GAChC,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAqBnC"}
@@ -0,0 +1,77 @@
1
+ import { extend, string, u32 } from "@yume-chan/struct";
2
+ import { AndroidSyscallErrorCode } from "../android.js";
3
+ import { RequestId, ResponseId } from "../id/index.js";
4
+ import { Error as AdbSyncError } from "../socket.js";
5
+ import { LstatResponse, StatResponse } from "./stat.js";
6
+ export const EntryResponse = extend(LstatResponse, {
7
+ name: string(u32),
8
+ });
9
+ export async function* v1(pool, path) {
10
+ const socket = await pool.acquire();
11
+ let completed = false;
12
+ let error;
13
+ try {
14
+ await socket.writeRequest(RequestId.List, path);
15
+ yield* socket.readResponses(ResponseId.Entry, EntryResponse);
16
+ completed = true;
17
+ }
18
+ catch (e) {
19
+ error = e;
20
+ throw e;
21
+ }
22
+ finally {
23
+ await pool.release(socket, !(completed || error instanceof AdbSyncError));
24
+ }
25
+ }
26
+ export const EntryV2Response = extend(StatResponse, {
27
+ name: string(u32),
28
+ });
29
+ export async function* v2(pool, path) {
30
+ const socket = await pool.acquire();
31
+ let completed = false;
32
+ let error;
33
+ try {
34
+ await socket.writeRequest(RequestId.ListV2, path);
35
+ for await (const item of socket.readResponses(ResponseId.EntryV2, EntryV2Response)) {
36
+ // `LST2` can return error codes for failed `lstat` calls.
37
+ // `LIST` just ignores them.
38
+ // But they only contain `name` so still pretty useless.
39
+ if (item.error !== AndroidSyscallErrorCode.SUCCESS) {
40
+ continue;
41
+ }
42
+ yield item;
43
+ }
44
+ completed = true;
45
+ }
46
+ catch (e) {
47
+ error = e;
48
+ throw e;
49
+ }
50
+ finally {
51
+ await pool.release(socket, !(completed || error instanceof AdbSyncError));
52
+ }
53
+ }
54
+ export async function* opendir(pool, path, { version }) {
55
+ if (version === 2) {
56
+ yield* v2(pool, path);
57
+ }
58
+ else {
59
+ for await (const item of v1(pool, path)) {
60
+ // Convert to same format as `AdbSyncEntry2Response` for easier consumption.
61
+ // However it will add some overhead.
62
+ yield {
63
+ mode: item.mode,
64
+ size: BigInt(item.size),
65
+ mtime: BigInt(item.mtime),
66
+ get type() {
67
+ return item.type;
68
+ },
69
+ get permission() {
70
+ return item.permission;
71
+ },
72
+ name: item.name,
73
+ };
74
+ }
75
+ }
76
+ }
77
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/service/sync/request/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;A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CAAC,IAAI,CAAC,KAAK,CAAC;gBACzB,IAAI,IAAI;oBACJ,OAAO,IAAI,CAAC,IAAI,CAAC;gBACrB,CAAC;gBACD,IAAI,UAAU;oBACV,OAAO,IAAI,CAAC,UAAU,CAAC;gBAC3B,CAAC;gBACD,IAAI,EAAE,IAAI,CAAC,IAAI;aAClB,CAAC;QACN,CAAC;IACL,CAAC;AACL,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { ReadableStream } from "@yume-chan/stream-extra";
2
+ import type { StructValue } from "@yume-chan/struct";
3
+ import type { SocketPool } from "../socket-pool.js";
4
+ export declare const DataResponse: import("@yume-chan/struct").Struct<{
5
+ data: import("@yume-chan/struct").Field<Uint8Array<ArrayBufferLike>, string, never, Uint8Array<ArrayBufferLike>>;
6
+ }, undefined, import("@yume-chan/struct").FieldsValue<{
7
+ data: import("@yume-chan/struct").Field<Uint8Array<ArrayBufferLike>, string, never, Uint8Array<ArrayBufferLike>>;
8
+ }>>;
9
+ export type DataResponse = StructValue<typeof DataResponse>;
10
+ export declare function generator(pool: SocketPool, path: string): AsyncGenerator<Uint8Array, void, void>;
11
+ export declare function stream(pool: SocketPool, path: string): ReadableStream<Uint8Array>;
12
+ //# sourceMappingURL=pull.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pull.d.ts","sourceRoot":"","sources":["../../../../src/service/sync/request/pull.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGpD,eAAO,MAAM,YAAY;;;;GAGxB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,OAAO,YAAY,CAAC,CAAC;AAE5D,wBAAuB,SAAS,CAC5B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,GACb,cAAc,CAAC,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,CAuBxC;AAED,wBAAgB,MAAM,CAClB,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,GACb,cAAc,CAAC,UAAU,CAAC,CAE5B"}