hive-bedrock-api 4.0.0 → 4.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/lib/index.d.ts ADDED
@@ -0,0 +1,116 @@
1
+ import { Game, Timeframe } from "hive-bedrock-data";
2
+ import { MethodResponse } from "./utils";
3
+ import { ProcessedPlayerResponse } from "./processors/player";
4
+ import { ProcessedGlobalStatisticsResponse } from "./processors/global_statistics";
5
+ import { ProcessedMapResponse } from "./processors/map";
6
+ import { ProcessedGameMetadata } from "./processors/meta";
7
+ import { ProcessedPlayerSearchResponse } from "./processors/player_search";
8
+ import { AvailableLeaderboardResponse, ProcessedAllGamesResponse, ProcessedGame, ProcessedMonthlyGamesResponse } from "./processors/game";
9
+ interface Options {
10
+ resolveDynamicTitles?: boolean;
11
+ useModernLeaderboardSource?: boolean;
12
+ apiBaseEndpoint?: string;
13
+ requestInit?: RequestInit;
14
+ }
15
+ export * from "./processors/game";
16
+ export * from "./processors/global_statistics";
17
+ export * from "./processors/map";
18
+ export * from "./processors/meta";
19
+ export * from "./processors/player";
20
+ export * from "./processors/player_search";
21
+ export default class HiveAPI {
22
+ options: Options;
23
+ constructor(options?: Options);
24
+ private _fetchAPI;
25
+ /**
26
+ * `/game/all/main/{identifier}` Gets information about a player
27
+ * @param identifier Username or UUID of the player
28
+ * @returns The player information
29
+ */
30
+ getPlayer(identifier: string): Promise<MethodResponse<ProcessedPlayerResponse>>;
31
+ /**
32
+ * `/player/search/{prefix}` Gets a list of players that match the prefix
33
+ * @param prefix The prefix to search for (must be at least 4 characters long)
34
+ * @returns A list of players that match the prefix
35
+ */
36
+ getPlayerSearch(prefix: string): Promise<MethodResponse<ProcessedPlayerSearchResponse>>;
37
+ /**
38
+ * Gets statistics for a player
39
+ * @param identifier Username or UUID of the player
40
+ * @param timeframe The timeframe to get the statistics for
41
+ * @param options Additional options including specific game, month, and year
42
+ * @returns The player statistics
43
+ */
44
+ getStatistics(identifier: string, timeframe: Timeframe.AllTime): Promise<MethodResponse<ProcessedAllGamesResponse>>;
45
+ getStatistics<G extends Game>(identifier: string, timeframe: Timeframe.AllTime, options: {
46
+ game: G;
47
+ }): Promise<MethodResponse<ProcessedGame<Timeframe.AllTime, false>[G]>>;
48
+ getStatistics(identifier: string, timeframe: Timeframe.Monthly, options?: {
49
+ month?: number;
50
+ year?: number;
51
+ }): Promise<MethodResponse<ProcessedMonthlyGamesResponse>>;
52
+ getStatistics<G extends Game>(identifier: string, timeframe: Timeframe.Monthly, options: {
53
+ game: G;
54
+ month?: number;
55
+ year?: number;
56
+ }): Promise<MethodResponse<ProcessedGame<Timeframe.Monthly, false>[G]>>;
57
+ getStatistics<G extends Game>(identifier: string, timeframe: Timeframe.Seasonal, options: {
58
+ game: G;
59
+ season: number;
60
+ }): Promise<MethodResponse<ProcessedMonthlyGamesResponse>>;
61
+ private _getStatisticsAllTime;
62
+ private _getStatisticsMonthly;
63
+ private _getStatisticsSeasonal;
64
+ getAvailableMonthlyLeaderboards<G extends Game>(game: G): Promise<MethodResponse<AvailableLeaderboardResponse>>;
65
+ /**
66
+ * `/game/season/player/{game}/{player}/{season}` Gets seasonal statistics for a player
67
+ * @param identifier Username or UUID of the player
68
+ * @param game The game to get the statistics for
69
+ * @param season The season to get the statistics for
70
+ * @returns The player's seasonal statistics
71
+ */
72
+ getSeasonalStatistics<G extends Game>(identifier: string, game: G, season?: number): Promise<MethodResponse<ProcessedMonthlyGamesResponse["statistics"][G] | null>>;
73
+ /**
74
+ * `/game/all/{game}` Gets statistics for a game
75
+ * @param timeframe The timeframe to get the statistics for
76
+ * @param game The game to get the statistics for
77
+ * @param options Additional options including specific month and year
78
+ */
79
+ getLeaderboard<G extends Game>(timeframe: Timeframe.AllTime, game: G): Promise<MethodResponse<ProcessedGame<Timeframe.AllTime, true>[G][] | null>>;
80
+ getLeaderboard<G extends Game>(timeframe: Timeframe.Monthly, game: G): Promise<MethodResponse<ProcessedGame<Timeframe.Monthly, true>[G][] | null>>;
81
+ getLeaderboard<G extends Game>(timeframe: Timeframe.Monthly, game: G, options: {
82
+ month?: number;
83
+ year?: number;
84
+ }): Promise<MethodResponse<ProcessedGame<Timeframe.Monthly, true>[G][] | null>>;
85
+ getLeaderboard<G extends Game>(timeframe: Timeframe.Seasonal, game: G, options: {
86
+ season: number;
87
+ }): Promise<MethodResponse<ProcessedGame<Timeframe.Seasonal, true>[G][] | null>>;
88
+ private _getLeaderboardAllTime;
89
+ private _getLeaderboardMonthly;
90
+ private _getLeaderboardSeasonal;
91
+ /**
92
+ * `/game/season/{game}/{season}` Gets seasonal statistics for a game
93
+ * @param game The game to get the statistics for
94
+ * @param season The season to get the statistics for
95
+ * @returns The seasonal statistics for the game
96
+ */
97
+ getSeasonalLeaderboard<G extends Game>(game: G, season?: number): Promise<MethodResponse<ProcessedGame<Timeframe.Monthly, true>[G][]>>;
98
+ /**
99
+ * `/global/statistics` Gets global statistics
100
+ * @returns The global statistics
101
+ */
102
+ getGlobalStatistics(): Promise<MethodResponse<ProcessedGlobalStatisticsResponse>>;
103
+ /**
104
+ * `/game/map/{game}` Gets information about the maps in a game
105
+ * @param game The game to get the maps for (fails for games without maps)
106
+ * @returns A list of maps in the game
107
+ */
108
+ getGameMaps(game: Game): Promise<MethodResponse<ProcessedMapResponse>>;
109
+ /**
110
+ * `/game/meta/{game}` Gets metadata about a game
111
+ * @param game The game to get the metadata for
112
+ * @returns The metadata for the game
113
+ */
114
+ getGameMetadata(game: Game): Promise<MethodResponse<ProcessedGameMetadata>>;
115
+ }
116
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,IAAI,EAAS,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAA0B,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC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I,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,GAAE,MAAU,GAAG,OAAO,CAAC,cAAc,CAAC,aAAa,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAQtJ;;;OAGG;IACU,mBAAmB,IAAI,OAAO,CAAC,cAAc,CAAC,iCAAiC,CAAC,CAAC;IAK9F;;;;OAIG;IACU,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC;IAMnF;;;;OAIG;IACU,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,cAAc,CAAC,qBAAqB,CAAC,CAAC;CAM3F"}
package/lib/index.js ADDED
@@ -0,0 +1,270 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ const hive_bedrock_data_1 = require("hive-bedrock-data");
21
+ const player_1 = __importDefault(require("./processors/player"));
22
+ const player_search_1 = __importDefault(require("./processors/player_search"));
23
+ const game_1 = require("./processors/game");
24
+ __exportStar(require("./processors/game"), exports);
25
+ __exportStar(require("./processors/global_statistics"), exports);
26
+ __exportStar(require("./processors/map"), exports);
27
+ __exportStar(require("./processors/meta"), exports);
28
+ __exportStar(require("./processors/player"), exports);
29
+ __exportStar(require("./processors/player_search"), exports);
30
+ class HiveAPI {
31
+ options;
32
+ constructor(options = {}) {
33
+ this.options = options;
34
+ this.options = options;
35
+ this.options.apiBaseEndpoint = this.options.apiBaseEndpoint ?? hive_bedrock_data_1.API_BASE_ENDPOINT;
36
+ }
37
+ async _fetchAPI(endpoint) {
38
+ const url = this.options.apiBaseEndpoint + endpoint;
39
+ try {
40
+ const start = performance.now();
41
+ const request = await fetch(url, {
42
+ ...this.options.requestInit,
43
+ headers: {
44
+ "X-Hive-Resolve-Stat-Track": (this.options.resolveDynamicTitles ?? true).toString(),
45
+ "X-Hive-Leaderboard-Source": this.options.useModernLeaderboardSource ? "modern" : "legacy",
46
+ ...this.options.requestInit?.headers,
47
+ },
48
+ });
49
+ if (!request.ok)
50
+ return { data: null, error: { status: request.status } };
51
+ const meta = {
52
+ duration: Math.ceil(performance.now() - start),
53
+ ratelimit: {
54
+ limit: Number(request.headers.get("X-Ratelimit-Limit")),
55
+ remaining: Number(request.headers.get("X-Ratelimit-Remaining")),
56
+ reset: Number(request.headers.get("X-Ratelimit-Reset")),
57
+ },
58
+ retryAfter: Number(request.headers.get("Retry-After")),
59
+ };
60
+ const response = await request.json();
61
+ return { data: response, error: null, meta };
62
+ }
63
+ catch (err) {
64
+ return { data: null, error: { status: 500, message: err.message } };
65
+ }
66
+ }
67
+ /**
68
+ * `/game/all/main/{identifier}` Gets information about a player
69
+ * @param identifier Username or UUID of the player
70
+ * @returns The player information
71
+ */
72
+ async getPlayer(identifier) {
73
+ const { data: response, error, meta } = await this._fetchAPI(`/game/all/main/${identifier}`);
74
+ if (error)
75
+ return { data: null, error, meta };
76
+ const data = (0, player_1.default)(response);
77
+ if (!data)
78
+ return { data: null, error: { status: 500, message: "Failed to process player data" }, meta };
79
+ return { data, error: null, meta };
80
+ }
81
+ /**
82
+ * `/player/search/{prefix}` Gets a list of players that match the prefix
83
+ * @param prefix The prefix to search for (must be at least 4 characters long)
84
+ * @returns A list of players that match the prefix
85
+ */
86
+ async getPlayerSearch(prefix) {
87
+ const { data: response, error, meta } = await this._fetchAPI(`/player/search/${prefix}`);
88
+ if (error)
89
+ return { data: null, error, meta };
90
+ const data = (0, player_search_1.default)(response);
91
+ if (!data)
92
+ return { data: null, error: { status: 500, message: "Failed to process player search data" }, meta };
93
+ return { data, error: null, meta };
94
+ }
95
+ async getStatistics(identifier, timeframe, options) {
96
+ if (timeframe === hive_bedrock_data_1.Timeframe.AllTime) {
97
+ if (options?.game) {
98
+ if (!hive_bedrock_data_1.Games[options.game].statistics)
99
+ throw new Error(`Statistics are not available for the game: ${options.game}`);
100
+ return this._getStatisticsAllTime(identifier, options.game);
101
+ }
102
+ return this._getStatisticsAllTime(identifier);
103
+ }
104
+ else if (timeframe === hive_bedrock_data_1.Timeframe.Seasonal) {
105
+ if (!options?.game)
106
+ throw new Error("Game must be specified for seasonal statistics");
107
+ if (!hive_bedrock_data_1.Games[options.game].statistics)
108
+ throw new Error(`Statistics are not available for the game: ${options.game}`);
109
+ return this._getStatisticsSeasonal(identifier, options?.game, options?.season || 1);
110
+ }
111
+ if (options?.game)
112
+ return this._getStatisticsMonthly(identifier, options.game, options.month, options.year);
113
+ return this._getStatisticsMonthly(identifier, undefined, options?.month, options?.year);
114
+ }
115
+ async _getStatisticsAllTime(identifier, game) {
116
+ const { data: response, error, meta } = await this._fetchAPI(`/game/all/${game ?? "all"}/${identifier}`);
117
+ if (error)
118
+ return { data: null, error, meta };
119
+ if (game)
120
+ return { data: (0, game_1.processGame)(game, hive_bedrock_data_1.Timeframe.AllTime, false, response), error: null, meta };
121
+ let data = Object.fromEntries(Object.entries(response).map(([id, res]) => [id, id === "main" ? null : (0, game_1.processGame)(id, hive_bedrock_data_1.Timeframe.AllTime, false, res) ?? null]));
122
+ delete data.main;
123
+ return {
124
+ data: {
125
+ player: (0, player_1.default)(response),
126
+ statistics: data,
127
+ },
128
+ error: null,
129
+ meta,
130
+ };
131
+ }
132
+ async _getStatisticsMonthly(identifier, game, month, year) {
133
+ if (game && !hive_bedrock_data_1.Games[game].statistics)
134
+ throw new Error(`Statistics are not available for the game: ${game}`);
135
+ const { data: response, error, meta, } = await this._fetchAPI(`/game/monthly/player/${game ?? "all"}/${identifier}/${year ?? new Date().getFullYear()}/${month ?? new Date().getMonth() + 1}`);
136
+ if (error)
137
+ return { data: null, error, meta };
138
+ if (game)
139
+ return { data: (0, game_1.processGame)(game, hive_bedrock_data_1.Timeframe.Monthly, false, response), error: null, meta };
140
+ let data = Object.fromEntries(Object.entries(response).map(([id, res]) => [id, id === "main" ? null : (0, game_1.processGame)(id, hive_bedrock_data_1.Timeframe.Monthly, false, res) ?? null]));
141
+ delete data.main;
142
+ return {
143
+ data: {
144
+ statistics: data,
145
+ },
146
+ error: null,
147
+ meta,
148
+ };
149
+ }
150
+ async _getStatisticsSeasonal(identifier, game, season) {
151
+ if (!hive_bedrock_data_1.Games[game].statistics)
152
+ throw new Error(`Statistics are not available for the game: ${game}`);
153
+ const { data: response, error, meta } = await this._fetchAPI(`/game/season/player/${game}/${identifier}/${season ?? 1}`);
154
+ if (error)
155
+ return { data: null, error, meta };
156
+ return { data: (0, game_1.processGame)(game, hive_bedrock_data_1.Timeframe.Seasonal, false, response), error: null, meta };
157
+ }
158
+ async getAvailableMonthlyLeaderboards(game) {
159
+ const { data: response, error, meta } = await this._fetchAPI(`/game/monthly/${game}/available`);
160
+ if (error)
161
+ return { data: null, error, meta };
162
+ return { data: response, error: null, meta };
163
+ }
164
+ /**
165
+ * `/game/season/player/{game}/{player}/{season}` Gets seasonal statistics for a player
166
+ * @param identifier Username or UUID of the player
167
+ * @param game The game to get the statistics for
168
+ * @param season The season to get the statistics for
169
+ * @returns The player's seasonal statistics
170
+ */
171
+ async getSeasonalStatistics(identifier, game, season = 1) {
172
+ if (game && !hive_bedrock_data_1.Games[game].statistics)
173
+ throw new Error(`Statistics are not available for the game: ${game}`);
174
+ const { data: response, error, meta } = await this._fetchAPI(`/game/season/player/${game}/${identifier}/${season}`);
175
+ if (error)
176
+ return { data: null, error, meta };
177
+ let data = (0, game_1.processGame)(game, hive_bedrock_data_1.Timeframe.Monthly, true, response);
178
+ return { data, error: null, meta };
179
+ }
180
+ async getLeaderboard(timeframe, game, options) {
181
+ if (game && !hive_bedrock_data_1.Games[game].statistics)
182
+ throw new Error(`Statistics are not available for the game: ${game}`);
183
+ if (timeframe === hive_bedrock_data_1.Timeframe.Monthly)
184
+ return this._getLeaderboardMonthly(game, options?.month || new Date().getMonth() + 1, options?.year || new Date().getFullYear());
185
+ if (timeframe === hive_bedrock_data_1.Timeframe.Seasonal)
186
+ return this._getLeaderboardSeasonal(game, options?.season || 1);
187
+ return this._getLeaderboardAllTime(game);
188
+ }
189
+ // /game/all/{game}
190
+ async _getLeaderboardAllTime(game) {
191
+ const { data: response, error, meta } = await this._fetchAPI(`/game/all/${game}`);
192
+ if (error)
193
+ return { data: null, error, meta };
194
+ let data = response.map((res) => (0, game_1.processGame)(game, hive_bedrock_data_1.Timeframe.AllTime, true, res));
195
+ return { data, error: null, meta };
196
+ }
197
+ // /game/monthly/{game}/{year}/{month}
198
+ async _getLeaderboardMonthly(game, month, year) {
199
+ if (game && !hive_bedrock_data_1.Games[game].statistics)
200
+ throw new Error(`Statistics are not available for the game: ${game}`);
201
+ const { data: response, error, meta } = await this._fetchAPI(`/game/monthly/${game}/${year}/${month}`);
202
+ if (error)
203
+ return { data: null, error, meta };
204
+ let data = response.map((res) => (0, game_1.processGame)(game, hive_bedrock_data_1.Timeframe.Monthly, true, res));
205
+ return { data, error: null, meta };
206
+ }
207
+ // /game/season/{game}/season
208
+ async _getLeaderboardSeasonal(game, season = 1) {
209
+ if (game && !hive_bedrock_data_1.Games[game].statistics)
210
+ throw new Error(`Statistics are not available for the game: ${game}`);
211
+ const { data: response, error, meta } = await this._fetchAPI(`/game/season/${game}/${season}`);
212
+ if (error)
213
+ return { data: null, error, meta };
214
+ let data = response.map((res) => (0, game_1.processGame)(game, hive_bedrock_data_1.Timeframe.Seasonal, true, res));
215
+ return { data, error: null, meta };
216
+ }
217
+ /**
218
+ * `/game/season/{game}/{season}` Gets seasonal statistics for a game
219
+ * @param game The game to get the statistics for
220
+ * @param season The season to get the statistics for
221
+ * @returns The seasonal statistics for the game
222
+ */
223
+ async getSeasonalLeaderboard(game, season = 1) {
224
+ if (game && !hive_bedrock_data_1.Games[game].statistics)
225
+ throw new Error(`Statistics are not available for the game: ${game}`);
226
+ const { data: response, error, meta } = await this._fetchAPI(`/game/season/${game}/${season ?? 1}`);
227
+ if (error)
228
+ return { data: null, error, meta };
229
+ let data = response.map((res) => (0, game_1.processGame)(game, hive_bedrock_data_1.Timeframe.Monthly, true, res));
230
+ return { data, error: null, meta };
231
+ }
232
+ /**
233
+ * `/global/statistics` Gets global statistics
234
+ * @returns The global statistics
235
+ */
236
+ async getGlobalStatistics() {
237
+ const { data: response, error, meta } = await this._fetchAPI("/global/statistics");
238
+ if (error)
239
+ return { data: null, error, meta };
240
+ return { data: response, error: null, meta };
241
+ }
242
+ /**
243
+ * `/game/map/{game}` Gets information about the maps in a game
244
+ * @param game The game to get the maps for (fails for games without maps)
245
+ * @returns A list of maps in the game
246
+ */
247
+ async getGameMaps(game) {
248
+ if (game && !hive_bedrock_data_1.Games[game].statistics)
249
+ throw new Error(`Statistics are not available for the game: ${game}`);
250
+ const { data: response, error, meta } = await this._fetchAPI(`/game/map/${game}`);
251
+ if (error)
252
+ return { data: null, error, meta };
253
+ return { data: response, error: null, meta };
254
+ }
255
+ /**
256
+ * `/game/meta/{game}` Gets metadata about a game
257
+ * @param game The game to get the metadata for
258
+ * @returns The metadata for the game
259
+ */
260
+ async getGameMetadata(game) {
261
+ if (game && !hive_bedrock_data_1.Games[game].statistics)
262
+ throw new Error(`Statistics are not available for the game: ${game}`);
263
+ const { data: response, error, meta } = await this._fetchAPI(`/game/meta/${game}`);
264
+ if (error)
265
+ return { data: null, error, meta };
266
+ return { data: response, error: null, meta };
267
+ }
268
+ }
269
+ exports.default = HiveAPI;
270
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,yDAA8E;AAE9E,iEAAiF;AAIjF,+EAAgG;AAChG,4CAAuJ;AAUvJ,oDAAkC;AAClC,iEAA+C;AAC/C,mDAAiC;AACjC,oDAAkC;AAClC,sDAAoC;AACpC,6DAA2C;AAE3C,MAAqB,OAAO;IACL;IAAnB,YAAmB,UAAmB,EAAE;QAArB,YAAO,GAAP,OAAO,CAAc;QACpC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,IAAI,qCAAiB,CAAC;IACrF,CAAC;IAEO,KAAK,CAAC,SAAS,CAAgB,QAAgB;QACnD,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,GAAG,QAAQ,CAAC;QAEpD,IAAI,CAAC;YACD,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;YAChC,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;gBAC7B,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW;gBAC3B,OAAO,EAAE;oBACL,2BAA2B,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,IAAI,IAAI,CAAC,CAAC,QAAQ,EAAE;oBACnF,2BAA2B,EAAE,IAAI,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ;oBAC1F,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO;iBACvC;aACJ,CAAC,CAAC;YACH,IAAI,CAAC,OAAO,CAAC,EAAE;gBAAE,OAAO,EAAE,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