@appium/base-driver 9.3.2 → 9.3.4

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 (105) hide show
  1. package/LICENSE +1 -1
  2. package/build/lib/basedriver/capabilities.d.ts +59 -36
  3. package/build/lib/basedriver/capabilities.d.ts.map +1 -1
  4. package/build/lib/basedriver/capabilities.js +57 -45
  5. package/build/lib/basedriver/capabilities.js.map +1 -1
  6. package/build/lib/basedriver/commands/event.d.ts +5 -9
  7. package/build/lib/basedriver/commands/event.d.ts.map +1 -1
  8. package/build/lib/basedriver/commands/event.js +28 -49
  9. package/build/lib/basedriver/commands/event.js.map +1 -1
  10. package/build/lib/basedriver/commands/execute.d.ts +5 -11
  11. package/build/lib/basedriver/commands/execute.d.ts.map +1 -1
  12. package/build/lib/basedriver/commands/execute.js +15 -39
  13. package/build/lib/basedriver/commands/execute.js.map +1 -1
  14. package/build/lib/basedriver/commands/find.d.ts +5 -12
  15. package/build/lib/basedriver/commands/find.d.ts.map +1 -1
  16. package/build/lib/basedriver/commands/find.js +38 -98
  17. package/build/lib/basedriver/commands/find.js.map +1 -1
  18. package/build/lib/basedriver/commands/index.d.ts +7 -3
  19. package/build/lib/basedriver/commands/index.d.ts.map +1 -1
  20. package/build/lib/basedriver/commands/index.js +7 -28
  21. package/build/lib/basedriver/commands/index.js.map +1 -1
  22. package/build/lib/basedriver/commands/log.d.ts +5 -10
  23. package/build/lib/basedriver/commands/log.d.ts.map +1 -1
  24. package/build/lib/basedriver/commands/log.js +17 -50
  25. package/build/lib/basedriver/commands/log.js.map +1 -1
  26. package/build/lib/basedriver/commands/mixin.d.ts +12 -0
  27. package/build/lib/basedriver/commands/mixin.d.ts.map +1 -0
  28. package/build/lib/basedriver/commands/mixin.js +18 -0
  29. package/build/lib/basedriver/commands/mixin.js.map +1 -0
  30. package/build/lib/basedriver/commands/session.d.ts +5 -11
  31. package/build/lib/basedriver/commands/session.d.ts.map +1 -1
  32. package/build/lib/basedriver/commands/session.js +18 -53
  33. package/build/lib/basedriver/commands/session.js.map +1 -1
  34. package/build/lib/basedriver/commands/settings.d.ts +5 -9
  35. package/build/lib/basedriver/commands/settings.d.ts.map +1 -1
  36. package/build/lib/basedriver/commands/settings.js +14 -34
  37. package/build/lib/basedriver/commands/settings.js.map +1 -1
  38. package/build/lib/basedriver/commands/timeout.d.ts +5 -9
  39. package/build/lib/basedriver/commands/timeout.d.ts.map +1 -1
  40. package/build/lib/basedriver/commands/timeout.js +107 -129
  41. package/build/lib/basedriver/commands/timeout.js.map +1 -1
  42. package/build/lib/basedriver/core.d.ts +14 -20
  43. package/build/lib/basedriver/core.d.ts.map +1 -1
  44. package/build/lib/basedriver/core.js +32 -22
  45. package/build/lib/basedriver/core.js.map +1 -1
  46. package/build/lib/basedriver/device-settings.d.ts +11 -11
  47. package/build/lib/basedriver/device-settings.d.ts.map +1 -1
  48. package/build/lib/basedriver/device-settings.js +7 -8
  49. package/build/lib/basedriver/device-settings.js.map +1 -1
  50. package/build/lib/basedriver/driver.d.ts +23 -108
  51. package/build/lib/basedriver/driver.d.ts.map +1 -1
  52. package/build/lib/basedriver/driver.js +38 -135
  53. package/build/lib/basedriver/driver.js.map +1 -1
  54. package/build/lib/basedriver/helpers.d.ts +21 -98
  55. package/build/lib/basedriver/helpers.d.ts.map +1 -1
  56. package/build/lib/basedriver/helpers.js +178 -182
  57. package/build/lib/basedriver/helpers.js.map +1 -1
  58. package/build/lib/express/server.d.ts +3 -15
  59. package/build/lib/express/server.d.ts.map +1 -1
  60. package/build/lib/express/server.js +4 -2
  61. package/build/lib/express/server.js.map +1 -1
  62. package/build/lib/express/websocket.d.ts +5 -44
  63. package/build/lib/express/websocket.d.ts.map +1 -1
  64. package/build/lib/express/websocket.js +10 -39
  65. package/build/lib/express/websocket.js.map +1 -1
  66. package/build/lib/helpers/capabilities.d.ts +2 -2
  67. package/build/lib/helpers/capabilities.d.ts.map +1 -1
  68. package/build/lib/helpers/capabilities.js +2 -3
  69. package/build/lib/helpers/capabilities.js.map +1 -1
  70. package/build/lib/protocol/protocol.d.ts +1 -1
  71. package/build/lib/protocol/protocol.d.ts.map +1 -1
  72. package/build/lib/protocol/protocol.js +10 -2
  73. package/build/lib/protocol/protocol.js.map +1 -1
  74. package/build/lib/protocol/routes.d.ts +1 -0
  75. package/build/lib/protocol/routes.d.ts.map +1 -1
  76. package/build/lib/protocol/routes.js +12 -10
  77. package/build/lib/protocol/routes.js.map +1 -1
  78. package/lib/basedriver/capabilities.js +70 -56
  79. package/lib/basedriver/commands/event.ts +49 -0
  80. package/lib/basedriver/commands/execute.ts +40 -0
  81. package/lib/basedriver/commands/find.ts +80 -0
  82. package/lib/basedriver/commands/index.ts +7 -0
  83. package/lib/basedriver/commands/log.ts +34 -0
  84. package/lib/basedriver/commands/mixin.ts +15 -0
  85. package/lib/basedriver/commands/session.ts +36 -0
  86. package/lib/basedriver/commands/settings.ts +26 -0
  87. package/lib/basedriver/commands/timeout.ts +155 -0
  88. package/lib/basedriver/core.js +11 -28
  89. package/lib/basedriver/device-settings.js +9 -11
  90. package/lib/basedriver/{driver.js → driver.ts} +71 -180
  91. package/lib/basedriver/helpers.js +214 -212
  92. package/lib/express/server.js +4 -2
  93. package/lib/express/websocket.js +10 -39
  94. package/lib/helpers/capabilities.js +2 -3
  95. package/lib/protocol/protocol.js +11 -2
  96. package/lib/protocol/routes.js +12 -13
  97. package/package.json +11 -7
  98. package/lib/basedriver/commands/event.js +0 -63
  99. package/lib/basedriver/commands/execute.js +0 -45
  100. package/lib/basedriver/commands/find.js +0 -108
  101. package/lib/basedriver/commands/index.js +0 -35
  102. package/lib/basedriver/commands/log.js +0 -64
  103. package/lib/basedriver/commands/session.js +0 -57
  104. package/lib/basedriver/commands/settings.js +0 -38
  105. package/lib/basedriver/commands/timeout.js +0 -168
@@ -1,12 +1,6 @@
1
- /**
2
- * @template {Constraints} C
3
- * @param {import('./session').SessionBase<C>} Base
4
- * @returns {ExecuteBase<C>}
5
- */
6
- export function ExecuteMixin<C extends Readonly<Record<string, import("@appium/types").Constraint>>>(Base: import("./session").SessionBase<C>): ExecuteBase<C>;
7
- export type IExecuteCommands = import('@appium/types').IExecuteCommands;
8
- export type Driver = import('@appium/types').Driver;
9
- export type DriverClass = import('@appium/types').DriverClass;
10
- export type Constraints = import('@appium/types').Constraints;
11
- export type ExecuteBase<C extends Readonly<Record<string, import("@appium/types").Constraint>>> = import('../driver').BaseDriverBase<C, import('@appium/types').ITimeoutCommands & import('@appium/types').IEventCommands & import('@appium/types').IFindCommands & import('@appium/types').ILogCommands<C> & import('@appium/types').ISettingsCommands & import('@appium/types').ISessionCommands & IExecuteCommands>;
1
+ import { Constraints, IExecuteCommands } from '@appium/types';
2
+ declare module '../driver' {
3
+ interface BaseDriver<C extends Constraints> extends IExecuteCommands {
4
+ }
5
+ }
12
6
  //# sourceMappingURL=execute.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/execute.js"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,+JAwBC;+BAGY,OAAO,eAAe,EAAE,gBAAgB;qBACxC,OAAO,eAAe,EAAE,MAAM;0BAC9B,OAAO,eAAe,EAAE,WAAW;0BACnC,OAAO,eAAe,EAAE,WAAW;kGAKnC,OAAO,WAAW,EAAE,cAAc,CAAC,CAAC,EAAE,OAAO,eAAe,EAAE,gBAAgB,GAAG,OAAO,eAAe,EAAE,cAAc,GAAG,OAAO,eAAe,EAAE,aAAa,GAAG,OAAO,eAAe,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,OAAO,eAAe,EAAE,iBAAiB,GAAG,OAAO,eAAe,EAAE,gBAAgB,GAAG,gBAAgB,CAAC"}
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/execute.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EAIX,gBAAgB,EAEjB,MAAM,eAAe,CAAC;AAIvB,OAAO,QAAQ,WAAW,CAAC;IAEzB,UAAU,UAAU,CAAC,CAAC,SAAS,WAAW,CAAE,SAAQ,gBAAgB;KAAG;CACxE"}
@@ -3,46 +3,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ExecuteMixin = void 0;
7
6
  const lodash_1 = __importDefault(require("lodash"));
8
7
  const protocol_1 = require("../../protocol");
9
- /**
10
- * @template {Constraints} C
11
- * @param {import('./session').SessionBase<C>} Base
12
- * @returns {ExecuteBase<C>}
13
- */
14
- function ExecuteMixin(Base) {
15
- /**
16
- * @implements {IExecuteCommands}
17
- */
18
- class ExecuteCommands extends Base {
19
- /**
20
- * @param {string} script
21
- * @param {[Record<string, any>]|[]} protoArgs
22
- */
23
- async executeMethod(script, protoArgs) {
24
- const Driver = /** @type {DriverClass} */ (this.constructor);
25
- const commandMetadata = { ...Driver.executeMethodMap?.[script] };
26
- if (!commandMetadata.command) {
27
- const availableScripts = lodash_1.default.keys(Driver.executeMethodMap);
28
- throw new protocol_1.errors.UnsupportedOperationError(`Unsupported execute method '${script}'. Available methods ` +
29
- `are: ${availableScripts.join(', ')}`);
30
- }
31
- const args = (0, protocol_1.validateExecuteMethodParams)(protoArgs, commandMetadata.params);
32
- return await this[commandMetadata.command](...args);
8
+ const mixin_1 = require("./mixin");
9
+ const ExecuteCommands = {
10
+ async executeMethod(script, protoArgs) {
11
+ const Driver = this.constructor;
12
+ const commandMetadata = { ...Driver.executeMethodMap?.[script] };
13
+ if (!commandMetadata.command) {
14
+ const availableScripts = lodash_1.default.keys(Driver.executeMethodMap);
15
+ throw new protocol_1.errors.UnsupportedOperationError(`Unsupported execute method '${script}'. Available methods ` +
16
+ `are: ${availableScripts.join(', ')}`);
33
17
  }
34
- }
35
- return ExecuteCommands;
36
- }
37
- exports.ExecuteMixin = ExecuteMixin;
38
- /**
39
- * @typedef {import('@appium/types').IExecuteCommands} IExecuteCommands
40
- * @typedef {import('@appium/types').Driver} Driver
41
- * @typedef {import('@appium/types').DriverClass} DriverClass
42
- * @typedef {import('@appium/types').Constraints} Constraints
43
- */
44
- /**
45
- * @template {Constraints} C
46
- * @typedef {import('../driver').BaseDriverBase<C, import('@appium/types').ITimeoutCommands & import('@appium/types').IEventCommands & import('@appium/types').IFindCommands & import('@appium/types').ILogCommands<C> & import('@appium/types').ISettingsCommands & import('@appium/types').ISessionCommands & IExecuteCommands>} ExecuteBase
47
- */
18
+ const args = (0, protocol_1.validateExecuteMethodParams)(protoArgs, commandMetadata.params);
19
+ const command = this[commandMetadata.command];
20
+ return await command.call(this, ...args);
21
+ },
22
+ };
23
+ (0, mixin_1.mixin)(ExecuteCommands);
48
24
  //# sourceMappingURL=execute.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../../lib/basedriver/commands/execute.js"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,6CAAmE;AAEnE;;;;GAIG;AACH,SAAgB,YAAY,CAAC,IAAI;IAC/B;;OAEG;IACH,MAAM,eAAgB,SAAQ,IAAI;QAChC;;;WAGG;QACH,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE,SAAS;YACnC,MAAM,MAAM,GAAG,0BAA0B,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC7D,MAAM,eAAe,GAAG,EAAC,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC,MAAM,CAAC,EAAC,CAAC;YAC/D,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE;gBAC5B,MAAM,gBAAgB,GAAG,gBAAC,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;gBACzD,MAAM,IAAI,iBAAM,CAAC,yBAAyB,CACxC,+BAA+B,MAAM,uBAAuB;oBAC1D,QAAQ,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACxC,CAAC;a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{Constraints} C
3
- * @param {import('./event').EventBase<C>} Base
4
- * @returns {FindBase<C>}
5
- */
6
- export function FindMixin<C extends Readonly<Record<string, import("@appium/types").Constraint>>>(Base: import("./event").EventBase<C>): FindBase<C>;
7
- export type Element = import('@appium/types').Element;
8
- export type Constraints = import('@appium/types').Constraints;
9
- export type IFindCommands = import('@appium/types').IFindCommands;
10
- export type ITimeoutCommands = import('@appium/types').ITimeoutCommands;
11
- export type IEventCommands = import('@appium/types').IEventCommands;
12
- export type FindBase<C extends Readonly<Record<string, import("@appium/types").Constraint>>> = import('../driver').BaseDriverBase<C, ITimeoutCommands & IEventCommands & IFindCommands>;
1
+ import { Constraints, IFindCommands } from '@appium/types';
2
+ declare module '../driver' {
3
+ interface BaseDriver<C extends Constraints> extends IFindCommands {
4
+ }
5
+ }
13
6
  //# sourceMappingURL=find.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/find.js"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,qJAqFC;sBAGY,OAAO,eAAe,EAAE,OAAO;0BAC/B,OAAO,eAAe,EAAE,WAAW;4BACnC,OAAO,eAAe,EAAE,aAAa;+BACrC,OAAO,eAAe,EAAE,gBAAgB;6BACxC,OAAO,eAAe,EAAE,cAAc;+FAItC,OAAO,WAAW,EAAE,cAAc,CAAC,CAAC,EAAE,gBAAgB,GAAG,cAAc,GAAG,aAAa,CAAC"}
1
+ {"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/find.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,aAAa,EAAC,MAAM,eAAe,CAAC;AAKzD,OAAO,QAAQ,WAAW,CAAC;IAEzB,UAAU,UAAU,CAAC,CAAC,SAAS,WAAW,CAAE,SAAQ,aAAa;KAAG;CACrE"}
@@ -1,107 +1,47 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FindMixin = void 0;
4
- /* eslint-disable no-unused-vars */
5
- /* eslint-disable require-await */
6
- // @ts-check
7
3
  const protocol_1 = require("../../protocol");
8
- /**
9
- * @template {Constraints} C
10
- * @param {import('./event').EventBase<C>} Base
11
- * @returns {FindBase<C>}
12
- */
13
- function FindMixin(Base) {
4
+ const mixin_1 = require("./mixin");
5
+ const FindCommands = {
6
+ async findElement(strategy, selector) {
7
+ return await this.findElOrElsWithProcessing(strategy, selector, false);
8
+ },
9
+ async findElements(strategy, selector) {
10
+ return await this.findElOrElsWithProcessing(strategy, selector, true);
11
+ },
12
+ async findElementFromElement(strategy, selector, elementId) {
13
+ return await this.findElOrElsWithProcessing(strategy, selector, false, elementId);
14
+ },
15
+ async findElementsFromElement(strategy, selector, elementId) {
16
+ return await this.findElOrElsWithProcessing(strategy, selector, true, elementId);
17
+ },
14
18
  /**
15
- * @implements {IFindCommands}
19
+ * Returns an object which adheres to the way the JSON Wire Protocol represents elements:
20
+ *
21
+ * Override this for your own driver!
16
22
  */
17
- class FindCommands extends Base {
18
- /**
19
- *
20
- * @returns {Promise<Element>}
21
- */
22
- async findElement(strategy, selector) {
23
- return await this.findElOrElsWithProcessing(strategy, selector, false);
23
+ async findElOrEls(strategy, selector, mult, context) {
24
+ throw new protocol_1.errors.NotImplementedError('Not implemented yet for find.');
25
+ },
26
+ async getPageSource() {
27
+ throw new protocol_1.errors.NotImplementedError('Not implemented yet for find.');
28
+ },
29
+ async findElOrElsWithProcessing(strategy, selector, mult, context) {
30
+ this.validateLocatorStrategy(strategy);
31
+ try {
32
+ return await this.findElOrEls(strategy, selector, mult, context);
24
33
  }
25
- /**
26
- *
27
- * @returns {Promise<Element[]>}
28
- */
29
- async findElements(strategy, selector) {
30
- return await this.findElOrElsWithProcessing(strategy, selector, true);
31
- }
32
- /**
33
- *
34
- * @returns {Promise<Element>}
35
- */
36
- async findElementFromElement(strategy, selector, elementId) {
37
- return await this.findElOrElsWithProcessing(strategy, selector, false, elementId);
38
- }
39
- /**
40
- *
41
- * @returns {Promise<Element[]>}
42
- */
43
- async findElementsFromElement(strategy, selector, elementId) {
44
- return await this.findElOrElsWithProcessing(strategy, selector, true, elementId);
45
- }
46
- /**
47
- * Returns an object which adheres to the way the JSON Wire Protocol represents elements:
48
- *
49
- * Override this for your own driver!
50
- * @template {boolean} Mult
51
- * @template [Ctx=any]
52
- * @param {string} strategy
53
- * @param {string} selector
54
- * @param {Mult} mult
55
- * @param {Ctx} [context]
56
- * @returns {Promise<Mult extends true ? Element[] : Element>}
57
- */
58
- async findElOrEls(strategy, selector, mult, context) {
59
- throw new protocol_1.errors.NotImplementedError('Not implemented yet for find.');
60
- }
61
- /**
62
- * @returns {Promise<string>}
63
- */
64
- async getPageSource() {
65
- throw new protocol_1.errors.NotImplementedError('Not implemented yet for find.');
66
- }
67
- /**
68
- * @template {boolean} Mult
69
- * @template [Ctx=any]
70
- * @param {string} strategy
71
- * @param {string} selector
72
- * @param {Mult} mult
73
- * @param {Ctx} [context]
74
- * @returns {Promise<Mult extends true ? Element[] : Element>}
75
- */
76
- async findElOrElsWithProcessing(strategy, selector, mult, context) {
77
- this.validateLocatorStrategy(strategy);
78
- try {
79
- return await this.findElOrEls(strategy, selector, mult, context);
80
- }
81
- catch (err) {
82
- if (this.opts.printPageSourceOnFindFailure) {
83
- const src = await this.getPageSource();
84
- this.log.debug(`Error finding element${mult ? 's' : ''}: ${err.message}`);
85
- this.log.debug(`Page source requested through 'printPageSourceOnFindFailure':`);
86
- this.log.debug(src);
87
- }
88
- // still want the error to occur
89
- throw err;
34
+ catch (err) {
35
+ if (this.opts.printPageSourceOnFindFailure) {
36
+ const src = await this.getPageSource();
37
+ this.log.debug(`Error finding element${mult ? 's' : ''}: ${err.message}`);
38
+ this.log.debug(`Page source requested through 'printPageSourceOnFindFailure':`);
39
+ this.log.debug(src);
90
40
  }
41
+ // still want the error to occur
42
+ throw err;
91
43
  }
92
- }
93
- return FindCommands;
94
- }
95
- exports.FindMixin = FindMixin;
96
- /**
97
- * @typedef {import('@appium/types').Element} Element
98
- * @typedef {import('@appium/types').Constraints} Constraints
99
- * @typedef {import('@appium/types').IFindCommands} IFindCommands
100
- * @typedef {import('@appium/types').ITimeoutCommands} ITimeoutCommands
101
- * @typedef {import('@appium/types').IEventCommands} IEventCommands
102
- */
103
- /**
104
- * @template {Constraints} C
105
- * @typedef {import('../driver').BaseDriverBase<C, ITimeoutCommands & IEventCommands & IFindCommands>} FindBase
106
- */
44
+ },
45
+ };
46
+ (0, mixin_1.mixin)(FindCommands);
107
47
  //# sourceMappingURL=find.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"find.js","sourceRoot":"","sources":["../../../../lib/basedriver/commands/find.js"],"names":[],"mappings":";;;AAAA,mCAAmC;AACnC,kCAAkC;AAClC,YAAY;AACZ,6CAAsC;AAEtC;;;;GAIG;AACH,SAAgB,SAAS,CAAC,IAAI;IAC5B;;OAEG;IACH,MAAM,YAAa,SAAQ,IAAI;QAC7B;;;WAGG;QACH,KAAK,CAAC,WAAW,CAAC,QAAQ,EAAE,QAAQ;YAClC,OAAO,MAAM,IAAI,CAAC,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;QACzE,CAAC;QAED;;;WAGG;QACH,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,QAAQ;YACnC,OAAO,MAAM,IAAI,CAAC,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;QACxE,CAAC;QAED;;;WAGG;QACH,KAAK,CAAC,sBAAsB,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS;YACxD,OAAO,MAAM,IAAI,CAAC,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;QACpF,CAAC;QAED;;;WAGG;QACH,KAAK,CAAC,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS;YACzD,OAAO,MAAM,IAAI,CAAC,yBAAyB,CAAC,QA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E,OAAO,CAAC,CAAC;SAClE;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,IAAI,CAAC,IAAI,CAAC,4BAA4B,EAAE;gBAC1C,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;gBACvC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,wBAAwB,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;gBAC1E,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,+DAA+D,CAAC,CAAC;gBAChF,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;aACrB;YACD,gCAAgC;YAChC,MAAM,GAAG,CAAC;SACX;IACH,CAAC;CACF,CAAC;AAEF,IAAA,aAAK,EAAC,YAAY,CAAC,CAAC"}
@@ -1,4 +1,8 @@
1
- export function createBaseDriverClass<C_1 extends Readonly<Record<string, import("@appium/types").Constraint>>>(Base: import("../driver").BaseDriverBase<C_1, {}, {}>): import("./execute").ExecuteBase<C_1>;
2
- export type BaseDriverBase<C_1 extends Readonly<Record<string, import("@appium/types").Constraint>>> = import('../driver').BaseDriverBase<C>;
3
- export type Constraints = import('@appium/types').Constraints;
1
+ import './event';
2
+ import './find';
3
+ import './log';
4
+ import './session';
5
+ import './settings';
6
+ import './timeout';
7
+ import './execute';
4
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/index.js"],"names":[],"mappings":"AAmCy3K,6MAAmB;uGAN/3K,OAAO,WAAW,EAAE,cAAc,CAAC,CAAC,CAAC;0BAIrC,OAAO,eAAe,EAAE,WAAW"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,CAAC;AACjB,OAAO,QAAQ,CAAC;AAChB,OAAO,OAAO,CAAC;AACf,OAAO,WAAW,CAAC;AACnB,OAAO,YAAY,CAAC;AACpB,OAAO,WAAW,CAAC;AACnB,OAAO,WAAW,CAAC"}
@@ -1,31 +1,10 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createBaseDriverClass = void 0;
7
- // @ts-check
8
- const lodash_1 = __importDefault(require("lodash"));
9
- const event_1 = require("./event");
10
- const find_1 = require("./find");
11
- const log_1 = require("./log");
12
- const session_1 = require("./session");
13
- const settings_1 = require("./settings");
14
- const timeout_1 = require("./timeout");
15
- const execute_1 = require("./execute");
16
- /**
17
- * Applies all the mixins to the `BaseDriverBase` class; returns a `BaseDriver` class definition.
18
- * Each mixin is applied in the order it is listed here, and each type is a union with the previous.
19
- *
20
- * @template {Constraints} C
21
- * @param {BaseDriverBase<C>} Base
22
- */
23
- exports.createBaseDriverClass = lodash_1.default.flow(timeout_1.TimeoutMixin, event_1.EventMixin, find_1.FindMixin, log_1.LogMixin, settings_1.SettingsMixin, session_1.SessionMixin, execute_1.ExecuteMixin);
24
- /**
25
- * @template {Constraints} C
26
- * @typedef {import('../driver').BaseDriverBase<C>} BaseDriverBase
27
- */
28
- /**
29
- * @typedef {import('@appium/types').Constraints} Constraints
30
- */
3
+ require("./event");
4
+ require("./find");
5
+ require("./log");
6
+ require("./session");
7
+ require("./settings");
8
+ require("./timeout");
9
+ require("./execute");
31
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/basedriver/commands/index.js"],"names":[],"mappings":";;;;;;AAAA,YAAY;AACZ,oDAAuB;AACvB,mCAAmC;AACnC,iCAAiC;AACjC,+BAA+B;AAC/B,uCAAuC;AACvC,yCAAyC;AACzC,uCAAuC;AACvC,uCAAuC;AAEvC;;;;;;GAMG;AACU,QAAA,qBAAqB,GAAG,gBAAC,CAAC,IAAI,CACzC,sBAAY,EACZ,kBAAU,EACV,gBAAS,EACT,cAAQ,EACR,wBAAa,EACb,sBAAY,EACZ,sBAAY,CACb,CAAC;AAEF;;;GAGG;AAEH;;GAEG"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/basedriver/commands/index.ts"],"names":[],"mappings":";;AAAA,mBAAiB;AACjB,kBAAgB;AAChB,iBAAe;AACf,qBAAmB;AACnB,sBAAoB;AACpB,qBAAmB;AACnB,qBAAmB"}
@@ -1,11 +1,6 @@
1
- /**
2
- * @template {Constraints} C
3
- * @param {import('./find').FindBase<C>} Base
4
- * @returns {LogBase<C>}
5
- */
6
- export function LogMixin<C extends Readonly<Record<string, import("@appium/types").Constraint>>>(Base: import("./find").FindBase<C>): LogBase<C>;
7
- export type Constraints = import('@appium/types').Constraints;
8
- export type StringRecord = import('@appium/types').StringRecord;
9
- export type ILogCommands<C extends Readonly<Record<string, import("@appium/types").Constraint>>> = import('@appium/types').ILogCommands<C>;
10
- export type LogBase<C extends Readonly<Record<string, import("@appium/types").Constraint>>> = import('../driver').BaseDriverBase<C, import('@appium/types').ITimeoutCommands & import('@appium/types').IEventCommands & import('@appium/types').IFindCommands & ILogCommands<C>>;
1
+ import { Constraints, ILogCommands } from '@appium/types';
2
+ declare module '../driver' {
3
+ interface BaseDriver<C extends Constraints> extends ILogCommands {
4
+ }
5
+ }
11
6
  //# sourceMappingURL=log.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/log.js"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,iJAsCC;0BAGY,OAAO,eAAe,EAAE,WAAW;2BACnC,OAAO,eAAe,EAAE,YAAY;mGAKpC,OAAO,eAAe,EAAE,YAAY,CAAC,CAAC,CAAC;8FAKvC,OAAO,WAAW,EAAE,cAAc,CAAC,CAAC,EAAE,OAAO,eAAe,EAAE,gBAAgB,GAAG,OAAO,eAAe,EAAE,cAAc,GAAG,OAAO,eAAe,EAAE,aAAa,GAAG,aAAa,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAU,YAAY,EAAe,MAAM,eAAe,CAAC;AAK9E,OAAO,QAAQ,WAAW,CAAC;IAEzB,UAAU,UAAU,CAAC,CAAC,SAAS,WAAW,CAAE,SAAQ,YAAY;KAAG;CACpE"}
@@ -1,58 +1,25 @@
1
1
  "use strict";
2
- /* eslint-disable require-await */
3
- // @ts-check
4
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
5
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
6
4
  };
7
5
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.LogMixin = void 0;
9
6
  const lodash_1 = __importDefault(require("lodash"));
10
- /**
11
- * @template {Constraints} C
12
- * @param {import('./find').FindBase<C>} Base
13
- * @returns {LogBase<C>}
14
- */
15
- function LogMixin(Base) {
16
- /**
17
- * @implements {ILogCommands<C>}
18
- */
19
- class LogCommands extends Base {
20
- constructor(...args) {
21
- super(...args);
22
- this.supportedLogTypes ?? (this.supportedLogTypes = {});
7
+ const mixin_1 = require("./mixin");
8
+ const LogCommands = {
9
+ supportedLogTypes: {},
10
+ async getLogTypes() {
11
+ this.log.debug('Retrieving supported log types');
12
+ return Object.keys(this.supportedLogTypes);
13
+ },
14
+ async getLog(logType) {
15
+ this.log.debug(`Retrieving '${String(logType)}' logs`);
16
+ if (!(logType in this.supportedLogTypes)) {
17
+ const logsTypesWithDescriptions = lodash_1.default.mapValues(this.supportedLogTypes, 'description');
18
+ throw new Error(`Unsupported log type '${String(logType)}'. ` +
19
+ `Supported types: ${JSON.stringify(logsTypesWithDescriptions)}`);
23
20
  }
24
- async getLogTypes() {
25
- this.log.debug('Retrieving supported log types');
26
- return Object.keys(this.supportedLogTypes);
27
- }
28
- /**
29
- * @this {import('@appium/types').Driver<C>}
30
- * @param {keyof typeof this.supportedLogTypes} logType
31
- * @returns {Promise<import('type-fest').AsyncReturnType<typeof this.supportedLogTypes[keyof typeof this.supportedLogTypes]['getter']>>}
32
- */
33
- async getLog(logType) {
34
- this.log.debug(`Retrieving '${String(logType)}' logs`);
35
- if (!(logType in this.supportedLogTypes)) {
36
- const logsTypesWithDescriptions = lodash_1.default.mapValues(this.supportedLogTypes, 'description');
37
- throw new Error(`Unsupported log type '${String(logType)}'. ` +
38
- `Supported types: ${JSON.stringify(logsTypesWithDescriptions)}`);
39
- }
40
- return await this.supportedLogTypes[logType].getter(this);
41
- }
42
- }
43
- return LogCommands;
44
- }
45
- exports.LogMixin = LogMixin;
46
- /**
47
- * @typedef {import('@appium/types').Constraints} Constraints
48
- * @typedef {import('@appium/types').StringRecord} StringRecord
49
- */
50
- /**
51
- * @template {Constraints} C
52
- * @typedef {import('@appium/types').ILogCommands<C>} ILogCommands
53
- */
54
- /**
55
- * @template {Constraints} C
56
- * @typedef {import('../driver').BaseDriverBase<C, import('@appium/types').ITimeoutCommands & import('@appium/types').IEventCommands & import('@appium/types').IFindCommands & ILogCommands<C>>} LogBase
57
- */
21
+ return await this.supportedLogTypes[logType].getter(this);
22
+ },
23
+ };
24
+ (0, mixin_1.mixin)(LogCommands);
58
25
  //# sourceMappingURL=log.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"log.js","sourceRoot":"","sources":["../../../../lib/basedriver/commands/log.js"],"names":[],"mappings":";AAAA,kCAAkC;AAClC,YAAY;;;;;;AAEZ,oDAAuB;AAEvB;;;;GAIG;AACH,SAAgB,QAAQ,CAAC,IAAI;IAC3B;;OAEG;IACH,MAAM,WAAY,SAAQ,IAAI;QAI5B,YAAY,GAAG,IAAI;YACjB,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;YACf,IAAI,CAAC,iBAAiB,KAAtB,IAAI,CAAC,iBAAiB,GAAK,EAAE,EAAC;QAChC,C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K,CAAC,eAAe,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAEvD,IAAI,CAAC,CAAC,OAAO,IAAI,IAAI,CAAC,iBAAiB,CAAC,EAAE;YACxC,MAAM,yBAAyB,GAAG,gBAAC,CAAC,SAAS,CAAC,IAAI,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC;YACrF,MAAM,IAAI,KAAK,CACb,yBAAyB,MAAM,CAAC,OAAO,CAAC,KAAK;gBAC3C,oBAAoB,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC,EAAE,CAClE,CAAC;SACH;QAED,OAAO,MAAM,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC5D,CAAC;CACF,CAAC;AAEF,IAAA,aAAK,EAAC,WAAW,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { Constraints } from '@appium/types';
2
+ import { BaseDriver } from '../driver';
3
+ /**
4
+ * This function assigns a mixin `T` to the `BaseDriver` class' prototype.
5
+ * While each mixin has its own interface which is (in isolation) unrelated to `BaseDriver`, the constraint
6
+ * on this generic type `T` is that it must be a partial of `BaseDriver`'s interface. This enforces
7
+ * that it does not conflict with the existing interface of `BaseDriver`. In that way, you can
8
+ * think of it as a type guard.
9
+ * @param mixin Mixin implementation
10
+ */
11
+ export declare function mixin<C extends Constraints, T extends Partial<BaseDriver<C>>>(mixin: T): void;
12
+ //# sourceMappingURL=mixin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mixin.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,UAAU,EAAC,MAAM,WAAW,CAAC;AAErC;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,WAAW,EAAE,CAAC,SAAS,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAG7F"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mixin = void 0;
4
+ const driver_1 = require("../driver");
5
+ /**
6
+ * This function assigns a mixin `T` to the `BaseDriver` class' prototype.
7
+ * While each mixin has its own interface which is (in isolation) unrelated to `BaseDriver`, the constraint
8
+ * on this generic type `T` is that it must be a partial of `BaseDriver`'s interface. This enforces
9
+ * that it does not conflict with the existing interface of `BaseDriver`. In that way, you can
10
+ * think of it as a type guard.
11
+ * @param mixin Mixin implementation
12
+ */
13
+ function mixin(mixin) {
14
+ // eslint-disable-next-line no-restricted-syntax
15
+ Object.assign(driver_1.BaseDriver.prototype, mixin);
16
+ }
17
+ exports.mixin = mixin;
18
+ //# sourceMappingURL=mixin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mixin.js","sourceRoot":"","sources":["../../../../lib/basedriver/commands/mixin.ts"],"names":[],"mappings":";;;AACA,sCAAqC;AAErC;;;;;;;GAOG;AACH,SAAgB,KAAK,CAA0D,KAAQ;IACrF,gDAAgD;IAChD,MAAM,CAAC,MAAM,CAAC,mBAAU,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;AAC7C,CAAC;AAHD,sBAGC"}
@@ -1,12 +1,6 @@
1
- /**
2
- * @template {Constraints} C
3
- * @param {import('./settings').SettingsBase<C>} Base
4
- * @returns {SessionBase<C>}
5
- */
6
- export function SessionMixin<C extends Readonly<Record<string, import("@appium/types").Constraint>>>(Base: import("./settings").SettingsBase<C>): SessionBase<C>;
7
- export type ISessionCommands = import('@appium/types').ISessionCommands;
8
- export type SingularSessionData = import('@appium/types').SingularSessionData;
9
- export type MultiSessionData = import('@appium/types').MultiSessionData;
10
- export type Constraints = import('@appium/types').Constraints;
11
- export type SessionBase<C extends Readonly<Record<string, import("@appium/types").Constraint>>> = import('../driver').BaseDriverBase<C, import('@appium/types').ITimeoutCommands & import('@appium/types').IEventCommands & import('@appium/types').IFindCommands & import('@appium/types').ILogCommands<C> & import('@appium/types').ISettingsCommands & ISessionCommands>;
1
+ import { Constraints, ISessionCommands } from '@appium/types';
2
+ declare module '../driver' {
3
+ interface BaseDriver<C extends Constraints> extends ISessionCommands {
4
+ }
5
+ }
12
6
  //# sourceMappingURL=session.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/session.js"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,iKAkCC;+BAGY,OAAO,eAAe,EAAE,gBAAgB;kCACxC,OAAO,eAAe,EAAE,mBAAmB;+BAC3C,OAAO,eAAe,EAAE,gBAAgB;0BACxC,OAAO,eAAe,EAAE,WAAW;kGAKnC,OAAO,WAAW,EAAE,cAAc,CAAC,CAAC,EAAE,OAAO,eAAe,EAAE,gBAAgB,GAAG,OAAO,eAAe,EAAE,cAAc,GAAG,OAAO,eAAe,EAAE,aAAa,GAAG,OAAO,eAAe,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,OAAO,eAAe,EAAE,iBAAiB,GAAG,gBAAgB,CAAC"}
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,gBAAgB,EAAwC,MAAM,eAAe,CAAC;AAInG,OAAO,QAAQ,WAAW,CAAC;IACzB,UAAU,UAAU,CAElB,CAAC,SAAS,WAAW,CACrB,SAAQ,gBAAgB;KAAG;CAC9B"}
@@ -1,58 +1,23 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.SessionMixin = void 0;
7
- /* eslint-disable no-unused-vars */
8
- /* eslint-disable require-await */
9
- // @ts-check
10
- const lodash_1 = __importDefault(require("lodash"));
11
- /**
12
- * @template {Constraints} C
13
- * @param {import('./settings').SettingsBase<C>} Base
14
- * @returns {SessionBase<C>}
15
- */
16
- function SessionMixin(Base) {
3
+ const mixin_1 = require("./mixin");
4
+ const SessionCommands = {
5
+ async getSessions() {
6
+ const ret = [];
7
+ if (this.sessionId) {
8
+ ret.push({
9
+ id: this.sessionId,
10
+ capabilities: this.caps,
11
+ });
12
+ }
13
+ return ret;
14
+ },
17
15
  /**
18
- * @implements {ISessionCommands}
16
+ * Returns capabilities for the session and event history (if applicable)
19
17
  */
20
- class SessionCommands extends Base {
21
- /**
22
- * @returns {Promise<MultiSessionData[]>}
23
- */
24
- async getSessions() {
25
- let ret = [];
26
- if (this.sessionId) {
27
- ret.push({
28
- id: this.sessionId,
29
- capabilities: this.caps,
30
- });
31
- }
32
- return ret;
33
- }
34
- /**
35
- * Returns capabilities for the session and event history (if applicable)
36
- * @returns {Promise<SingularSessionData>}
37
- */
38
- async getSession() {
39
- if (this.caps.eventTimings) {
40
- return { ...this.caps, events: this.eventHistory };
41
- }
42
- return this.caps;
43
- }
44
- }
45
- return SessionCommands;
46
- }
47
- exports.SessionMixin = SessionMixin;
48
- /**
49
- * @typedef {import('@appium/types').ISessionCommands} ISessionCommands
50
- * @typedef {import('@appium/types').SingularSessionData} SingularSessionData
51
- * @typedef {import('@appium/types').MultiSessionData} MultiSessionData
52
- * @typedef {import('@appium/types').Constraints} Constraints
53
- */
54
- /**
55
- * @template {Constraints} C
56
- * @typedef {import('../driver').BaseDriverBase<C, import('@appium/types').ITimeoutCommands & import('@appium/types').IEventCommands & import('@appium/types').IFindCommands & import('@appium/types').ILogCommands<C> & import('@appium/types').ISettingsCommands & ISessionCommands>} SessionBase
57
- */
18
+ async getSession() {
19
+ return ((this.caps.eventTimings ? { ...this.caps, events: this.eventHistory } : this.caps));
20
+ },
21
+ };
22
+ (0, mixin_1.mixin)(SessionCommands);
58
23
  //# sourceMappingURL=session.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"session.js","sourceRoot":"","sources":["../../../../lib/basedriver/commands/session.js"],"names":[],"mappings":";;;;;;AAAA,mCAAmC;AACnC,kCAAkC;AAClC,YAAY;AACZ,oDAAuB;AAEvB;;;;GAIG;AACH,SAAgB,YAAY,CAAC,IAAI;IAC/B;;OAEG;IACH,MAAM,eAAgB,SAAQ,IAAI;QAChC;;WAEG;QACH,KAAK,CAAC,WAAW;YACf,IAAI,GAAG,GAAG,EAAE,CAAC;YAEb,IAAI,IAAI,CAAC,SAAS,EAAE;gBAClB,GAAG,CAAC,IAAI,CAAC;oBACP,EAAE,EAAE,IAAI,CAAC,SAAS;oBAClB,YAAY,EAAE,IAAI,CAAC,IAAI;iBACxB,CAAC,CAAC;aACJ;YAED,OAAO,GAAG,CAAC;QACb,CAAC;QAED;;;WAGG;QACH,KAAK,CAAC,UAAU;YACd,IAAI,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;gBAC1B,OAAO,EAAC,GAAG,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,YAAY,EAAC,CAAC;aAClD;YACD,OAAO,IAAI,CAAC,IAAI,CAAC;QACnB,CAAC;KACF;IAED,OAAO,eAAe,CAAC;AACzB,CAAC;AAlCD,oCAkCC;AAED;;;;;GAKG;AAEH;;;GAGG"}
1
+ {"version":3,"file":"session.js","sourceRoot":"","sources":["../../../../lib/basedriver/commands/session.ts"],"names":[],"mappings":";;AAEA,mCAA8B;AAS9B,MAAM,eAAe,GAAqB;IACxC,KAAK,CAAC,WAAW;QACf,MAAM,GAAG,GAA0B,EAAE,CAAC;QAEtC,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,GAAG,CAAC,IAAI,CAAC;gBACP,EAAE,EAAE,IAAI,CAAC,SAAS;gBAClB,YAAY,EAAE,IAAI,CAAC,IAAI;aACxB,CAAC,CAAC;SACJ;QAED,OAAO,GAAG,CAAC;IACb,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU;QACd,OAA+B,CAC7B,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,EAAC,GAAG,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,YAAY,EAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CACjF,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,IAAA,aAAK,EAAC,eAAe,CAAC,CAAC"}