react-native-clarity 2.3.0 → 3.0.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.
@@ -1,29 +1,33 @@
1
1
  import { NativeModules, Platform } from 'react-native';
2
- const LINKING_ERROR = `The package 'react-native-clarity' doesn't seem to be linked. Make sure: \n\n` +
3
- // Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) + TODO: add back when iOS is supported.
4
- '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
2
+ const LINKING_ERROR = `The package 'react-native-clarity' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
3
+ ios: "- You have run 'pod install --repo-update'\n",
4
+ default: ''
5
+ }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
5
6
  const Clarity = NativeModules.Clarity;
6
7
  const SupportedPlatforms = ['android'];
7
8
 
8
- /**
9
- * The configuration that will be used to customize the Clarity behaviour.
10
- *
11
- * @param userId [OPTIONAL default = null] A custom identifier for the current user. If passed as null, the user id
12
- * will be auto generated. The user id in general is sticky across sessions.
13
- * The provided user id must follow these conditions:
14
- * 1. Cannot be an empty string.
15
- * 2. Should be base36 and smaller than "1Z141Z4".
16
- * @param logLevel [OPTIONAL default = LogLevel.None] The level of logging to show in the device logcat stream.
17
- * @param allowMeteredNetworkUsage [OPTIONAL default = false] Allows uploading session data to the servers on device metered network.
18
- * @param enableWebViewCapture [OPTIONAL default = true] Allows Clarity to capture the web views DOM content.
19
- * @param allowedDomains [OPTIONAL default = ["*"]] The whitelisted domains to allow Clarity to capture their DOM content.
20
- * If it contains "*" as an element, all domains will be captured.
21
- * @param disableOnLowEndDevices [OPTIONAL default = false] Disable Clarity on low-end devices.
22
- * @param maximumDailyNetworkUsageInMB [OPTIONAL default = null] Maximum daily network usage for Clarity (null = No limit). When the limit is reached, Clarity will turn on lean mode.
9
+ /**
10
+ * The configuration that will be used to customize the Clarity behaviour.
11
+ *
12
+ * @param userId [OPTIONAL default = null] A custom identifier for the current user. If passed as null, the user id
13
+ * will be auto generated. The user id in general is sticky across sessions.
14
+ * The provided user id must follow these conditions:
15
+ * 1. Cannot be an empty string.
16
+ * 2. Should be base36 and smaller than "1Z141Z4".
17
+ * @param logLevel [OPTIONAL default = LogLevel.None] The level of logging to show in the device logcat stream.
18
+ * @param allowMeteredNetworkUsage [OPTIONAL default = false] Allows uploading session data to the servers on device metered network.
19
+ * @param enableWebViewCapture [OPTIONAL default = true] Allows Clarity to capture the web views DOM content.
20
+ * @param allowedDomains [OPTIONAL default = ["*"]] The whitelisted domains to allow Clarity to capture their DOM content.
21
+ * If it contains "*" as an element, all domains will be captured.
22
+ * Note: iOS currently does not support allowedDomains feature.
23
+ * @param disableOnLowEndDevices [OPTIONAL default = false] Disable Clarity on low-end devices.
24
+ * @param maximumDailyNetworkUsageInMB [OPTIONAL default = null] Maximum daily network usage for Clarity (null = No limit). When the limit is reached, Clarity will turn on lean mode.
25
+ * Note: iOS currently does not support limiting network usage.
26
+ * @param enableIOS_experimental [OPTIONAL default = false] Experimental flag to enable Clarity on iOS platform.
23
27
  */
24
28
 
25
- /**
26
- * The level of logging to show in the device logcat stream.
29
+ /**
30
+ * The level of logging to show in the device logcat stream.
27
31
  */
28
32
  export let LogLevel = /*#__PURE__*/function (LogLevel) {
29
33
  LogLevel["Verbose"] = "Verbose";
@@ -34,15 +38,26 @@ export let LogLevel = /*#__PURE__*/function (LogLevel) {
34
38
  LogLevel["None"] = "None";
35
39
  return LogLevel;
36
40
  }({});
41
+ function isClarityUnavailable() {
42
+ if (!SupportedPlatforms.includes(Platform.OS)) {
43
+ console.warn('Clarity supports ' + SupportedPlatforms.join(', ') + ' only for now.');
44
+ return true;
45
+ }
46
+ if (Clarity === null) {
47
+ console.error('Clarity did not initialize properly.', LINKING_ERROR);
48
+ return true;
49
+ }
50
+ return false;
51
+ }
37
52
 
38
- /**
39
- * Initializes the Clarity SDK if the API level is supported.
40
- * @param projectId [REQUIRED] The Clarity project id to send data to.
41
- * @param config [OPTIONAL] The clarity config, if not provided default values are used.
42
- */
53
+ /**
54
+ * Initializes the Clarity SDK if the API level is supported.
55
+ * @param projectId [REQUIRED] The Clarity project id to send data to.
56
+ * @param config [OPTIONAL] The clarity config, if not provided default values are used.
57
+ */
43
58
  export function initialize(projectId, config) {
44
- if (typeof projectId !== "string" || !(typeof config === "object" || typeof config === "undefined")) {
45
- throw Error("Invalid Clarity initialization arguments. Please check the docs for assitance.");
59
+ if (typeof projectId !== 'string' || !(typeof config === 'object' || typeof config === 'undefined')) {
60
+ throw Error('Invalid Clarity initialization arguments. Please check the docs for assitance.');
46
61
  }
47
62
 
48
63
  // applying default values
@@ -51,16 +66,15 @@ export function initialize(projectId, config) {
51
66
  logLevel = LogLevel.None,
52
67
  allowMeteredNetworkUsage = false,
53
68
  enableWebViewCapture = true,
54
- allowedDomains = ["*"],
69
+ allowedDomains = ['*'],
55
70
  disableOnLowEndDevices = false,
56
- maximumDailyNetworkUsageInMB = null
71
+ maximumDailyNetworkUsageInMB = null,
72
+ enableIOS_experimental = false
57
73
  } = config ?? {};
58
- if (!SupportedPlatforms.includes(Platform.OS)) {
59
- console.warn("Clarity supports " + SupportedPlatforms.join(", ") + " only for now.");
60
- return;
74
+ if (enableIOS_experimental === true && !SupportedPlatforms.includes('ios')) {
75
+ SupportedPlatforms.push('ios');
61
76
  }
62
- if (Clarity === null) {
63
- console.error("Clarity did not initialize properly.", LINKING_ERROR);
77
+ if (isClarityUnavailable()) {
64
78
  return;
65
79
  }
66
80
 
@@ -70,160 +84,115 @@ export function initialize(projectId, config) {
70
84
  Clarity.initialize(projectId, userId, logLevel, allowMeteredNetworkUsage, enableWebViewCapture, allowedDomains, disableOnLowEndDevices, enableDailyNetworkUsageLimit, refinedMaximumDailyNetworkUsageInMB);
71
85
  }
72
86
 
73
- /**
74
- * Pauses the Clarity capturing processes until the next resume() is called.
87
+ /**
88
+ * Pauses the Clarity capturing processes until the next resume() is called.
75
89
  */
76
90
  export function pause() {
77
- if (!SupportedPlatforms.includes(Platform.OS)) {
78
- console.warn("Clarity supports " + SupportedPlatforms.join(", ") + " only for now.");
79
- return;
80
- }
81
- if (Clarity === null) {
82
- console.error("Clarity did not initialize properly.", LINKING_ERROR);
83
- return;
91
+ if (isClarityUnavailable()) {
92
+ return Promise.resolve(undefined);
84
93
  }
85
- Clarity.pause();
94
+ return Clarity.pause();
86
95
  }
87
96
 
88
- /**
89
- * Resumes the Clarity capturing processes if they are not already resumed.
90
- * Note: Clarity starts capturing data right on initialization.
97
+ /**
98
+ * Resumes the Clarity capturing processes if they are not already resumed.
99
+ * Note: Clarity starts capturing data right on initialization.
91
100
  */
92
101
  export function resume() {
93
- if (!SupportedPlatforms.includes(Platform.OS)) {
94
- console.warn("Clarity supports " + SupportedPlatforms.join(", ") + " only for now.");
95
- return;
96
- }
97
- if (Clarity === null) {
98
- console.error("Clarity did not initialize properly.", LINKING_ERROR);
99
- return;
102
+ if (isClarityUnavailable()) {
103
+ return Promise.resolve(undefined);
100
104
  }
101
- Clarity.resume();
105
+ return Clarity.resume();
102
106
  }
103
107
 
104
- /**
105
- * Returns true if Clarity has been paused by the user.
108
+ /**
109
+ * Returns true if Clarity has been paused by the user.
106
110
  */
107
111
  export function isPaused() {
108
- if (!SupportedPlatforms.includes(Platform.OS)) {
109
- console.warn("Clarity supports " + SupportedPlatforms.join(", ") + " only for now.");
110
- return Promise.resolve(undefined);
111
- }
112
- if (Clarity === null) {
113
- console.error("Clarity did not initialize properly.", LINKING_ERROR);
112
+ if (isClarityUnavailable()) {
114
113
  return Promise.resolve(undefined);
115
114
  }
116
115
  return Clarity.isPaused();
117
116
  }
118
117
 
119
- /**
120
- * Sets a custom user id that can be used to identify the user. It has less
121
- * restrictions than the userId parameter. You can pass any string and
122
- * you can filter on it on the dashboard side. If you need the most efficient
123
- * filtering on the dashboard, use the userId parameter if possible.
124
- * <p>
125
- * Note: custom user id cannot be null or empty, or consists only of whitespaces.
126
- * </p>
127
- * @param customUserId The custom user id to set.
118
+ /**
119
+ * Sets a custom user id that can be used to identify the user. It has less
120
+ * restrictions than the userId parameter. You can pass any string and
121
+ * you can filter on it on the dashboard side. If you need the most efficient
122
+ * filtering on the dashboard, use the userId parameter if possible.
123
+ * <p>
124
+ * Note: custom user id cannot be null or empty, or consists only of whitespaces.
125
+ * </p>
126
+ * @param customUserId The custom user id to set.
128
127
  */
129
128
  export function setCustomUserId(customUserId) {
130
- if (!SupportedPlatforms.includes(Platform.OS)) {
131
- console.warn("Clarity supports " + SupportedPlatforms.join(", ") + " only for now.");
132
- return;
133
- }
134
- if (Clarity === null) {
135
- console.error("Clarity did not initialize properly.", LINKING_ERROR);
136
- return;
129
+ if (isClarityUnavailable()) {
130
+ return Promise.resolve(undefined);
137
131
  }
138
- Clarity.setCustomUserId(customUserId);
132
+ return Clarity.setCustomUserId(customUserId);
139
133
  }
140
134
 
141
- /**
142
- * Sets a custom session id that can be used to identify the session.
143
- * <p>
144
- * Note: custom session id cannot be null or empty, or consists only of whitespaces.
145
- * </p>
146
- * @param customSessionId The custom session id to set.
135
+ /**
136
+ * Sets a custom session id that can be used to identify the session.
137
+ * <p>
138
+ * Note: custom session id cannot be null or empty, or consists only of whitespaces.
139
+ * </p>
140
+ * @param customSessionId The custom session id to set.
147
141
  */
148
142
  export function setCustomSessionId(customSessionId) {
149
- if (!SupportedPlatforms.includes(Platform.OS)) {
150
- console.warn("Clarity supports " + SupportedPlatforms.join(", ") + " only for now.");
151
- return;
152
- }
153
- if (Clarity === null) {
154
- console.error("Clarity did not initialize properly.", LINKING_ERROR);
155
- return;
143
+ if (isClarityUnavailable()) {
144
+ return Promise.resolve(undefined);
156
145
  }
157
- Clarity.setCustomSessionId(customSessionId);
146
+ return Clarity.setCustomSessionId(customSessionId);
158
147
  }
159
148
 
160
- /**
161
- * Sets a custom tag for the current session.
162
- * @param key The tag key to set.
163
- * @param value The tag value to set.
149
+ /**
150
+ * Sets a custom tag for the current session.
151
+ * @param key The tag key to set.
152
+ * @param value The tag value to set.
164
153
  */
165
154
  export function setCustomTag(key, value) {
166
- if (!SupportedPlatforms.includes(Platform.OS)) {
167
- console.warn("Clarity supports " + SupportedPlatforms.join(", ") + " only for now.");
168
- return;
169
- }
170
- if (Clarity === null) {
171
- console.error("Clarity did not initialize properly.", LINKING_ERROR);
172
- return;
155
+ if (isClarityUnavailable()) {
156
+ return Promise.resolve(undefined);
173
157
  }
174
- Clarity.setCustomTag(key, value);
158
+ return Clarity.setCustomTag(key, value);
175
159
  }
176
160
 
177
- /**
178
- * For React Native applications only, this function is used to set the current screen name
179
- * in case the ReactNative Navigation package is used.
180
- * This will allow you to split and analyze your data on the screen names.
181
- * You can it set to `null` to remove the latest set value.
182
- * @param screenName The current screen name to set.
161
+ /**
162
+ * For React Native applications only, this function is used to set the current screen name
163
+ * in case the ReactNative Navigation package is used.
164
+ * This will allow you to split and analyze your data on the screen names.
165
+ * You can it set to `null` to remove the latest set value.
166
+ * @param screenName The current screen name to set.
183
167
  */
184
168
  export function setCurrentScreenName(screenName) {
185
- if (!SupportedPlatforms.includes(Platform.OS)) {
186
- console.warn("Clarity supports " + SupportedPlatforms.join(", ") + " only for now.");
187
- return;
188
- }
189
- if (Clarity === null) {
190
- console.error("Clarity did not initialize properly.", LINKING_ERROR);
191
- return;
169
+ if (isClarityUnavailable()) {
170
+ return Promise.resolve(undefined);
192
171
  }
193
- Clarity.setCurrentScreenName(screenName);
172
+ return Clarity.setCurrentScreenName(screenName);
194
173
  }
195
174
 
196
- /**
197
- * Returns the active session id. This can be used to correlate the Clarity session with other
198
- * analytics tools that the developer may be using.
199
- * @returns a promise that resolves to the current session id.
175
+ /**
176
+ * Returns the active session id. This can be used to correlate the Clarity session with other
177
+ * analytics tools that the developer may be using.
178
+ * @returns a promise that resolves to the current session id.
200
179
  */
201
180
  export function getCurrentSessionId() {
202
- if (!SupportedPlatforms.includes(Platform.OS)) {
203
- console.warn("Clarity supports " + SupportedPlatforms.join(", ") + " only for now.");
204
- return Promise.resolve("Undefined");
205
- }
206
- if (Clarity === null) {
207
- console.error("Clarity did not initialize properly.", LINKING_ERROR);
208
- return Promise.resolve("Undefined");
181
+ if (isClarityUnavailable()) {
182
+ return Promise.resolve('Undefined');
209
183
  }
210
184
  return Clarity.getCurrentSessionId();
211
185
  }
212
186
 
213
- /**
214
- * Returns the active session url. This can be used to correlate the Clarity session with other
215
- * analytics tools that the developer may be using.
216
- *
217
- * @returns a promise that resolves to the current session url if there is an active one.
187
+ /**
188
+ * Returns the active session url. This can be used to correlate the Clarity session with other
189
+ * analytics tools that the developer may be using.
190
+ *
191
+ * @returns a promise that resolves to the current session url if there is an active one.
218
192
  */
219
193
  export function getCurrentSessionUrl() {
220
- if (!SupportedPlatforms.includes(Platform.OS)) {
221
- console.warn("Clarity supports " + SupportedPlatforms.join(", ") + " only for now.");
222
- return Promise.resolve("Undefined");
223
- }
224
- if (Clarity === null) {
225
- console.error("Clarity did not initialize properly.", LINKING_ERROR);
226
- return Promise.resolve("Undefined");
194
+ if (isClarityUnavailable()) {
195
+ return Promise.resolve('Undefined');
227
196
  }
228
197
  return Clarity.getCurrentSessionUrl();
229
198
  }
@@ -1 +1 @@
1
- {"version":3,"names":["NativeModules","Platform","LINKING_ERROR","Clarity","SupportedPlatforms","LogLevel","initialize","projectId","config","Error","userId","logLevel","None","allowMeteredNetworkUsage","enableWebViewCapture","allowedDomains","disableOnLowEndDevices","maximumDailyNetworkUsageInMB","includes","OS","console","warn","join","error","enableDailyNetworkUsageLimit","refinedMaximumDailyNetworkUsageInMB","pause","resume","isPaused","Promise","resolve","undefined","setCustomUserId","customUserId","setCustomSessionId","customSessionId","setCustomTag","key","value","setCurrentScreenName","screenName","getCurrentSessionId","getCurrentSessionUrl"],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GAChB,+EAA8E;AAC/E;AACA,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC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AK,CAAC,sCAAsC,EAAErB,aAAa,CAAC;IACpE,OAAO2B,OAAO,CAACC,OAAO,CAAC,WAAW,CAAC;EACrC;EAEA,OAAO3B,OAAO,CAACsC,mBAAmB,CAAC,CAAC;AACtC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAAA,EAAoB;EACtD,IAAI,CAACtC,kBAAkB,CAACc,QAAQ,CAACjB,QAAQ,CAACkB,EAAE,CAAC,EAAE;IAC7CC,OAAO,CAACC,IAAI,CAAC,mBAAmB,GAAGjB,kBAAkB,CAACkB,IAAI,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC;IACpF,OAAOO,OAAO,CAACC,OAAO,CAAC,WAAW,CAAC;EACrC;EAEA,IAAI3B,OAAO,KAAK,IAAI,EAAE;IACpBiB,OAAO,CAACG,KAAK,CAAC,sCAAsC,EAAErB,aAAa,CAAC;IACpE,OAAO2B,OAAO,CAACC,OAAO,CAAC,WAAW,CAAC;EACrC;EAEA,OAAO3B,OAAO,CAACuC,oBAAoB,CAAC,CAAC;AACvC"}
1
+ {"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","Clarity","SupportedPlatforms","LogLevel","isClarityUnavailable","includes","OS","console","warn","join","error","initialize","projectId","config","Error","userId","logLevel","None","allowMeteredNetworkUsage","enableWebViewCapture","allowedDomains","disableOnLowEndDevices","maximumDailyNetworkUsageInMB","enableIOS_experimental","push","enableDailyNetworkUsageLimit","refinedMaximumDailyNetworkUsageInMB","pause","Promise","resolve","undefined","resume","isPaused","setCustomUserId","customUserId","setCustomSessionId","customSessionId","setCustomTag","key","value","setCurrentScreenName","screenName","getCurrentSessionId","getCurrentSessionUrl"],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GACjB,+EAA+E,GAC/ED,QAAQ,CAACE,MAAM,CAAC;EACdC,GAAG,EAAE,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CAAA,EAAoB;EACtD,IAAIvC,oBAAoB,CAAC,CAAC,EAAE;IAC1B,OAAOwB,OAAO,CAACC,OAAO,CAAC,WAAW,CAAC;EACrC;EAEA,OAAO5B,OAAO,CAAC0C,oBAAoB,CAAC,CAAC;AACvC","ignoreList":[]}
@@ -11,8 +11,11 @@
11
11
  * @param enableWebViewCapture [OPTIONAL default = true] Allows Clarity to capture the web views DOM content.
12
12
  * @param allowedDomains [OPTIONAL default = ["*"]] The whitelisted domains to allow Clarity to capture their DOM content.
13
13
  * If it contains "*" as an element, all domains will be captured.
14
+ * Note: iOS currently does not support allowedDomains feature.
14
15
  * @param disableOnLowEndDevices [OPTIONAL default = false] Disable Clarity on low-end devices.
15
16
  * @param maximumDailyNetworkUsageInMB [OPTIONAL default = null] Maximum daily network usage for Clarity (null = No limit). When the limit is reached, Clarity will turn on lean mode.
17
+ * Note: iOS currently does not support limiting network usage.
18
+ * @param enableIOS_experimental [OPTIONAL default = false] Experimental flag to enable Clarity on iOS platform.
16
19
  */
17
20
  export interface ClarityConfig {
18
21
  userId?: string | null;
@@ -22,6 +25,7 @@ export interface ClarityConfig {
22
25
  allowedDomains?: string[];
23
26
  disableOnLowEndDevices?: Boolean;
24
27
  maximumDailyNetworkUsageInMB?: number;
28
+ enableIOS_experimental?: boolean;
25
29
  }
26
30
  /**
27
31
  * The level of logging to show in the device logcat stream.
@@ -38,17 +42,17 @@ export declare enum LogLevel {
38
42
  * Initializes the Clarity SDK if the API level is supported.
39
43
  * @param projectId [REQUIRED] The Clarity project id to send data to.
40
44
  * @param config [OPTIONAL] The clarity config, if not provided default values are used.
41
- */
45
+ */
42
46
  export declare function initialize(projectId: string, config?: ClarityConfig): void;
43
47
  /**
44
48
  * Pauses the Clarity capturing processes until the next resume() is called.
45
49
  */
46
- export declare function pause(): void;
50
+ export declare function pause(): Promise<boolean | undefined>;
47
51
  /**
48
52
  * Resumes the Clarity capturing processes if they are not already resumed.
49
53
  * Note: Clarity starts capturing data right on initialization.
50
54
  */
51
- export declare function resume(): void;
55
+ export declare function resume(): Promise<boolean | undefined>;
52
56
  /**
53
57
  * Returns true if Clarity has been paused by the user.
54
58
  */
@@ -63,7 +67,7 @@ export declare function isPaused(): Promise<Boolean | undefined>;
63
67
  * </p>
64
68
  * @param customUserId The custom user id to set.
65
69
  */
66
- export declare function setCustomUserId(customUserId: string): void;
70
+ export declare function setCustomUserId(customUserId: string): Promise<boolean | undefined>;
67
71
  /**
68
72
  * Sets a custom session id that can be used to identify the session.
69
73
  * <p>
@@ -71,13 +75,13 @@ export declare function setCustomUserId(customUserId: string): void;
71
75
  * </p>
72
76
  * @param customSessionId The custom session id to set.
73
77
  */
74
- export declare function setCustomSessionId(customSessionId: string): void;
78
+ export declare function setCustomSessionId(customSessionId: string): Promise<boolean | undefined>;
75
79
  /**
76
80
  * Sets a custom tag for the current session.
77
81
  * @param key The tag key to set.
78
82
  * @param value The tag value to set.
79
83
  */
80
- export declare function setCustomTag(key: string, value: string): void;
84
+ export declare function setCustomTag(key: string, value: string): Promise<boolean | undefined>;
81
85
  /**
82
86
  * For React Native applications only, this function is used to set the current screen name
83
87
  * in case the ReactNative Navigation package is used.
@@ -85,7 +89,7 @@ export declare function setCustomTag(key: string, value: string): void;
85
89
  * You can it set to `null` to remove the latest set value.
86
90
  * @param screenName The current screen name to set.
87
91
  */
88
- export declare function setCurrentScreenName(screenName: string | null): void;
92
+ export declare function setCurrentScreenName(screenName: string | null): Promise<boolean | undefined>;
89
93
  /**
90
94
  * Returns the active session id. This can be used to correlate the Clarity session with other
91
95
  * analytics tools that the developer may be using.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,wBAAwB,CAAC,EAAE,OAA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