appium-uiautomator2-driver 2.42.2 → 2.43.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 (114) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/build/lib/commands/actions.d.ts +22 -1
  3. package/build/lib/commands/actions.d.ts.map +1 -1
  4. package/build/lib/commands/actions.js +30 -62
  5. package/build/lib/commands/actions.js.map +1 -1
  6. package/build/lib/commands/alert.d.ts +28 -1
  7. package/build/lib/commands/alert.d.ts.map +1 -1
  8. package/build/lib/commands/alert.js +42 -23
  9. package/build/lib/commands/alert.js.map +1 -1
  10. package/build/lib/commands/app-management.d.ts +19 -0
  11. package/build/lib/commands/app-management.d.ts.map +1 -0
  12. package/build/lib/commands/app-management.js +45 -0
  13. package/build/lib/commands/app-management.js.map +1 -0
  14. package/build/lib/commands/app-strings.d.ts +9 -0
  15. package/build/lib/commands/app-strings.d.ts.map +1 -1
  16. package/build/lib/commands/app-strings.js +11 -79
  17. package/build/lib/commands/app-strings.js.map +1 -1
  18. package/build/lib/commands/battery.d.ts +7 -0
  19. package/build/lib/commands/battery.d.ts.map +1 -1
  20. package/build/lib/commands/battery.js +14 -20
  21. package/build/lib/commands/battery.js.map +1 -1
  22. package/build/lib/commands/element.d.ts +100 -1
  23. package/build/lib/commands/element.d.ts.map +1 -1
  24. package/build/lib/commands/element.js +175 -125
  25. package/build/lib/commands/element.js.map +1 -1
  26. package/build/lib/commands/execute.d.ts +25 -0
  27. package/build/lib/commands/execute.d.ts.map +1 -0
  28. package/build/lib/commands/execute.js +109 -0
  29. package/build/lib/commands/execute.js.map +1 -0
  30. package/build/lib/commands/find.d.ts +10 -0
  31. package/build/lib/commands/find.d.ts.map +1 -1
  32. package/build/lib/commands/find.js +25 -27
  33. package/build/lib/commands/find.js.map +1 -1
  34. package/build/lib/commands/gestures.d.ts +103 -1
  35. package/build/lib/commands/gestures.d.ts.map +1 -1
  36. package/build/lib/commands/gestures.js +202 -173
  37. package/build/lib/commands/gestures.js.map +1 -1
  38. package/build/lib/commands/keyboard.d.ts +47 -0
  39. package/build/lib/commands/keyboard.d.ts.map +1 -0
  40. package/build/lib/commands/keyboard.js +92 -0
  41. package/build/lib/commands/keyboard.js.map +1 -0
  42. package/build/lib/commands/misc.d.ts +48 -0
  43. package/build/lib/commands/misc.d.ts.map +1 -0
  44. package/build/lib/commands/misc.js +75 -0
  45. package/build/lib/commands/misc.js.map +1 -0
  46. package/build/lib/commands/navigation.d.ts +20 -0
  47. package/build/lib/commands/navigation.d.ts.map +1 -0
  48. package/build/lib/commands/navigation.js +35 -0
  49. package/build/lib/commands/navigation.js.map +1 -0
  50. package/build/lib/commands/screenshot.d.ts +24 -1
  51. package/build/lib/commands/screenshot.d.ts.map +1 -1
  52. package/build/lib/commands/screenshot.js +87 -64
  53. package/build/lib/commands/screenshot.js.map +1 -1
  54. package/build/lib/commands/touch.d.ts +81 -0
  55. package/build/lib/commands/touch.d.ts.map +1 -1
  56. package/build/lib/commands/touch.js +158 -41
  57. package/build/lib/commands/touch.js.map +1 -1
  58. package/build/lib/commands/viewport.d.ts +37 -1
  59. package/build/lib/commands/viewport.d.ts.map +1 -1
  60. package/build/lib/commands/viewport.js +80 -36
  61. package/build/lib/commands/viewport.js.map +1 -1
  62. package/build/lib/driver.d.ts +94 -24
  63. package/build/lib/driver.d.ts.map +1 -1
  64. package/build/lib/driver.js +114 -28
  65. package/build/lib/driver.js.map +1 -1
  66. package/build/lib/helpers.d.ts +12 -6
  67. package/build/lib/helpers.d.ts.map +1 -1
  68. package/build/lib/helpers.js +18 -18
  69. package/build/lib/helpers.js.map +1 -1
  70. package/build/lib/method-map.d.ts +0 -23
  71. package/build/lib/method-map.d.ts.map +1 -1
  72. package/build/lib/uiautomator2.js +3 -3
  73. package/build/lib/uiautomator2.js.map +1 -1
  74. package/build/tsconfig.tsbuildinfo +1 -1
  75. package/lib/commands/actions.js +37 -114
  76. package/lib/commands/alert.js +51 -37
  77. package/lib/commands/app-management.js +42 -0
  78. package/lib/commands/app-strings.js +9 -89
  79. package/lib/commands/battery.js +16 -26
  80. package/lib/commands/element.js +235 -214
  81. package/lib/commands/execute.js +120 -0
  82. package/lib/commands/find.js +31 -37
  83. package/lib/commands/gestures.js +252 -234
  84. package/lib/commands/keyboard.js +103 -0
  85. package/lib/commands/misc.js +106 -0
  86. package/lib/commands/navigation.js +31 -0
  87. package/lib/commands/screenshot.js +96 -77
  88. package/lib/commands/touch.js +190 -48
  89. package/lib/commands/viewport.js +100 -50
  90. package/lib/driver.ts +225 -36
  91. package/lib/helpers.js +15 -22
  92. package/lib/uiautomator2.js +3 -3
  93. package/npm-shrinkwrap.json +31 -31
  94. package/package.json +2 -2
  95. package/build/lib/commands/general.d.ts +0 -4
  96. package/build/lib/commands/general.d.ts.map +0 -1
  97. package/build/lib/commands/general.js +0 -214
  98. package/build/lib/commands/general.js.map +0 -1
  99. package/build/lib/commands/index.d.ts +0 -2
  100. package/build/lib/commands/index.d.ts.map +0 -1
  101. package/build/lib/commands/index.js +0 -14
  102. package/build/lib/commands/index.js.map +0 -1
  103. package/build/lib/commands/mixins.d.ts +0 -87
  104. package/build/lib/commands/mixins.d.ts.map +0 -1
  105. package/build/lib/commands/mixins.js +0 -26
  106. package/build/lib/commands/mixins.js.map +0 -1
  107. package/build/lib/utils.d.ts +0 -10
  108. package/build/lib/utils.d.ts.map +0 -1
  109. package/build/lib/utils.js +0 -26
  110. package/build/lib/utils.js.map +0 -1
  111. package/lib/commands/general.js +0 -289
  112. package/lib/commands/index.js +0 -11
  113. package/lib/commands/mixins.ts +0 -169
  114. package/lib/utils.js +0 -19
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [2.43.0](https://github.com/appium/appium-uiautomator2-driver/compare/v2.42.2...v2.43.0) (2024-01-25)
2
+
3
+
4
+ ### Features
5
+
6
+ * Update android-driver ([#720](https://github.com/appium/appium-uiautomator2-driver/issues/720)) ([f352359](https://github.com/appium/appium-uiautomator2-driver/commit/f35235970904fd89f736b4fdd9a8635858719edb))
7
+
1
8
  ## [2.42.2](https://github.com/appium/appium-uiautomator2-driver/compare/v2.42.1...v2.42.2) (2024-01-23)
2
9
 
3
10
 
@@ -1,2 +1,23 @@
1
- export type UiAutomator2Server = import('../uiautomator2').UiAutomator2Server;
1
+ /**
2
+ * See https://github.com/appium/appium-uiautomator2-driver/blob/master/docs/scheduled-actions.md#mobile-scheduleaction
3
+ * @this {AndroidUiautomator2Driver}
4
+ * @param {Record<string, any>} [opts={}]
5
+ * @returns {Promise<any>}
6
+ */
7
+ export function mobileScheduleAction(this: import("../driver").AndroidUiautomator2Driver, opts?: Record<string, any> | undefined): Promise<any>;
8
+ /**
9
+ * @see https://github.com/appium/appium-uiautomator2-driver/blob/master/docs/scheduled-actions.md#mobile-getactionhistory
10
+ * @this {AndroidUiautomator2Driver}
11
+ * @param {import('./types').ActionArgs} [opts={}]
12
+ * @returns {Promise<import('./types').ActionResult>}
13
+ */
14
+ export function mobileGetActionHistory(this: import("../driver").AndroidUiautomator2Driver, opts?: import("./types").ActionArgs | undefined): Promise<import('./types').ActionResult>;
15
+ /**
16
+ * @this {AndroidUiautomator2Driver}
17
+ * @see https://github.com/appium/appium-uiautomator2-driver/blob/master/docs/scheduled-actions.md#mobile-unscheduleaction
18
+ * @param {import('./types').ActionArgs} [opts={}]
19
+ * @returns {Promise<any>}
20
+ */
21
+ export function mobileUnscheduleAction(this: import("../driver").AndroidUiautomator2Driver, opts?: import("./types").ActionArgs | undefined): Promise<any>;
22
+ export type AndroidUiautomator2Driver = import('../driver').AndroidUiautomator2Driver;
2
23
  //# sourceMappingURL=actions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../lib/commands/actions.js"],"names":[],"mappings":"iCA0Ha,OAAO,iBAAiB,EAAE,kBAAkB"}
1
+ {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../lib/commands/actions.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,mIAFa,QAAQ,GAAG,CAAC,CAQxB;AAED;;;;;GAKG;AACH,8IAFa,QAAQ,OAAO,SAAS,EAAE,YAAY,CAAC,CAUnD;AAED;;;;;GAKG;AACH,8IAFa,QAAQ,GAAG,CAAC,CAQxB;wCAGY,OAAO,WAAW,EAAE,yBAAyB"}
@@ -1,69 +1,37 @@
1
1
  "use strict";
2
- // @ts-check
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
- const mixins_1 = require("./mixins");
3
+ exports.mobileUnscheduleAction = exports.mobileGetActionHistory = exports.mobileScheduleAction = void 0;
5
4
  /**
6
- * @type {import('./mixins').UIA2ActionsMixin}
7
- * @satisfies {import('@appium/types').ExternalDriver}
5
+ * See https://github.com/appium/appium-uiautomator2-driver/blob/master/docs/scheduled-actions.md#mobile-scheduleaction
6
+ * @this {AndroidUiautomator2Driver}
7
+ * @param {Record<string, any>} [opts={}]
8
+ * @returns {Promise<any>}
8
9
  */
9
- const ActionsMixin = {
10
- async pressKeyCode(keycode, metastate, flags) {
11
- await this.uiautomator2.jwproxy.command('/appium/device/press_keycode', 'POST', {
12
- keycode,
13
- metastate,
14
- flags,
15
- });
16
- },
17
- async longPressKeyCode(keycode, metastate, flags) {
18
- await this.uiautomator2.jwproxy.command('/appium/device/long_press_keycode', 'POST', {
19
- keycode,
20
- metastate,
21
- flags,
22
- });
23
- },
24
- async doSwipe(swipeOpts) {
25
- await this.uiautomator2.jwproxy.command(`/touch/perform`, 'POST', swipeOpts);
26
- },
27
- async doDrag(dragOpts) {
28
- await this.uiautomator2.jwproxy.command(`/touch/drag`, 'POST', dragOpts);
29
- },
30
- async getOrientation() {
31
- return /** @type {import('@appium/types').Orientation} */ (await this.uiautomator2.jwproxy.command(`/orientation`, 'GET', {}));
32
- },
33
- async setOrientation(orientation) {
34
- orientation = /** @type {import('@appium/types').Orientation} */ (orientation.toUpperCase());
35
- await this.uiautomator2.jwproxy.command(`/orientation`, 'POST', { orientation });
36
- },
37
- async mobilePressKey(opts) {
38
- const { keycode, metastate, flags, isLongPress = false } = opts;
39
- await this.uiautomator2.jwproxy.command(`/appium/device/${isLongPress ? 'long_' : ''}press_keycode`, 'POST', {
40
- keycode,
41
- metastate,
42
- flags,
43
- });
44
- },
45
- /**
46
- * See https://github.com/appium/appium-uiautomator2-driver/blob/master/docs/scheduled-actions.md#mobile-scheduleaction
47
- * @param {Record<string, any>} opts
48
- */
49
- async mobileScheduleAction(opts = {}) {
50
- return await this.uiautomator2.jwproxy.command('/appium/schedule_action', 'POST', opts);
51
- },
52
- /**
53
- * @see https://github.com/appium/appium-uiautomator2-driver/blob/master/docs/scheduled-actions.md#mobile-getactionhistory
54
- */
55
- async mobileGetActionHistory(opts) {
56
- return /** @type {import('./types').ActionResult} */ (await this.uiautomator2.jwproxy.command('/appium/action_history', 'POST', opts ?? {}));
57
- },
58
- /**
59
- * @see https://github.com/appium/appium-uiautomator2-driver/blob/master/docs/scheduled-actions.md#mobile-unscheduleaction
60
- */
61
- async mobileUnscheduleAction(opts) {
62
- return await this.uiautomator2.jwproxy.command('/appium/unschedule_action', 'POST', opts ?? {});
63
- },
64
- };
65
- (0, mixins_1.mixin)(ActionsMixin);
10
+ async function mobileScheduleAction(opts = {}) {
11
+ return await this.uiautomator2.jwproxy.command('/appium/schedule_action', 'POST', opts);
12
+ }
13
+ exports.mobileScheduleAction = mobileScheduleAction;
66
14
  /**
67
- * @typedef {import('../uiautomator2').UiAutomator2Server} UiAutomator2Server
15
+ * @see https://github.com/appium/appium-uiautomator2-driver/blob/master/docs/scheduled-actions.md#mobile-getactionhistory
16
+ * @this {AndroidUiautomator2Driver}
17
+ * @param {import('./types').ActionArgs} [opts={}]
18
+ * @returns {Promise<import('./types').ActionResult>}
19
+ */
20
+ async function mobileGetActionHistory(opts) {
21
+ return /** @type {import('./types').ActionResult} */ (await this.uiautomator2.jwproxy.command('/appium/action_history', 'POST', opts ?? {}));
22
+ }
23
+ exports.mobileGetActionHistory = mobileGetActionHistory;
24
+ /**
25
+ * @this {AndroidUiautomator2Driver}
26
+ * @see https://github.com/appium/appium-uiautomator2-driver/blob/master/docs/scheduled-actions.md#mobile-unscheduleaction
27
+ * @param {import('./types').ActionArgs} [opts={}]
28
+ * @returns {Promise<any>}
29
+ */
30
+ async function mobileUnscheduleAction(opts) {
31
+ return await this.uiautomator2.jwproxy.command('/appium/unschedule_action', 'POST', opts ?? {});
32
+ }
33
+ exports.mobileUnscheduleAction = mobileUnscheduleAction;
34
+ /**
35
+ * @typedef {import('../driver').AndroidUiautomator2Driver} AndroidUiautomator2Driver
68
36
  */
69
37
  //# sourceMappingURL=actions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../lib/commands/actions.js"],"names":[],"mappings":";AAAA,YAAY;;AAEZ,qCAA+B;AAE/B;;;GAGG;AACH,MAAM,YAAY,GAAG;IACnB,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK;QAC1C,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CACrC,8BAA8B,EAC9B,MAAM,EACN;YACE,OAAO;YACP,SAAS;YACT,KAAK;SACN,CACF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK;QAC9C,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CACrC,mCAAmC,EACnC,MAAM,EACN;YACE,OAAO;YACP,SAAS;YACT,KAAK;SACN,CACF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,SAAS;QACrB,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CACrC,gBAAgB,EAChB,MAAM,EACN,SAAS,CACV,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,QAAQ;QACnB,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CACrC,aAAa,EACb,MAAM,EACN,QAAQ,CACT,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,OAAO,kDAAkD,CAAC,CACxD,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CACrC,cAAc,EACd,KAAK,EACL,EAAE,CACH,CACF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,WAAW;QAC9B,WAAW,GAAG,kDAAkD,CAAC,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,CAAC;QAC7F,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CACrC,cAAc,EACd,MAAM,EACN,EAAC,WAAW,EAAC,CACd,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,IAAI;QACvB,MAAM,EAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,GAAG,KAAK,EAAC,GAAG,IAAI,CAAC;QAE9D,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CACrC,kBAAkB,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,eAAe,EAC3D,MAAM,EACN;YACE,OAAO;YACP,SAAS;YACT,KAAK;SACN,CACF,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,oBAAoB,CAAC,IAAI,GAAG,EAAE;QAClC,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAC5C,yBAAyB,EACzB,MAAM,EACN,IAAI,CACL,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,sBAAsB,CAAC,IAAI;QAC/B,OAAO,6CAA6C,CAAC,CACnD,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CACrC,wBAAwB,EACxB,MAAM,EACN,IAAI,IAAI,EAAE,CACX,CACF,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,sBAAsB,CAAC,IAAI;QAC/B,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAC5C,2BAA2B,EAC3B,MAAM,EACN,IAAI,IAAI,EAAE,CACX,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,IAAA,cAAK,EAAC,YAAY,CAAC,CAAC;AAEpB;;GAEG"}
1
+ {"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../lib/commands/actions.js"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACI,KAAK,UAAU,oBAAoB,CAAC,IAAI,GAAG,EAAE;IAClD,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAC5C,yBAAyB,EACzB,MAAM,EACN,IAAI,CACL,CAAC;AACJ,CAAC;AAND,oDAMC;AAED;;;;;GAKG;AACI,KAAK,UAAU,sBAAsB,CAAC,IAAI;IAC/C,OAAO,6CAA6C,CAAC,CACnD,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CACrC,wBAAwB,EACxB,MAAM,EACN,IAAI,IAAI,EAAE,CACX,CACF,CAAC;AACJ,CAAC;AARD,wDAQC;AAED;;;;;GAKG;AACI,KAAK,UAAU,sBAAsB,CAAC,IAAI;IAC/C,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAC5C,2BAA2B,EAC3B,MAAM,EACN,IAAI,IAAI,EAAE,CACX,CAAC;AACJ,CAAC;AAND,wDAMC;AAED;;GAEG"}
@@ -1,2 +1,29 @@
1
- export type UiAutomator2Server = import('../uiautomator2').UiAutomator2Server;
1
+ /**
2
+ * @this {AndroidUiautomator2Driver}
3
+ * @returns {Promise<string>}
4
+ */
5
+ export function getAlertText(this: import("../driver").AndroidUiautomator2Driver): Promise<string>;
6
+ /**
7
+ * @this {AndroidUiautomator2Driver}
8
+ * @param {import('./types').AcceptAlertOptions} [opts={}]
9
+ * @returns {Promise<void>}
10
+ */
11
+ export function mobileAcceptAlert(this: import("../driver").AndroidUiautomator2Driver, opts?: import("./types").AcceptAlertOptions | undefined): Promise<void>;
12
+ /**
13
+ * @this {AndroidUiautomator2Driver}
14
+ * @returns {Promise<void>}
15
+ */
16
+ export function postAcceptAlert(this: import("../driver").AndroidUiautomator2Driver): Promise<void>;
17
+ /**
18
+ * @this {AndroidUiautomator2Driver}
19
+ * @param {import('./types').DismissAlertOptions} [opts={}]
20
+ * @returns {Promise<void>}
21
+ */
22
+ export function mobileDismissAlert(this: import("../driver").AndroidUiautomator2Driver, opts?: import("./types").DismissAlertOptions | undefined): Promise<void>;
23
+ /**
24
+ * @this {AndroidUiautomator2Driver}
25
+ * @returns {Promise<void>}
26
+ */
27
+ export function postDismissAlert(this: import("../driver").AndroidUiautomator2Driver): Promise<void>;
28
+ export type AndroidUiautomator2Driver = import('../driver').AndroidUiautomator2Driver;
2
29
  //# sourceMappingURL=alert.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../../lib/commands/alert.js"],"names":[],"mappings":"iCA2Ca,OAAO,iBAAiB,EAAE,kBAAkB"}
1
+ {"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../../lib/commands/alert.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH,mFAFa,QAAQ,MAAM,CAAC,CAU3B;AAED;;;;GAIG;AACH,iJAFa,QAAQ,IAAI,CAAC,CAQzB;AAED;;;GAGG;AACH,sFAFa,QAAQ,IAAI,CAAC,CAIzB;AAED;;;;GAIG;AACH,mJAFa,QAAQ,IAAI,CAAC,CAQzB;AAED;;;GAGG;AACH,uFAFa,QAAQ,IAAI,CAAC,CAIzB;wCAGY,OAAO,WAAW,EAAE,yBAAyB"}
@@ -1,30 +1,49 @@
1
1
  "use strict";
2
- // @ts-check
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
- const mixins_1 = require("./mixins");
3
+ exports.postDismissAlert = exports.mobileDismissAlert = exports.postAcceptAlert = exports.mobileAcceptAlert = exports.getAlertText = void 0;
5
4
  /**
6
- * @type {import('./mixins').UIA2AlertMixin}
7
- * @satisfies {import('@appium/types').ExternalDriver}
5
+ * @this {AndroidUiautomator2Driver}
6
+ * @returns {Promise<string>}
8
7
  */
9
- const AlertMixin = {
10
- async getAlertText() {
11
- return String(await this.uiautomator2.jwproxy.command('/alert/text', 'GET', {}));
12
- },
13
- async mobileAcceptAlert(opts = {}) {
14
- await this.uiautomator2.jwproxy.command('/alert/accept', 'POST', opts);
15
- },
16
- async postAcceptAlert() {
17
- await this.mobileAcceptAlert();
18
- },
19
- async mobileDismissAlert(opts = {}) {
20
- await this.uiautomator2.jwproxy.command('/alert/dismiss', 'POST', opts);
21
- },
22
- async postDismissAlert() {
23
- await this.mobileDismissAlert();
24
- },
25
- };
26
- (0, mixins_1.mixin)(AlertMixin);
8
+ async function getAlertText() {
9
+ return String(await this.uiautomator2.jwproxy.command('/alert/text', 'GET', {}));
10
+ }
11
+ exports.getAlertText = getAlertText;
27
12
  /**
28
- * @typedef {import('../uiautomator2').UiAutomator2Server} UiAutomator2Server
13
+ * @this {AndroidUiautomator2Driver}
14
+ * @param {import('./types').AcceptAlertOptions} [opts={}]
15
+ * @returns {Promise<void>}
16
+ */
17
+ async function mobileAcceptAlert(opts = {}) {
18
+ await this.uiautomator2.jwproxy.command('/alert/accept', 'POST', opts);
19
+ }
20
+ exports.mobileAcceptAlert = mobileAcceptAlert;
21
+ /**
22
+ * @this {AndroidUiautomator2Driver}
23
+ * @returns {Promise<void>}
24
+ */
25
+ async function postAcceptAlert() {
26
+ await this.mobileAcceptAlert();
27
+ }
28
+ exports.postAcceptAlert = postAcceptAlert;
29
+ /**
30
+ * @this {AndroidUiautomator2Driver}
31
+ * @param {import('./types').DismissAlertOptions} [opts={}]
32
+ * @returns {Promise<void>}
33
+ */
34
+ async function mobileDismissAlert(opts = {}) {
35
+ await this.uiautomator2.jwproxy.command('/alert/dismiss', 'POST', opts);
36
+ }
37
+ exports.mobileDismissAlert = mobileDismissAlert;
38
+ /**
39
+ * @this {AndroidUiautomator2Driver}
40
+ * @returns {Promise<void>}
41
+ */
42
+ async function postDismissAlert() {
43
+ await this.mobileDismissAlert();
44
+ }
45
+ exports.postDismissAlert = postDismissAlert;
46
+ /**
47
+ * @typedef {import('../driver').AndroidUiautomator2Driver} AndroidUiautomator2Driver
29
48
  */
30
49
  //# sourceMappingURL=alert.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"alert.js","sourceRoot":"","sources":["../../../lib/commands/alert.js"],"names":[],"mappings":";AAAA,YAAY;;AAEZ,qCAA+B;AAE/B;;;GAGG;AACH,MAAM,UAAU,GAAG;IACjB,KAAK,CAAC,YAAY;QAChB,OAAO,MAAM,CACX,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CACrC,aAAa,EACb,KAAK,EACL,EAAE,CACH,CACF,CAAC;IACJ,CAAC;IACD,KAAK,CAAC,iBAAiB,CAAC,IAAI,GAAG,EAAE;QAC/B,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CACrC,eAAe,EACf,MAAM,EACN,IAAI,CACL,CAAC;IACJ,CAAC;IACD,KAAK,CAAC,eAAe;QACnB,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;IACjC,CAAC;IACD,KAAK,CAAC,kBAAkB,CAAC,IAAI,GAAG,EAAE;QAChC,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CACrC,gBAAgB,EAChB,MAAM,EACN,IAAI,CACL,CAAC;IACJ,CAAC;IACD,KAAK,CAAC,gBAAgB;QACpB,MAAM,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAClC,CAAC;CACF,CAAC;AAEF,IAAA,cAAK,EAAC,UAAU,CAAC,CAAC;AAElB;;GAEG"}
1
+ {"version":3,"file":"alert.js","sourceRoot":"","sources":["../../../lib/commands/alert.js"],"names":[],"mappings":";;;AAAA;;;GAGG;AACI,KAAK,UAAU,YAAY;IAChC,OAAO,MAAM,CACX,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CACrC,aAAa,EACb,KAAK,EACL,EAAE,CACH,CACF,CAAC;AACJ,CAAC;AARD,oCAQC;AAED;;;;GAIG;AACI,KAAK,UAAU,iBAAiB,CAAC,IAAI,GAAG,EAAE;IAC/C,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CACrC,eAAe,EACf,MAAM,EACN,IAAI,CACL,CAAC;AACJ,CAAC;AAND,8CAMC;AAED;;;GAGG;AACI,KAAK,UAAU,eAAe;IACnC,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;AACjC,CAAC;AAFD,0CAEC;AAED;;;;GAIG;AACI,KAAK,UAAU,kBAAkB,CAAC,IAAI,GAAG,EAAE;IAChD,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CACrC,gBAAgB,EAChB,MAAM,EACN,IAAI,CACL,CAAC;AACJ,CAAC;AAND,gDAMC;AAED;;;GAGG;AACI,KAAK,UAAU,gBAAgB;IACpC,MAAM,IAAI,CAAC,kBAAkB,EAAE,CAAC;AAClC,CAAC;AAFD,4CAEC;AAED;;GAEG"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Install multiple APKs with `install-multiple` option.
3
+ * @this {AndroidUiautomator2Driver}=
4
+ * @param {import('./types').InstallMultipleApksOptions} opts
5
+ * @throws {Error} if an error occured while installing the given APKs.
6
+ * @returns {Promise<void>}
7
+ */
8
+ export function mobileInstallMultipleApks(this: import("../driver").AndroidUiautomator2Driver, opts: import('./types').InstallMultipleApksOptions): Promise<void>;
9
+ /**
10
+ * Puts the app to background and waits the given number of seconds Then restores the app
11
+ * if necessary. The call is blocking.
12
+ * @this {AndroidUiautomator2Driver}=
13
+ * @param {import('./types').BackgroundAppOptions} [opts={}]
14
+ * @returns {Promise<void>}
15
+ */
16
+ export function mobileBackgroundApp(this: import("../driver").AndroidUiautomator2Driver, opts?: import("./types").BackgroundAppOptions | undefined): Promise<void>;
17
+ export type AndroidUiautomator2Driver = import('../driver').AndroidUiautomator2Driver;
18
+ export type StringRecord<T = any> = import('@appium/types').StringRecord<T>;
19
+ //# sourceMappingURL=app-management.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-management.d.ts","sourceRoot":"","sources":["../../../lib/commands/app-management.js"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,qGAJW,OAAO,SAAS,EAAE,0BAA0B,GAE1C,QAAQ,IAAI,CAAC,CAUzB;AAED;;;;;;GAMG;AACH,qJAFa,QAAQ,IAAI,CAAC,CAKzB;wCAGY,OAAO,WAAW,EAAE,yBAAyB;oCAK7C,OAAO,eAAe,EAAE,YAAY,CAAC,CAAC,CAAC"}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.mobileBackgroundApp = exports.mobileInstallMultipleApks = void 0;
7
+ const lodash_1 = __importDefault(require("lodash"));
8
+ const bluebird_1 = __importDefault(require("bluebird"));
9
+ const driver_1 = require("appium/driver");
10
+ const extensions_1 = require("../extensions");
11
+ /**
12
+ * Install multiple APKs with `install-multiple` option.
13
+ * @this {AndroidUiautomator2Driver}=
14
+ * @param {import('./types').InstallMultipleApksOptions} opts
15
+ * @throws {Error} if an error occured while installing the given APKs.
16
+ * @returns {Promise<void>}
17
+ */
18
+ async function mobileInstallMultipleApks(opts) {
19
+ if (!lodash_1.default.isArray(opts.apks) || lodash_1.default.isEmpty(opts.apks)) {
20
+ throw new driver_1.errors.InvalidArgumentError('No apks are given to install');
21
+ }
22
+ const apks = await bluebird_1.default.all(opts.apks.map((app) => this.helpers.configureApp(app, [extensions_1.APK_EXTENSION])));
23
+ await this.adb.installMultipleApks(apks, opts.options);
24
+ }
25
+ exports.mobileInstallMultipleApks = mobileInstallMultipleApks;
26
+ /**
27
+ * Puts the app to background and waits the given number of seconds Then restores the app
28
+ * if necessary. The call is blocking.
29
+ * @this {AndroidUiautomator2Driver}=
30
+ * @param {import('./types').BackgroundAppOptions} [opts={}]
31
+ * @returns {Promise<void>}
32
+ */
33
+ async function mobileBackgroundApp(opts = {}) {
34
+ const { seconds = -1 } = opts;
35
+ await this.background(seconds);
36
+ }
37
+ exports.mobileBackgroundApp = mobileBackgroundApp;
38
+ /**
39
+ * @typedef {import('../driver').AndroidUiautomator2Driver} AndroidUiautomator2Driver
40
+ */
41
+ /**
42
+ * @template [T=any]
43
+ * @typedef {import('@appium/types').StringRecord<T>} StringRecord
44
+ */
45
+ //# sourceMappingURL=app-management.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-management.js","sourceRoot":"","sources":["../../../lib/commands/app-management.js"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,wDAAyB;AACzB,0CAAqC;AACrC,8CAA4C;AAE5C;;;;;;GAMG;AACI,KAAK,UAAU,yBAAyB,CAAC,IAAI;IAClD,IAAI,CAAC,gBAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,gBAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QACjD,MAAM,IAAI,eAAM,CAAC,oBAAoB,CAAC,8BAA8B,CAAC,CAAC;KACvE;IACD,MAAM,IAAI,GAAG,MAAM,kBAAC,CAAC,GAAG,CACtB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,0BAAa,CAAC,CAAC,CAAC,CACxE,CAAC;IACF,MAAM,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;AACzD,CAAC;AARD,8DAQC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,mBAAmB,CAAC,IAAI,GAAG,EAAE;IACjD,MAAM,EAAC,OAAO,GAAG,CAAC,CAAC,EAAC,GAAG,IAAI,CAAC;IAC5B,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAHD,kDAGC;AAED;;GAEG;AAEH;;;GAGG"}
@@ -1,3 +1,12 @@
1
+ /**
2
+ * Retrives app strings from its resources for the given language
3
+ * or the default device language.
4
+ * @this {AndroidUiautomator2Driver}
5
+ * @param {import('./types').GetAppStringsOptions} [opts={}]
6
+ * @returns {Promise<StringRecord>}
7
+ */
8
+ export function mobileGetAppStrings(this: import("../driver").AndroidUiautomator2Driver, opts?: import("./types").GetAppStringsOptions | undefined): Promise<StringRecord>;
1
9
  export type ADB = import('appium-adb').ADB;
2
10
  export type StringRecord = import('@appium/types').StringRecord;
11
+ export type AndroidUiautomator2Driver = import('../driver').AndroidUiautomator2Driver;
3
12
  //# sourceMappingURL=app-strings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"app-strings.d.ts","sourceRoot":"","sources":["../../../lib/commands/app-strings.js"],"names":[],"mappings":"kBA6Fa,OAAO,YAAY,EAAE,GAAG;2BACxB,OAAO,eAAe,EAAE,YAAY"}
1
+ {"version":3,"file":"app-strings.d.ts","sourceRoot":"","sources":["../../../lib/commands/app-strings.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,qJAFa,QAAQ,YAAY,CAAC,CAIjC;kBAGY,OAAO,YAAY,EAAE,GAAG;2BACxB,OAAO,eAAe,EAAE,YAAY;wCACpC,OAAO,WAAW,EAAE,yBAAyB"}
@@ -1,88 +1,20 @@
1
1
  "use strict";
2
- // @ts-check
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
2
  Object.defineProperty(exports, "__esModule", { value: true });
7
- const mixins_1 = require("./mixins");
8
- const lodash_1 = __importDefault(require("lodash"));
9
- const support_1 = require("appium/support");
3
+ exports.mobileGetAppStrings = void 0;
10
4
  /**
11
- * @type {import('./mixins').UIA2AppStringsMixin}
12
- * @satisfies {import('@appium/types').ExternalDriver}
5
+ * Retrives app strings from its resources for the given language
6
+ * or the default device language.
7
+ * @this {AndroidUiautomator2Driver}
8
+ * @param {import('./types').GetAppStringsOptions} [opts={}]
9
+ * @returns {Promise<StringRecord>}
13
10
  */
14
- const AppStringsMixin = {
15
- async getStrings(language) {
16
- if (!language) {
17
- language = await this.adb.getDeviceLanguage();
18
- this.log.info(`No language specified, returning strings for: ${language}`);
19
- }
20
- /**
21
- * Clients require the resulting mapping to have both keys
22
- * and values of type string
23
- * @param {StringRecord} mapping
24
- */
25
- const preprocessStringsMap = function (mapping) {
26
- /** @type {StringRecord} */
27
- const result = {};
28
- for (const [key, value] of lodash_1.default.toPairs(mapping)) {
29
- result[key] = lodash_1.default.isString(value) ? value : JSON.stringify(value);
30
- }
31
- return result;
32
- };
33
- if (this.apkStrings[language]) {
34
- // Return cached strings
35
- return preprocessStringsMap(this.apkStrings[language]);
36
- }
37
- if (!this.opts.app && !this.opts.appPackage) {
38
- this.log.errorAndThrow("One of 'app' or 'appPackage' capabilities should must be specified");
39
- throw new Error(); // unreachable
40
- }
41
- let app = this.opts.app;
42
- const tmpRoot = await support_1.tempDir.openDir();
43
- try {
44
- if (!app) {
45
- try {
46
- app = await this.adb.pullApk(/** @type {string} */ (this.opts.appPackage), tmpRoot);
47
- }
48
- catch (err) {
49
- this.log.errorAndThrow(`Failed to pull an apk from '${this.opts.appPackage}'. Original error: ${
50
- /** @type {Error} */ (err).message}`);
51
- throw new Error(); // unreachable
52
- }
53
- }
54
- if (!(await support_1.fs.exists(app))) {
55
- this.log.errorAndThrow(`The app at '${app}' does not exist`);
56
- throw new Error(); // unreachable
57
- }
58
- try {
59
- const { apkStrings } = await this.adb.extractStringsFromApk(app, language, tmpRoot);
60
- this.apkStrings[language] = apkStrings;
61
- return preprocessStringsMap(apkStrings);
62
- }
63
- catch (err) {
64
- this.log.errorAndThrow(`Cannot extract strings from '${app}'. Original error: ${
65
- /** @type {Error} */ (err).message}`);
66
- throw new Error(); // unreachable
67
- }
68
- }
69
- finally {
70
- await support_1.fs.rimraf(tmpRoot);
71
- }
72
- },
73
- /**
74
- * Retrives app strings from its resources for the given language
75
- * or the default device language.
76
- *
77
- * @returns App strings map
78
- */
79
- async mobileGetAppStrings(opts) {
80
- return await this.getStrings(opts?.language);
81
- },
82
- };
83
- (0, mixins_1.mixin)(AppStringsMixin);
11
+ async function mobileGetAppStrings(opts) {
12
+ return await this.getStrings(opts?.language);
13
+ }
14
+ exports.mobileGetAppStrings = mobileGetAppStrings;
84
15
  /**
85
16
  * @typedef {import('appium-adb').ADB} ADB
86
17
  * @typedef {import('@appium/types').StringRecord} StringRecord
18
+ * @typedef {import('../driver').AndroidUiautomator2Driver} AndroidUiautomator2Driver
87
19
  */
88
20
  //# sourceMappingURL=app-strings.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"app-strings.js","sourceRoot":"","sources":["../../../lib/commands/app-strings.js"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"app-strings.js","sourceRoot":"","sources":["../../../lib/commands/app-strings.js"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACI,KAAK,UAAU,mBAAmB,CAAC,IAAI;IAC5C,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC/C,CAAC;AAFD,kDAEC;AAED;;;;GAIG"}
@@ -1,2 +1,9 @@
1
+ /**
2
+ * Reads the battery information from the device under test.
3
+ * @this {AndroidUiautomator2Driver}
4
+ * @returns {Promise<import('./types').BatteryInfo>} The actual battery info
5
+ */
6
+ export function mobileGetBatteryInfo(this: import("../driver").AndroidUiautomator2Driver): Promise<import('./types').BatteryInfo>;
1
7
  export type BatteryInfo = import('./types').BatteryInfo;
8
+ export type AndroidUiautomator2Driver = import('../driver').AndroidUiautomator2Driver;
2
9
  //# sourceMappingURL=battery.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"battery.d.ts","sourceRoot":"","sources":["../../../lib/commands/battery.js"],"names":[],"mappings":"0BA+Ba,OAAO,SAAS,EAAE,WAAW"}
1
+ {"version":3,"file":"battery.d.ts","sourceRoot":"","sources":["../../../lib/commands/battery.js"],"names":[],"mappings":"AACA;;;;GAIG;AACH,2FAFa,QAAQ,OAAO,SAAS,EAAE,WAAW,CAAC,CAalD;0BAGY,OAAO,SAAS,EAAE,WAAW;wCAC7B,OAAO,WAAW,EAAE,yBAAyB"}
@@ -1,28 +1,22 @@
1
1
  "use strict";
2
- // @ts-check
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
- const mixins_1 = require("./mixins");
3
+ exports.mobileGetBatteryInfo = void 0;
5
4
  /**
6
- * @type {import('./mixins').UIA2BatteryMixin}
7
- * @satisfies {import('@appium/types').ExternalDriver}
5
+ * Reads the battery information from the device under test.
6
+ * @this {AndroidUiautomator2Driver}
7
+ * @returns {Promise<import('./types').BatteryInfo>} The actual battery info
8
8
  */
9
- const BatteryMixin = {
10
- /**
11
- * Reads the battery information from the device under test.
12
- *
13
- * @returns The actual battery info
14
- */
15
- async mobileGetBatteryInfo() {
16
- const result = /** @type {import('./types').MapKey<BatteryInfo, 'state', 'status'>} */ (await /** @type {import('../uiautomator2').UiAutomator2Server} */ (this.uiautomator2).jwproxy.command('/appium/device/battery_info', 'GET', {}));
17
- const batteryInfo = /** @type {any} */ (result);
18
- // Give it the same name as in iOS
19
- batteryInfo.state = result.status;
20
- delete batteryInfo.status;
21
- return /** @type {BatteryInfo} */ (batteryInfo);
22
- },
23
- };
24
- (0, mixins_1.mixin)(BatteryMixin);
9
+ async function mobileGetBatteryInfo() {
10
+ const result = /** @type {import('./types').MapKey<BatteryInfo, 'state', 'status'>} */ (await /** @type {import('../uiautomator2').UiAutomator2Server} */ (this.uiautomator2).jwproxy.command('/appium/device/battery_info', 'GET', {}));
11
+ const batteryInfo = /** @type {any} */ (result);
12
+ // Give it the same name as in iOS
13
+ batteryInfo.state = result.status;
14
+ delete batteryInfo.status;
15
+ return /** @type {BatteryInfo} */ (batteryInfo);
16
+ }
17
+ exports.mobileGetBatteryInfo = mobileGetBatteryInfo;
25
18
  /**
26
19
  * @typedef {import('./types').BatteryInfo} BatteryInfo
20
+ * @typedef {import('../driver').AndroidUiautomator2Driver} AndroidUiautomator2Driver
27
21
  */
28
22
  //# sourceMappingURL=battery.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"battery.js","sourceRoot":"","sources":["../../../lib/commands/battery.js"],"names":[],"mappings":";AAAA,YAAY;;AAEZ,qCAA+B;AAE/B;;;GAGG;AACH,MAAM,YAAY,GAAG;IACnB;;;;OAIG;IACH,KAAK,CAAC,oBAAoB;QACxB,MAAM,MAAM,GAAG,uEAAuE,CAAC,CACrF,MAAM,2DAA2D,CAAC,CAChE,IAAI,CAAC,YAAY,CAClB,CAAC,OAAO,CAAC,OAAO,CAAC,6BAA6B,EAAE,KAAK,EAAE,EAAE,CAAC,CAC5D,CAAC;QACF,MAAM,WAAW,GAAG,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;QAChD,kCAAkC;QAClC,WAAW,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC;QAClC,OAAO,WAAW,CAAC,MAAM,CAAC;QAC1B,OAAO,0BAA0B,CAAC,CAAC,WAAW,CAAC,CAAC;IAClD,CAAC;CACF,CAAC;AAEF,IAAA,cAAK,EAAC,YAAY,CAAC,CAAC;AAEpB;;GAEG"}
1
+ {"version":3,"file":"battery.js","sourceRoot":"","sources":["../../../lib/commands/battery.js"],"names":[],"mappings":";;;AACA;;;;GAIG;AACI,KAAK,UAAU,oBAAoB;IACxC,MAAM,MAAM,GAAG,uEAAuE,CAAC,CACrF,MAAM,2DAA2D,CAAC,CAChE,IAAI,CAAC,YAAY,CAClB,CAAC,OAAO,CAAC,OAAO,CAAC,6BAA6B,EAAE,KAAK,EAAE,EAAE,CAAC,CAC5D,CAAC;IACF,MAAM,WAAW,GAAG,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;IAChD,kCAAkC;IAClC,WAAW,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC;IAClC,OAAO,WAAW,CAAC,MAAM,CAAC;IAC1B,OAAO,0BAA0B,CAAC,CAAC,WAAW,CAAC,CAAC;AAClD,CAAC;AAXD,oDAWC;AAED;;;GAGG"}