appium-webdriveragent 14.2.1 → 15.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/WebDriverAgentLib/Categories/XCUIDevice+FBRotation.h +8 -0
- package/WebDriverAgentLib/Categories/XCUIDevice+FBRotation.m +21 -0
- package/WebDriverAgentLib/Commands/FBOrientationCommands.m +7 -0
- package/WebDriverAgentLib/Info.plist +2 -2
- package/WebDriverAgentTests/IntegrationTests/XCUIDeviceRotationTests.m +21 -0
- package/build/lib/types.d.ts +44 -4
- package/build/lib/types.d.ts.map +1 -1
- package/build/lib/utils/index.d.ts +11 -0
- package/build/lib/utils/index.d.ts.map +1 -0
- package/build/lib/utils/index.js +27 -0
- package/build/lib/utils/index.js.map +1 -0
- package/build/lib/utils/module.d.ts +6 -0
- package/build/lib/utils/module.d.ts.map +1 -0
- package/build/lib/utils/module.js +31 -0
- package/build/lib/utils/module.js.map +1 -0
- package/build/lib/utils/platform.d.ts +7 -0
- package/build/lib/utils/platform.d.ts.map +1 -0
- package/build/lib/utils/platform.js +13 -0
- package/build/lib/utils/platform.js.map +1 -0
- package/build/lib/utils/processes.d.ts +23 -0
- package/build/lib/utils/processes.d.ts.map +1 -0
- package/build/lib/utils/processes.js +132 -0
- package/build/lib/utils/processes.js.map +1 -0
- package/build/lib/utils/security.d.ts +5 -0
- package/build/lib/utils/security.d.ts.map +1 -0
- package/build/lib/utils/security.js +15 -0
- package/build/lib/utils/security.js.map +1 -0
- package/build/lib/utils/xctestrun.d.ts +51 -0
- package/build/lib/utils/xctestrun.d.ts.map +1 -0
- package/build/lib/utils/xctestrun.js +120 -0
- package/build/lib/utils/xctestrun.js.map +1 -0
- package/build/lib/wda-strategies.d.ts +69 -0
- package/build/lib/wda-strategies.d.ts.map +1 -0
- package/build/lib/wda-strategies.js +253 -0
- package/build/lib/wda-strategies.js.map +1 -0
- package/build/lib/webdriveragent.d.ts +3 -14
- package/build/lib/webdriveragent.d.ts.map +1 -1
- package/build/lib/webdriveragent.js +78 -127
- package/build/lib/webdriveragent.js.map +1 -1
- package/build/lib/xcodebuild.d.ts.map +1 -1
- package/build/lib/xcodebuild.js +29 -7
- package/build/lib/xcodebuild.js.map +1 -1
- package/lib/types.ts +58 -4
- package/lib/utils/index.ts +20 -0
- package/lib/utils/module.ts +29 -0
- package/lib/utils/platform.ts +10 -0
- package/lib/utils/processes.ts +135 -0
- package/lib/utils/security.ts +15 -0
- package/lib/utils/xctestrun.ts +160 -0
- package/lib/wda-strategies.ts +340 -0
- package/lib/webdriveragent.ts +89 -163
- package/lib/xcodebuild.ts +34 -17
- package/package.json +2 -3
- package/build/lib/utils.d.ts +0 -105
- package/build/lib/utils.d.ts.map +0 -1
- package/build/lib/utils.js +0 -413
- package/build/lib/utils.js.map +0 -1
- package/lib/utils.ts +0 -442
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## [15.1.0](https://github.com/appium/WebDriverAgent/compare/v15.0.0...v15.1.0) (2026-06-26)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* Expose device orientation via /wda/deviceOrientation ([#1162](https://github.com/appium/WebDriverAgent/issues/1162)) ([deb623c](https://github.com/appium/WebDriverAgent/commit/deb623c71a0598f1932c8018f985b973aa2fb9ff))
|
|
6
|
+
|
|
7
|
+
## [15.0.0](https://github.com/appium/WebDriverAgent/compare/v14.2.1...v15.0.0) (2026-06-22)
|
|
8
|
+
|
|
9
|
+
### ⚠ BREAKING CHANGES
|
|
10
|
+
|
|
11
|
+
* AppleDevice is now abstract and only contains udid; it no longer exposes simctl or devicectl.
|
|
12
|
+
* Preinstalled WDA launch/terminate no longer falls back to package-owned simctl or devicectl behavior. Callers must provide hostOps.simulator or hostOps.realDevicePreinstalled for those flows.
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* Abstract out platform-specific actions ([#1160](https://github.com/appium/WebDriverAgent/issues/1160)) ([890d32b](https://github.com/appium/WebDriverAgent/commit/890d32b4ac3fa881784dacc012650d58274941c8))
|
|
17
|
+
|
|
1
18
|
## [14.2.1](https://github.com/appium/WebDriverAgent/compare/v14.2.0...v14.2.1) (2026-06-19)
|
|
2
19
|
|
|
3
20
|
### Miscellaneous Chores
|
|
@@ -32,6 +32,14 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
32
32
|
/*! The UIDeviceOrientation to rotation mappings */
|
|
33
33
|
@property (strong, nonatomic, readonly) NSDictionary *fb_rotationMapping;
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
The current physical device orientation as the raw UIDeviceOrientation name string,
|
|
37
|
+
e.g. UIDeviceOrientationPortrait, UIDeviceOrientationLandscapeLeft,
|
|
38
|
+
UIDeviceOrientationFaceUp. Returns UIDeviceOrientationUnknown if the orientation
|
|
39
|
+
cannot be determined.
|
|
40
|
+
*/
|
|
41
|
+
@property (copy, nonatomic, readonly) NSString *fb_deviceOrientation;
|
|
42
|
+
|
|
35
43
|
@end
|
|
36
44
|
#endif
|
|
37
45
|
|
|
@@ -64,6 +64,27 @@ static UIInterfaceOrientation FBInterfaceOrientationFromDeviceOrientation(UIDevi
|
|
|
64
64
|
return application.interfaceOrientation == FBInterfaceOrientationFromDeviceOrientation(orientation);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
- (NSString *)fb_deviceOrientation
|
|
68
|
+
{
|
|
69
|
+
switch (self.orientation) {
|
|
70
|
+
case UIDeviceOrientationPortrait:
|
|
71
|
+
return @"UIDeviceOrientationPortrait";
|
|
72
|
+
case UIDeviceOrientationPortraitUpsideDown:
|
|
73
|
+
return @"UIDeviceOrientationPortraitUpsideDown";
|
|
74
|
+
case UIDeviceOrientationLandscapeLeft:
|
|
75
|
+
return @"UIDeviceOrientationLandscapeLeft";
|
|
76
|
+
case UIDeviceOrientationLandscapeRight:
|
|
77
|
+
return @"UIDeviceOrientationLandscapeRight";
|
|
78
|
+
case UIDeviceOrientationFaceUp:
|
|
79
|
+
return @"UIDeviceOrientationFaceUp";
|
|
80
|
+
case UIDeviceOrientationFaceDown:
|
|
81
|
+
return @"UIDeviceOrientationFaceDown";
|
|
82
|
+
case UIDeviceOrientationUnknown:
|
|
83
|
+
default:
|
|
84
|
+
return @"UIDeviceOrientationUnknown";
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
67
88
|
- (NSDictionary *)fb_rotationMapping
|
|
68
89
|
{
|
|
69
90
|
static NSDictionary *rotationMap;
|
|
@@ -47,6 +47,8 @@ const struct FBWDOrientationValues FBWDOrientationValues = {
|
|
|
47
47
|
[[FBRoute GET:@"/rotation"].withoutSession respondWithTarget:self action:@selector(handleGetRotation:)],
|
|
48
48
|
[[FBRoute POST:@"/rotation"] respondWithTarget:self action:@selector(handleSetRotation:)],
|
|
49
49
|
[[FBRoute POST:@"/rotation"].withoutSession respondWithTarget:self action:@selector(handleSetRotation:)],
|
|
50
|
+
[[FBRoute GET:@"/wda/deviceOrientation"] respondWithTarget:self action:@selector(handleGetDeviceOrientation:)],
|
|
51
|
+
[[FBRoute GET:@"/wda/deviceOrientation"].withoutSession respondWithTarget:self action:@selector(handleGetDeviceOrientation:)],
|
|
50
52
|
];
|
|
51
53
|
}
|
|
52
54
|
|
|
@@ -113,6 +115,11 @@ const struct FBWDOrientationValues FBWDOrientationValues = {
|
|
|
113
115
|
return FBResponseWithOK();
|
|
114
116
|
}
|
|
115
117
|
|
|
118
|
+
+ (id<FBResponsePayload>)handleGetDeviceOrientation:(FBRouteRequest *)request
|
|
119
|
+
{
|
|
120
|
+
return FBResponseWithObject(XCUIDevice.sharedDevice.fb_deviceOrientation);
|
|
121
|
+
}
|
|
122
|
+
|
|
116
123
|
|
|
117
124
|
#pragma mark - Helpers
|
|
118
125
|
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
<key>CFBundlePackageType</key>
|
|
16
16
|
<string>FMWK</string>
|
|
17
17
|
<key>CFBundleShortVersionString</key>
|
|
18
|
-
<string>
|
|
18
|
+
<string>15.1.0</string>
|
|
19
19
|
<key>CFBundleSignature</key>
|
|
20
20
|
<string>????</string>
|
|
21
21
|
<key>CFBundleVersion</key>
|
|
22
|
-
<string>
|
|
22
|
+
<string>15.1.0</string>
|
|
23
23
|
<key>NSPrincipalClass</key>
|
|
24
24
|
<string/>
|
|
25
25
|
</dict>
|
|
@@ -69,6 +69,27 @@
|
|
|
69
69
|
XCTAssertTrue(self.testedApplication.staticTexts[@"LandscapeRight"].exists);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
- (void)testGetDeviceOrientationInPortrait
|
|
73
|
+
{
|
|
74
|
+
BOOL success = [[XCUIDevice sharedDevice] fb_setDeviceInterfaceOrientation:UIDeviceOrientationPortrait];
|
|
75
|
+
XCTAssertTrue(success, @"Device should support Portrait");
|
|
76
|
+
XCTAssertEqualObjects([XCUIDevice sharedDevice].fb_deviceOrientation, @"UIDeviceOrientationPortrait");
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
- (void)testGetDeviceOrientationInLandscapeLeft
|
|
80
|
+
{
|
|
81
|
+
BOOL success = [[XCUIDevice sharedDevice] fb_setDeviceInterfaceOrientation:UIDeviceOrientationLandscapeLeft];
|
|
82
|
+
XCTAssertTrue(success, @"Device should support LandscapeLeft");
|
|
83
|
+
XCTAssertEqualObjects([XCUIDevice sharedDevice].fb_deviceOrientation, @"UIDeviceOrientationLandscapeLeft");
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
- (void)testGetDeviceOrientationInLandscapeRight
|
|
87
|
+
{
|
|
88
|
+
BOOL success = [[XCUIDevice sharedDevice] fb_setDeviceInterfaceOrientation:UIDeviceOrientationLandscapeRight];
|
|
89
|
+
XCTAssertTrue(success, @"Device should support LandscapeRight");
|
|
90
|
+
XCTAssertEqualObjects([XCUIDevice sharedDevice].fb_deviceOrientation, @"UIDeviceOrientationLandscapeRight");
|
|
91
|
+
}
|
|
92
|
+
|
|
72
93
|
- (void)testRotationTiltRotation
|
|
73
94
|
{
|
|
74
95
|
UIDeviceOrientation currentRotation = [XCUIDevice sharedDevice].orientation;
|
package/build/lib/types.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { type HTTPHeaders } from '@appium/types';
|
|
2
|
-
import type { Simctl } from 'node-simctl';
|
|
3
|
-
import type { Devicectl } from 'node-devicectl';
|
|
4
2
|
export interface WDASettings {
|
|
5
3
|
elementResponseAttribute?: string;
|
|
6
4
|
shouldUseCompactResponses?: boolean;
|
|
@@ -88,11 +86,53 @@ export interface WebDriverAgentArgs {
|
|
|
88
86
|
reqBasePath?: string;
|
|
89
87
|
launchTimeout?: number;
|
|
90
88
|
extraRequestHeaders?: HTTPHeaders;
|
|
89
|
+
hostOps?: WdaHostOps;
|
|
91
90
|
}
|
|
92
91
|
export interface AppleDevice {
|
|
93
92
|
udid: string;
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
}
|
|
94
|
+
export type WdaStartupStrategyName = 'existing-url' | 'simulator' | 'real-device-xcodebuild' | 'real-device-preinstalled';
|
|
95
|
+
export type WdaLaunchEnvironment = Record<string, string | number>;
|
|
96
|
+
export interface WdaLaunchOptions {
|
|
97
|
+
udid: string;
|
|
98
|
+
bundleId: string;
|
|
99
|
+
env: WdaLaunchEnvironment;
|
|
100
|
+
wdaLocalPort?: number;
|
|
101
|
+
wdaRemotePort: number;
|
|
102
|
+
platformName?: string;
|
|
103
|
+
platformVersion?: string;
|
|
104
|
+
timeoutMs: number;
|
|
105
|
+
}
|
|
106
|
+
export interface WdaTerminateOptions {
|
|
107
|
+
udid: string;
|
|
108
|
+
bundleId: string;
|
|
109
|
+
}
|
|
110
|
+
export interface WdaResetTestProcessesOptions {
|
|
111
|
+
udid: string;
|
|
112
|
+
isSimulator: boolean;
|
|
113
|
+
}
|
|
114
|
+
export interface WdaCleanupObsoleteProcessesOptions {
|
|
115
|
+
udid: string;
|
|
116
|
+
port: string;
|
|
117
|
+
commandLineIncludes: string;
|
|
118
|
+
}
|
|
119
|
+
export interface SimulatorHostOps {
|
|
120
|
+
launchPreinstalled(opts: WdaLaunchOptions): Promise<void>;
|
|
121
|
+
terminate(opts: WdaTerminateOptions): Promise<void>;
|
|
122
|
+
resetTestProcesses?(opts: WdaResetTestProcessesOptions): Promise<void>;
|
|
123
|
+
}
|
|
124
|
+
export interface RealDevicePreinstalledHostOps {
|
|
125
|
+
launchPreinstalled(opts: WdaLaunchOptions): Promise<void>;
|
|
126
|
+
terminate(opts: WdaTerminateOptions): Promise<void>;
|
|
127
|
+
}
|
|
128
|
+
export interface RealDeviceXcodebuildHostOps {
|
|
129
|
+
resetTestProcesses?(opts: WdaResetTestProcessesOptions): Promise<void>;
|
|
130
|
+
cleanupObsoleteProcesses?(opts: WdaCleanupObsoleteProcessesOptions): Promise<void>;
|
|
131
|
+
}
|
|
132
|
+
export interface WdaHostOps {
|
|
133
|
+
simulator?: SimulatorHostOps;
|
|
134
|
+
realDevicePreinstalled?: RealDevicePreinstalledHostOps;
|
|
135
|
+
realDeviceXcodebuild?: RealDeviceXcodebuildHostOps;
|
|
96
136
|
}
|
|
97
137
|
/**
|
|
98
138
|
* Information of the device under test
|
package/build/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,WAAW,EAAC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,WAAW,EAAC,MAAM,eAAe,CAAC;AAG/C,MAAM,WAAW,WAAW;IAC1B,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,oBAAoB,CAAC,EAAE,MAAM,CAAC;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AAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mCAAmC,CAAC,EAAE,OAAO,CAAC;IAC9C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,WAAW,CAAC;CACnC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { BOOTSTRAP_PATH } from './module';
|
|
2
|
+
export { isTvOS } from './platform';
|
|
3
|
+
export { getPIDsListeningOnPort, killAppUsingPattern, resetTestProcesses } from './processes';
|
|
4
|
+
export { setRealDeviceSecurity } from './security';
|
|
5
|
+
export { getAdditionalRunContent, getXctestrunFileName, getXctestrunFilePath, setXctestrunFile, } from './xctestrun';
|
|
6
|
+
export type { XctestrunFileArgs } from './xctestrun';
|
|
7
|
+
/**
|
|
8
|
+
* Retrieves WDA upgrade timestamp. The manifest only gets modified on package upgrade.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getWDAUpgradeTimestamp(): Promise<number | null>;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/utils/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,cAAc,EAAC,MAAM,UAAU,CAAC;AACxC,OAAO,EAAC,MAAM,EAAC,MAAM,YAAY,CAAC;AAClC,OAAO,EAAC,sBAAsB,EAAE,mBAAmB,EAAE,kBAAkB,EAAC,MAAM,aAAa,CAAC;AAC5F,OAAO,EAAC,qBAAqB,EAAC,MAAM,YAAY,CAAC;AACjD,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAC,iBAAiB,EAAC,MAAM,aAAa,CAAC;AAEnD;;GAEG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAErE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setXctestrunFile = exports.getXctestrunFilePath = exports.getXctestrunFileName = exports.getAdditionalRunContent = exports.setRealDeviceSecurity = exports.resetTestProcesses = exports.killAppUsingPattern = exports.getPIDsListeningOnPort = exports.isTvOS = exports.BOOTSTRAP_PATH = void 0;
|
|
4
|
+
exports.getWDAUpgradeTimestamp = getWDAUpgradeTimestamp;
|
|
5
|
+
const module_1 = require("./module");
|
|
6
|
+
var module_2 = require("./module");
|
|
7
|
+
Object.defineProperty(exports, "BOOTSTRAP_PATH", { enumerable: true, get: function () { return module_2.BOOTSTRAP_PATH; } });
|
|
8
|
+
var platform_1 = require("./platform");
|
|
9
|
+
Object.defineProperty(exports, "isTvOS", { enumerable: true, get: function () { return platform_1.isTvOS; } });
|
|
10
|
+
var processes_1 = require("./processes");
|
|
11
|
+
Object.defineProperty(exports, "getPIDsListeningOnPort", { enumerable: true, get: function () { return processes_1.getPIDsListeningOnPort; } });
|
|
12
|
+
Object.defineProperty(exports, "killAppUsingPattern", { enumerable: true, get: function () { return processes_1.killAppUsingPattern; } });
|
|
13
|
+
Object.defineProperty(exports, "resetTestProcesses", { enumerable: true, get: function () { return processes_1.resetTestProcesses; } });
|
|
14
|
+
var security_1 = require("./security");
|
|
15
|
+
Object.defineProperty(exports, "setRealDeviceSecurity", { enumerable: true, get: function () { return security_1.setRealDeviceSecurity; } });
|
|
16
|
+
var xctestrun_1 = require("./xctestrun");
|
|
17
|
+
Object.defineProperty(exports, "getAdditionalRunContent", { enumerable: true, get: function () { return xctestrun_1.getAdditionalRunContent; } });
|
|
18
|
+
Object.defineProperty(exports, "getXctestrunFileName", { enumerable: true, get: function () { return xctestrun_1.getXctestrunFileName; } });
|
|
19
|
+
Object.defineProperty(exports, "getXctestrunFilePath", { enumerable: true, get: function () { return xctestrun_1.getXctestrunFilePath; } });
|
|
20
|
+
Object.defineProperty(exports, "setXctestrunFile", { enumerable: true, get: function () { return xctestrun_1.setXctestrunFile; } });
|
|
21
|
+
/**
|
|
22
|
+
* Retrieves WDA upgrade timestamp. The manifest only gets modified on package upgrade.
|
|
23
|
+
*/
|
|
24
|
+
async function getWDAUpgradeTimestamp() {
|
|
25
|
+
return await (0, module_1.getWDAUpgradeTimestamp)();
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/utils/index.ts"],"names":[],"mappings":";;;AAiBA,wDAEC;AAnBD,qCAA8E;AAE9E,mCAAwC;AAAhC,wGAAA,cAAc,OAAA;AACtB,uCAAkC;AAA1B,kGAAA,MAAM,OAAA;AACd,yCAA4F;AAApF,mHAAA,sBAAsB,OAAA;AAAE,gHAAA,mBAAmB,OAAA;AAAE,+GAAA,kBAAkB,OAAA;AACvE,uCAAiD;AAAzC,iHAAA,qBAAqB,OAAA;AAC7B,yCAKqB;AAJnB,oHAAA,uBAAuB,OAAA;AACvB,iHAAA,oBAAoB,OAAA;AACpB,iHAAA,oBAAoB,OAAA;AACpB,6GAAA,gBAAgB,OAAA;AAIlB;;GAEG;AACI,KAAK,UAAU,sBAAsB;IAC1C,OAAO,MAAM,IAAA,+BAA0B,GAAE,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../lib/utils/module.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,cAAc,QAAa,CAAC;AAEzC;;GAEG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAOrE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
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.BOOTSTRAP_PATH = void 0;
|
|
7
|
+
exports.getWDAUpgradeTimestamp = getWDAUpgradeTimestamp;
|
|
8
|
+
const support_1 = require("@appium/support");
|
|
9
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
+
const node_url_1 = require("node:url");
|
|
11
|
+
// Get current filename - works in both CommonJS and ESM
|
|
12
|
+
const currentFilename = typeof __filename !== 'undefined'
|
|
13
|
+
? __filename
|
|
14
|
+
: (0, node_url_1.fileURLToPath)(new Function('return import.meta.url')());
|
|
15
|
+
const moduleRoot = support_1.node.getModuleRootSync('appium-webdriveragent', currentFilename);
|
|
16
|
+
if (!moduleRoot) {
|
|
17
|
+
throw new Error('Cannot find the root folder of the appium-webdriveragent Node.js module');
|
|
18
|
+
}
|
|
19
|
+
exports.BOOTSTRAP_PATH = moduleRoot;
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves WDA upgrade timestamp. The manifest only gets modified on package upgrade.
|
|
22
|
+
*/
|
|
23
|
+
async function getWDAUpgradeTimestamp() {
|
|
24
|
+
const packageManifest = node_path_1.default.resolve(exports.BOOTSTRAP_PATH, 'package.json');
|
|
25
|
+
if (!(await support_1.fs.exists(packageManifest))) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
const { mtime } = await support_1.fs.stat(packageManifest);
|
|
29
|
+
return mtime.getTime();
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../lib/utils/module.ts"],"names":[],"mappings":";;;;;;AAqBA,wDAOC;AA5BD,6CAAwD;AACxD,0DAA6B;AAC7B,uCAAuC;AAEvC,wDAAwD;AACxD,MAAM,eAAe,GACnB,OAAO,UAAU,KAAK,WAAW;IAC/B,CAAC,CAAC,UAAU;IACZ,CAAC,CAAC,IAAA,wBAAa,EAAC,IAAI,QAAQ,CAAC,wBAAwB,CAAC,EAAE,CAAC,CAAC;AAE9D,MAAM,UAAU,GAAG,cAAW,CAAC,iBAAiB,CAAC,uBAAuB,EAAE,eAAe,CAAC,CAAC;AAE3F,IAAI,CAAC,UAAU,EAAE,CAAC;IAChB,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;AAC7F,CAAC;AAEY,QAAA,cAAc,GAAG,UAAU,CAAC;AAEzC;;GAEG;AACI,KAAK,UAAU,sBAAsB;IAC1C,MAAM,eAAe,GAAG,mBAAI,CAAC,OAAO,CAAC,sBAAc,EAAE,cAAc,CAAC,CAAC;IACrE,IAAI,CAAC,CAAC,MAAM,YAAE,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,EAAC,KAAK,EAAC,GAAG,MAAM,YAAE,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC/C,OAAO,KAAK,CAAC,OAAO,EAAE,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../../lib/utils/platform.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAEpD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isTvOS = isTvOS;
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
/**
|
|
6
|
+
* Return true if the platformName is tvOS
|
|
7
|
+
* @param platformName The name of the platform
|
|
8
|
+
* @returns Return true if the platformName is tvOS
|
|
9
|
+
*/
|
|
10
|
+
function isTvOS(platformName) {
|
|
11
|
+
return platformName?.toLowerCase() === constants_1.PLATFORM_NAME_TVOS.toLowerCase();
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=platform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../../../lib/utils/platform.ts"],"names":[],"mappings":";;AAOA,wBAEC;AATD,4CAAgD;AAEhD;;;;GAIG;AACH,SAAgB,MAAM,CAAC,YAAoB;IACzC,OAAO,YAAY,EAAE,WAAW,EAAE,KAAK,8BAAkB,CAAC,WAAW,EAAE,CAAC;AAC1E,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Find and terminate all processes matching the given pgrep pattern.
|
|
3
|
+
*/
|
|
4
|
+
export declare function killAppUsingPattern(pgrepPattern: string): Promise<void>;
|
|
5
|
+
/**
|
|
6
|
+
* Kills running XCTest processes for the particular device.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resetTestProcesses(udid: string, isSimulator: boolean): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* Get the IDs of processes listening on the particular system port.
|
|
11
|
+
* It is also possible to apply additional filtering based on the
|
|
12
|
+
* process command line.
|
|
13
|
+
*
|
|
14
|
+
* @param port - The port number.
|
|
15
|
+
* @param filteringFunc - Optional lambda function, which
|
|
16
|
+
* receives command line string of the particular process
|
|
17
|
+
* listening on given port, and is expected to return
|
|
18
|
+
* either true or false to include/exclude the corresponding PID
|
|
19
|
+
* from the resulting array.
|
|
20
|
+
* @returns - the list of matched process ids.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getPIDsListeningOnPort(port: string | number, filteringFunc?: ((cmdline: string) => boolean | Promise<boolean>) | null): Promise<string[]>;
|
|
23
|
+
//# sourceMappingURL=processes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processes.d.ts","sourceRoot":"","sources":["../../../lib/utils/processes.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA0C7E;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAS1F;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,MAAM,GAAG,MAAM,EACrB,aAAa,GAAE,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,IAAW,GAC7E,OAAO,CAAC,MAAM,EAAE,CAAC,CAiCnB"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.killAppUsingPattern = killAppUsingPattern;
|
|
4
|
+
exports.resetTestProcesses = resetTestProcesses;
|
|
5
|
+
exports.getPIDsListeningOnPort = getPIDsListeningOnPort;
|
|
6
|
+
const asyncbox_1 = require("asyncbox");
|
|
7
|
+
const teen_process_1 = require("teen_process");
|
|
8
|
+
const logger_1 = require("../logger");
|
|
9
|
+
/**
|
|
10
|
+
* Find and terminate all processes matching the given pgrep pattern.
|
|
11
|
+
*/
|
|
12
|
+
async function killAppUsingPattern(pgrepPattern) {
|
|
13
|
+
const signals = [2, 15, 9];
|
|
14
|
+
for (const signal of signals) {
|
|
15
|
+
const matchedPids = await getPIDsUsingPattern(pgrepPattern);
|
|
16
|
+
if (matchedPids.length === 0) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const args = [`-${signal}`, ...matchedPids];
|
|
20
|
+
try {
|
|
21
|
+
await (0, teen_process_1.exec)('kill', args);
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
logger_1.log.debug(`kill ${args.join(' ')} -> ${err.message}`);
|
|
25
|
+
}
|
|
26
|
+
if (signal === signals[signals.length - 1]) {
|
|
27
|
+
// there is no need to wait after SIGKILL
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
await (0, asyncbox_1.waitForCondition)(async () => {
|
|
32
|
+
const pidCheckPromises = matchedPids.map(async (pid) => {
|
|
33
|
+
try {
|
|
34
|
+
await (0, teen_process_1.exec)('kill', ['-0', pid]);
|
|
35
|
+
// the process is still alive
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
// the process is dead
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
return (await Promise.all(pidCheckPromises)).every((x) => x === true);
|
|
44
|
+
}, {
|
|
45
|
+
waitMs: 1000,
|
|
46
|
+
intervalMs: 100,
|
|
47
|
+
});
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
// try the next signal
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Kills running XCTest processes for the particular device.
|
|
57
|
+
*/
|
|
58
|
+
async function resetTestProcesses(udid, isSimulator) {
|
|
59
|
+
const processPatterns = [`xcodebuild.*${udid}`];
|
|
60
|
+
if (isSimulator) {
|
|
61
|
+
processPatterns.push(`${udid}.*XCTRunner`);
|
|
62
|
+
// Some XCTest launches might not include xcodebuild in their command line
|
|
63
|
+
processPatterns.push(`xctest.*${udid}`);
|
|
64
|
+
}
|
|
65
|
+
logger_1.log.debug(`Killing running processes '${processPatterns.join(', ')}' for the device ${udid}...`);
|
|
66
|
+
await Promise.all(processPatterns.map(killAppUsingPattern));
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Get the IDs of processes listening on the particular system port.
|
|
70
|
+
* It is also possible to apply additional filtering based on the
|
|
71
|
+
* process command line.
|
|
72
|
+
*
|
|
73
|
+
* @param port - The port number.
|
|
74
|
+
* @param filteringFunc - Optional lambda function, which
|
|
75
|
+
* receives command line string of the particular process
|
|
76
|
+
* listening on given port, and is expected to return
|
|
77
|
+
* either true or false to include/exclude the corresponding PID
|
|
78
|
+
* from the resulting array.
|
|
79
|
+
* @returns - the list of matched process ids.
|
|
80
|
+
*/
|
|
81
|
+
async function getPIDsListeningOnPort(port, filteringFunc = null) {
|
|
82
|
+
const result = [];
|
|
83
|
+
try {
|
|
84
|
+
// This only works since Mac OS X El Capitan
|
|
85
|
+
const { stdout } = await (0, teen_process_1.exec)('lsof', ['-ti', `tcp:${port}`]);
|
|
86
|
+
result.push(...stdout.trim().split(/\n+/));
|
|
87
|
+
}
|
|
88
|
+
catch (e) {
|
|
89
|
+
if (e.code !== 1) {
|
|
90
|
+
// code 1 means no processes. Other errors need reporting
|
|
91
|
+
logger_1.log.debug(`Error getting processes listening on port '${port}': ${e.stderr || e.message}`);
|
|
92
|
+
}
|
|
93
|
+
return result;
|
|
94
|
+
}
|
|
95
|
+
if (typeof filteringFunc !== 'function') {
|
|
96
|
+
return result;
|
|
97
|
+
}
|
|
98
|
+
const filtered = await Promise.all(result.map(async (pid) => {
|
|
99
|
+
let stdout;
|
|
100
|
+
try {
|
|
101
|
+
({ stdout } = await (0, teen_process_1.exec)('ps', ['-p', pid, '-o', 'command']));
|
|
102
|
+
}
|
|
103
|
+
catch (e) {
|
|
104
|
+
if (e.code === 1) {
|
|
105
|
+
// The process does not exist anymore, there's nothing to filter
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
throw e;
|
|
109
|
+
}
|
|
110
|
+
return (await filteringFunc(stdout)) ? pid : null;
|
|
111
|
+
}));
|
|
112
|
+
return filtered.filter((pid) => Boolean(pid));
|
|
113
|
+
}
|
|
114
|
+
async function getPIDsUsingPattern(pattern) {
|
|
115
|
+
const args = [
|
|
116
|
+
'-if', // case insensitive, full cmdline match
|
|
117
|
+
pattern,
|
|
118
|
+
];
|
|
119
|
+
try {
|
|
120
|
+
const { stdout } = await (0, teen_process_1.exec)('pgrep', args);
|
|
121
|
+
return stdout
|
|
122
|
+
.split(/\s+/)
|
|
123
|
+
.map((x) => parseInt(x, 10))
|
|
124
|
+
.filter(Number.isInteger)
|
|
125
|
+
.map((x) => `${x}`);
|
|
126
|
+
}
|
|
127
|
+
catch (err) {
|
|
128
|
+
logger_1.log.debug(`'pgrep ${args.join(' ')}' didn't detect any matching processes. Return code: ${err.code}`);
|
|
129
|
+
return [];
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=processes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processes.js","sourceRoot":"","sources":["../../../lib/utils/processes.ts"],"names":[],"mappings":";;AAOA,kDA0CC;AAKD,gDASC;AAeD,wDAoCC;AAlHD,uCAA0C;AAC1C,+CAAkC;AAClC,sCAA8B;AAE9B;;GAEG;AACI,KAAK,UAAU,mBAAmB,CAAC,YAAoB;IAC5D,MAAM,OAAO,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAC3B,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,WAAW,GAAG,MAAM,mBAAmB,CAAC,YAAY,CAAC,CAAC;QAC5D,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7B,OAAO;QACT,CAAC;QACD,MAAM,IAAI,GAAG,CAAC,IAAI,MAAM,EAAE,EAAE,GAAG,WAAW,CAAC,CAAC;QAC5C,IAAI,CAAC;YACH,MAAM,IAAA,mBAAI,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC3B,CAAC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|
+
{"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../../lib/utils/security.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,YAAY,EAAE,MAAM,EACpB,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC,CAKf"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setRealDeviceSecurity = setRealDeviceSecurity;
|
|
4
|
+
const teen_process_1 = require("teen_process");
|
|
5
|
+
const logger_1 = require("../logger");
|
|
6
|
+
/**
|
|
7
|
+
* Configure keychain access required for real-device code signing.
|
|
8
|
+
*/
|
|
9
|
+
async function setRealDeviceSecurity(keychainPath, keychainPassword) {
|
|
10
|
+
logger_1.log.debug('Setting security for iOS device');
|
|
11
|
+
await (0, teen_process_1.exec)('security', ['-v', 'list-keychains', '-s', keychainPath]);
|
|
12
|
+
await (0, teen_process_1.exec)('security', ['-v', 'unlock-keychain', '-p', keychainPassword, keychainPath]);
|
|
13
|
+
await (0, teen_process_1.exec)('security', ['set-keychain-settings', '-t', '3600', '-l', keychainPath]);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=security.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security.js","sourceRoot":"","sources":["../../../lib/utils/security.ts"],"names":[],"mappings":";;AAMA,sDAQC;AAdD,+CAAkC;AAClC,sCAA8B;AAE9B;;GAEG;AACI,KAAK,UAAU,qBAAqB,CACzC,YAAoB,EACpB,gBAAwB;IAExB,YAAG,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC;IAC7C,MAAM,IAAA,mBAAI,EAAC,UAAU,EAAE,CAAC,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC;IACrE,MAAM,IAAA,mBAAI,EAAC,UAAU,EAAE,CAAC,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,gBAAgB,EAAE,YAAY,CAAC,CAAC,CAAC;IACxF,MAAM,IAAA,mBAAI,EAAC,UAAU,EAAE,CAAC,uBAAuB,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC;AACtF,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { DeviceInfo } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Arguments for setting xctestrun file
|
|
4
|
+
*/
|
|
5
|
+
export interface XctestrunFileArgs {
|
|
6
|
+
deviceInfo: DeviceInfo;
|
|
7
|
+
sdkVersion: string;
|
|
8
|
+
bootstrapPath: string;
|
|
9
|
+
wdaRemotePort: number | string;
|
|
10
|
+
wdaBindingIP?: string;
|
|
11
|
+
maxHttpRequestBodySize?: number | string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Creates xctestrun file per device & platform version.
|
|
15
|
+
* We expect to have WebDriverAgentRunner_iphoneos${sdkVersion|platformVersion}-arm64.xctestrun for real device
|
|
16
|
+
* and WebDriverAgentRunner_iphonesimulator${sdkVersion|platformVersion}-${x86_64|arm64}.xctestrun for simulator located @bootstrapPath
|
|
17
|
+
* Newer Xcode (Xcode 10.0 at least) generates xctestrun file following sdkVersion.
|
|
18
|
+
* e.g. Xcode which has iOS SDK Version 12.2 on an intel Mac host machine generates WebDriverAgentRunner_iphonesimulator.2-x86_64.xctestrun
|
|
19
|
+
* even if the cap has platform version 11.4
|
|
20
|
+
*
|
|
21
|
+
* @param args
|
|
22
|
+
* @return returns xctestrunFilePath for given device
|
|
23
|
+
* @throws if WebDriverAgentRunner_iphoneos${sdkVersion|platformVersion}-arm64.xctestrun for real device
|
|
24
|
+
* or WebDriverAgentRunner_iphonesimulator${sdkVersion|platformVersion}-x86_64.xctestrun for simulator is not found @bootstrapPath,
|
|
25
|
+
* then it will throw a file not found exception
|
|
26
|
+
*/
|
|
27
|
+
export declare function setXctestrunFile(args: XctestrunFileArgs): Promise<string>;
|
|
28
|
+
/**
|
|
29
|
+
* Return the WDA object which appends existing xctest runner content
|
|
30
|
+
* @param platformName - The name of the platform
|
|
31
|
+
* @param wdaRemotePort - The remote port number
|
|
32
|
+
* @param wdaBindingIP - The IP address to bind to. If not given, it binds to all interfaces.
|
|
33
|
+
* @param maxHttpRequestBodySize - The maximum HTTP request body size in bytes.
|
|
34
|
+
* @return returns a runner object which has USE_PORT and optionally USE_IP
|
|
35
|
+
*/
|
|
36
|
+
export declare function getAdditionalRunContent(platformName: string, wdaRemotePort: number | string, wdaBindingIP?: string, maxHttpRequestBodySize?: number | string): Record<string, any>;
|
|
37
|
+
/**
|
|
38
|
+
* Return the path of xctestrun if it exists
|
|
39
|
+
* @param deviceInfo
|
|
40
|
+
* @param sdkVersion - The Xcode SDK version of OS.
|
|
41
|
+
* @param bootstrapPath - The folder path containing xctestrun file.
|
|
42
|
+
*/
|
|
43
|
+
export declare function getXctestrunFilePath(deviceInfo: DeviceInfo, sdkVersion: string, bootstrapPath: string): Promise<string>;
|
|
44
|
+
/**
|
|
45
|
+
* Return the name of xctestrun file
|
|
46
|
+
* @param deviceInfo
|
|
47
|
+
* @param version - The Xcode SDK version of OS.
|
|
48
|
+
* @return returns xctestrunFilePath for given device
|
|
49
|
+
*/
|
|
50
|
+
export declare function getXctestrunFileName(deviceInfo: DeviceInfo, version: string): string;
|
|
51
|
+
//# sourceMappingURL=xctestrun.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xctestrun.d.ts","sourceRoot":"","sources":["../../../lib/utils/xctestrun.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAGzC;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sBAAsB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CAqB/E;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,GAAG,MAAM,EAC9B,YAAY,CAAC,EAAE,MAAM,EACrB,sBAAsB,CAAC,EAAE,MAAM,GAAG,MAAM,GACvC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAcrB;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,CAAC,CAmCjB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAKpF"}
|