Add Brave CDP automation, replace Oracle browser mode
Connects to user's running Brave via Chrome DevTools Protocol to automate ChatGPT interaction. Uses puppeteer-core to open a tab, send the prompt, wait for response, and extract the result. No cookies, no separate profiles, no copy/paste. Just connects to the browser where the user is already logged in. One-time setup: relaunch Brave with --remote-debugging-port=9222 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
92
node_modules/chromium-bidi/lib/cjs/bidiTab/BidiParser.d.ts
generated
vendored
Normal file
92
node_modules/chromium-bidi/lib/cjs/bidiTab/BidiParser.d.ts
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
/**
|
||||
* Copyright 2023 Google LLC.
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import type { BidiCommandParameterParser } from '../bidiMapper/BidiMapper.js';
|
||||
import type { Bluetooth, Browser, BrowsingContext, Cdp, Emulation, Input, Network, Permissions, Script, Session, Storage, WebExtension, UAClientHints } from '../protocol/protocol.js';
|
||||
export declare class BidiParser implements BidiCommandParameterParser {
|
||||
parseDisableSimulationParameters(params: unknown): Bluetooth.DisableSimulationParameters;
|
||||
parseHandleRequestDevicePromptParams(params: unknown): Bluetooth.HandleRequestDevicePromptParameters;
|
||||
parseSimulateAdapterParameters(params: unknown): Bluetooth.SimulateAdapterParameters;
|
||||
parseSimulateAdvertisementParameters(params: unknown): Bluetooth.SimulateAdvertisementParameters;
|
||||
parseSimulateCharacteristicParameters(params: unknown): Bluetooth.SimulateCharacteristicParameters;
|
||||
parseSimulateCharacteristicResponseParameters(params: unknown): Bluetooth.SimulateCharacteristicResponseParameters;
|
||||
parseSimulateDescriptorParameters(params: unknown): Bluetooth.SimulateDescriptorParameters;
|
||||
parseSimulateDescriptorResponseParameters(params: unknown): Bluetooth.SimulateDescriptorResponseParameters;
|
||||
parseSimulateGattConnectionResponseParameters(params: unknown): Bluetooth.SimulateGattConnectionResponseParameters;
|
||||
parseSimulateGattDisconnectionParameters(params: unknown): Bluetooth.SimulateGattDisconnectionParameters;
|
||||
parseSimulatePreconnectedPeripheralParameters(params: unknown): Bluetooth.SimulatePreconnectedPeripheralParameters;
|
||||
parseSimulateServiceParameters(params: unknown): Bluetooth.SimulateServiceParameters;
|
||||
parseCreateUserContextParameters(params: unknown): Browser.CreateUserContextParameters;
|
||||
parseRemoveUserContextParameters(params: unknown): Browser.RemoveUserContextParameters;
|
||||
parseSetClientWindowStateParameters(params: unknown): Browser.SetClientWindowStateParameters;
|
||||
parseSetDownloadBehaviorParameters(params: unknown): Browser.SetDownloadBehaviorParameters;
|
||||
parseActivateParams(params: unknown): BrowsingContext.ActivateParameters;
|
||||
parseCaptureScreenshotParams(params: unknown): BrowsingContext.CaptureScreenshotParameters;
|
||||
parseCloseParams(params: unknown): BrowsingContext.CloseParameters;
|
||||
parseCreateParams(params: unknown): BrowsingContext.CreateParameters;
|
||||
parseGetTreeParams(params: unknown): BrowsingContext.GetTreeParameters;
|
||||
parseHandleUserPromptParams(params: unknown): BrowsingContext.HandleUserPromptParameters;
|
||||
parseLocateNodesParams(params: unknown): BrowsingContext.LocateNodesParameters;
|
||||
parseNavigateParams(params: unknown): BrowsingContext.NavigateParameters;
|
||||
parsePrintParams(params: unknown): BrowsingContext.PrintParameters;
|
||||
parseReloadParams(params: unknown): BrowsingContext.ReloadParameters;
|
||||
parseSetViewportParams(params: unknown): BrowsingContext.SetViewportParameters;
|
||||
parseTraverseHistoryParams(params: unknown): BrowsingContext.TraverseHistoryParameters;
|
||||
parseGetSessionParams(params: unknown): Cdp.GetSessionParameters;
|
||||
parseResolveRealmParams(params: unknown): Cdp.ResolveRealmParameters;
|
||||
parseSendCommandParams(params: unknown): Cdp.SendCommandParameters;
|
||||
parseSetClientHintsOverrideParams(params: unknown): UAClientHints.Emulation.SetClientHintsOverrideParameters;
|
||||
parseSetForcedColorsModeThemeOverrideParams(params: unknown): Emulation.SetForcedColorsModeThemeOverrideParameters;
|
||||
parseSetGeolocationOverrideParams(params: unknown): Emulation.SetGeolocationOverrideParameters;
|
||||
parseSetLocaleOverrideParams(params: unknown): Emulation.SetLocaleOverrideParameters;
|
||||
parseSetNetworkConditionsParams(params: unknown): Emulation.SetNetworkConditionsParameters;
|
||||
parseSetScreenOrientationOverrideParams(params: unknown): Emulation.SetScreenOrientationOverrideParameters;
|
||||
parseSetScreenSettingsOverrideParams(params: unknown): Emulation.SetScreenSettingsOverrideParameters;
|
||||
parseSetScriptingEnabledParams(params: unknown): Emulation.SetScriptingEnabledParameters;
|
||||
parseSetTimezoneOverrideParams(params: unknown): Emulation.SetTimezoneOverrideParameters;
|
||||
parseSetTouchOverrideParams(params: unknown): Emulation.SetTouchOverrideParameters;
|
||||
parseSetUserAgentOverrideParams(params: unknown): Emulation.SetUserAgentOverrideParameters;
|
||||
parsePerformActionsParams(params: unknown): Input.PerformActionsParameters;
|
||||
parseReleaseActionsParams(params: unknown): Input.ReleaseActionsParameters;
|
||||
parseSetFilesParams(params: unknown): Input.SetFilesParameters;
|
||||
parseAddDataCollectorParams(params: unknown): Network.AddDataCollectorParameters;
|
||||
parseAddInterceptParams(params: unknown): Network.AddInterceptParameters;
|
||||
parseContinueRequestParams(params: unknown): Network.ContinueRequestParameters;
|
||||
parseContinueResponseParams(params: unknown): Network.ContinueResponseParameters;
|
||||
parseContinueWithAuthParams(params: unknown): Network.ContinueWithAuthParameters;
|
||||
parseDisownDataParams(params: unknown): Network.DisownDataParameters;
|
||||
parseFailRequestParams(params: unknown): Network.FailRequestParameters;
|
||||
parseGetDataParams(params: unknown): Network.GetDataParameters;
|
||||
parseProvideResponseParams(params: unknown): Network.ProvideResponseParameters;
|
||||
parseRemoveDataCollectorParams(params: unknown): Network.RemoveDataCollectorParameters;
|
||||
parseRemoveInterceptParams(params: unknown): Network.RemoveInterceptParameters;
|
||||
parseSetCacheBehaviorParams(params: unknown): Network.SetCacheBehaviorParameters;
|
||||
parseSetExtraHeadersParams(params: unknown): Network.SetExtraHeadersParameters;
|
||||
parseSetPermissionsParams(params: unknown): Permissions.SetPermissionParameters;
|
||||
parseAddPreloadScriptParams(params: unknown): Script.AddPreloadScriptParameters;
|
||||
parseCallFunctionParams(params: unknown): Script.CallFunctionParameters;
|
||||
parseDisownParams(params: unknown): Script.DisownParameters;
|
||||
parseEvaluateParams(params: unknown): Script.EvaluateParameters;
|
||||
parseGetRealmsParams(params: unknown): Script.GetRealmsParameters;
|
||||
parseRemovePreloadScriptParams(params: unknown): Script.RemovePreloadScriptParameters;
|
||||
parseSubscribeParams(params: unknown): Session.SubscribeParameters;
|
||||
parseUnsubscribeParams(params: unknown): Session.UnsubscribeParameters;
|
||||
parseDeleteCookiesParams(params: unknown): Storage.DeleteCookiesParameters;
|
||||
parseGetCookiesParams(params: unknown): Storage.GetCookiesParameters;
|
||||
parseSetCookieParams(params: unknown): Storage.SetCookieParameters;
|
||||
parseInstallParams(params: unknown): WebExtension.InstallParameters;
|
||||
parseUninstallParams(params: unknown): WebExtension.UninstallParameters;
|
||||
}
|
||||
294
node_modules/chromium-bidi/lib/cjs/bidiTab/BidiParser.js
generated
vendored
Normal file
294
node_modules/chromium-bidi/lib/cjs/bidiTab/BidiParser.js
generated
vendored
Normal file
@@ -0,0 +1,294 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.BidiParser = void 0;
|
||||
const Parser = __importStar(require("../protocol-parser/protocol-parser.js"));
|
||||
class BidiParser {
|
||||
// Bluetooth module
|
||||
// keep-sorted start block=yes
|
||||
parseDisableSimulationParameters(params) {
|
||||
return Parser.Bluetooth.parseDisableSimulationParameters(params);
|
||||
}
|
||||
parseHandleRequestDevicePromptParams(params) {
|
||||
return Parser.Bluetooth.parseHandleRequestDevicePromptParams(params);
|
||||
}
|
||||
parseSimulateAdapterParameters(params) {
|
||||
return Parser.Bluetooth.parseSimulateAdapterParams(params);
|
||||
}
|
||||
parseSimulateAdvertisementParameters(params) {
|
||||
return Parser.Bluetooth.parseSimulateAdvertisementParams(params);
|
||||
}
|
||||
parseSimulateCharacteristicParameters(params) {
|
||||
return Parser.Bluetooth.parseSimulateCharacteristicParams(params);
|
||||
}
|
||||
parseSimulateCharacteristicResponseParameters(params) {
|
||||
return Parser.Bluetooth.parseSimulateCharacteristicResponseParams(params);
|
||||
}
|
||||
parseSimulateDescriptorParameters(params) {
|
||||
return Parser.Bluetooth.parseSimulateDescriptorParams(params);
|
||||
}
|
||||
parseSimulateDescriptorResponseParameters(params) {
|
||||
return Parser.Bluetooth.parseSimulateDescriptorResponseParams(params);
|
||||
}
|
||||
parseSimulateGattConnectionResponseParameters(params) {
|
||||
return Parser.Bluetooth.parseSimulateGattConnectionResponseParams(params);
|
||||
}
|
||||
parseSimulateGattDisconnectionParameters(params) {
|
||||
return Parser.Bluetooth.parseSimulateGattDisconnectionParams(params);
|
||||
}
|
||||
parseSimulatePreconnectedPeripheralParameters(params) {
|
||||
return Parser.Bluetooth.parseSimulatePreconnectedPeripheralParams(params);
|
||||
}
|
||||
parseSimulateServiceParameters(params) {
|
||||
return Parser.Bluetooth.parseSimulateServiceParams(params);
|
||||
}
|
||||
// keep-sorted end
|
||||
// Browser module
|
||||
// keep-sorted start block=yes
|
||||
parseCreateUserContextParameters(params) {
|
||||
// Validate the params, but return the original one, as there can be `goog:` options.
|
||||
Parser.Browser.parseCreateUserContextParameters(params);
|
||||
return params;
|
||||
}
|
||||
parseRemoveUserContextParameters(params) {
|
||||
return Parser.Browser.parseRemoveUserContextParameters(params);
|
||||
}
|
||||
parseSetClientWindowStateParameters(params) {
|
||||
return Parser.Browser.parseSetClientWindowStateParameters(params);
|
||||
}
|
||||
parseSetDownloadBehaviorParameters(params) {
|
||||
return Parser.Browser.parseSetDownloadBehaviorParameters(params);
|
||||
}
|
||||
// keep-sorted end
|
||||
// Browsing Context module
|
||||
// keep-sorted start block=yes
|
||||
parseActivateParams(params) {
|
||||
return Parser.BrowsingContext.parseActivateParams(params);
|
||||
}
|
||||
parseCaptureScreenshotParams(params) {
|
||||
return Parser.BrowsingContext.parseCaptureScreenshotParams(params);
|
||||
}
|
||||
parseCloseParams(params) {
|
||||
return Parser.BrowsingContext.parseCloseParams(params);
|
||||
}
|
||||
parseCreateParams(params) {
|
||||
return Parser.BrowsingContext.parseCreateParams(params);
|
||||
}
|
||||
parseGetTreeParams(params) {
|
||||
return Parser.BrowsingContext.parseGetTreeParams(params);
|
||||
}
|
||||
parseHandleUserPromptParams(params) {
|
||||
return Parser.BrowsingContext.parseHandleUserPromptParameters(params);
|
||||
}
|
||||
parseLocateNodesParams(params) {
|
||||
return Parser.BrowsingContext.parseLocateNodesParams(params);
|
||||
}
|
||||
parseNavigateParams(params) {
|
||||
return Parser.BrowsingContext.parseNavigateParams(params);
|
||||
}
|
||||
parsePrintParams(params) {
|
||||
return Parser.BrowsingContext.parsePrintParams(params);
|
||||
}
|
||||
parseReloadParams(params) {
|
||||
return Parser.BrowsingContext.parseReloadParams(params);
|
||||
}
|
||||
parseSetViewportParams(params) {
|
||||
return Parser.BrowsingContext.parseSetViewportParams(params);
|
||||
}
|
||||
parseTraverseHistoryParams(params) {
|
||||
return Parser.BrowsingContext.parseTraverseHistoryParams(params);
|
||||
}
|
||||
// keep-sorted end
|
||||
// CDP module
|
||||
// keep-sorted start block=yes
|
||||
parseGetSessionParams(params) {
|
||||
return Parser.Cdp.parseGetSessionRequest(params);
|
||||
}
|
||||
parseResolveRealmParams(params) {
|
||||
return Parser.Cdp.parseResolveRealmRequest(params);
|
||||
}
|
||||
parseSendCommandParams(params) {
|
||||
return Parser.Cdp.parseSendCommandRequest(params);
|
||||
}
|
||||
// keep-sorted end
|
||||
// Emulation module
|
||||
// keep-sorted start block=yes
|
||||
parseSetClientHintsOverrideParams(params) {
|
||||
return Parser.Emulation.parseSetClientHintsOverrideParams(params);
|
||||
}
|
||||
parseSetForcedColorsModeThemeOverrideParams(params) {
|
||||
return Parser.Emulation.parseSetForcedColorsModeThemeOverrideParams(params);
|
||||
}
|
||||
parseSetGeolocationOverrideParams(params) {
|
||||
return Parser.Emulation.parseSetGeolocationOverrideParams(params);
|
||||
}
|
||||
parseSetLocaleOverrideParams(params) {
|
||||
return Parser.Emulation.parseSetLocaleOverrideParams(params);
|
||||
}
|
||||
parseSetNetworkConditionsParams(params) {
|
||||
return Parser.Emulation.parseSetNetworkConditionsParams(params);
|
||||
}
|
||||
parseSetScreenOrientationOverrideParams(params) {
|
||||
return Parser.Emulation.parseSetScreenOrientationOverrideParams(params);
|
||||
}
|
||||
parseSetScreenSettingsOverrideParams(params) {
|
||||
return Parser.Emulation.parseSetScreenSettingsOverrideParams(params);
|
||||
}
|
||||
parseSetScriptingEnabledParams(params) {
|
||||
return Parser.Emulation.parseSetScriptingEnabledParams(params);
|
||||
}
|
||||
parseSetTimezoneOverrideParams(params) {
|
||||
return Parser.Emulation.parseSetTimezoneOverrideParams(params);
|
||||
}
|
||||
parseSetTouchOverrideParams(params) {
|
||||
return Parser.Emulation.parseSetTouchOverrideParams(params);
|
||||
}
|
||||
parseSetUserAgentOverrideParams(params) {
|
||||
return Parser.Emulation.parseSetUserAgentOverrideParams(params);
|
||||
}
|
||||
// keep-sorted end
|
||||
// Input module
|
||||
// keep-sorted start block=yes
|
||||
parsePerformActionsParams(params) {
|
||||
return Parser.Input.parsePerformActionsParams(params);
|
||||
}
|
||||
parseReleaseActionsParams(params) {
|
||||
return Parser.Input.parseReleaseActionsParams(params);
|
||||
}
|
||||
parseSetFilesParams(params) {
|
||||
return Parser.Input.parseSetFilesParams(params);
|
||||
}
|
||||
// keep-sorted end
|
||||
// Network module
|
||||
// keep-sorted start block=yes
|
||||
parseAddDataCollectorParams(params) {
|
||||
return Parser.Network.parseAddDataCollectorParameters(params);
|
||||
}
|
||||
parseAddInterceptParams(params) {
|
||||
return Parser.Network.parseAddInterceptParameters(params);
|
||||
}
|
||||
parseContinueRequestParams(params) {
|
||||
return Parser.Network.parseContinueRequestParameters(params);
|
||||
}
|
||||
parseContinueResponseParams(params) {
|
||||
return Parser.Network.parseContinueResponseParameters(params);
|
||||
}
|
||||
parseContinueWithAuthParams(params) {
|
||||
return Parser.Network.parseContinueWithAuthParameters(params);
|
||||
}
|
||||
parseDisownDataParams(params) {
|
||||
return Parser.Network.parseDisownDataParameters(params);
|
||||
}
|
||||
parseFailRequestParams(params) {
|
||||
return Parser.Network.parseFailRequestParameters(params);
|
||||
}
|
||||
parseGetDataParams(params) {
|
||||
return Parser.Network.parseGetDataParameters(params);
|
||||
}
|
||||
parseProvideResponseParams(params) {
|
||||
return Parser.Network.parseProvideResponseParameters(params);
|
||||
}
|
||||
parseRemoveDataCollectorParams(params) {
|
||||
return Parser.Network.parseRemoveDataCollectorParameters(params);
|
||||
}
|
||||
parseRemoveInterceptParams(params) {
|
||||
return Parser.Network.parseRemoveInterceptParameters(params);
|
||||
}
|
||||
parseSetCacheBehaviorParams(params) {
|
||||
return Parser.Network.parseSetCacheBehaviorParameters(params);
|
||||
}
|
||||
parseSetExtraHeadersParams(params) {
|
||||
return Parser.Network.parseSetExtraHeadersParameters(params);
|
||||
}
|
||||
// keep-sorted end
|
||||
// Permissions module
|
||||
// keep-sorted start block=yes
|
||||
parseSetPermissionsParams(params) {
|
||||
return Parser.Permissions.parseSetPermissionsParams(params);
|
||||
}
|
||||
// keep-sorted end
|
||||
// Script module
|
||||
// keep-sorted start block=yes
|
||||
parseAddPreloadScriptParams(params) {
|
||||
return Parser.Script.parseAddPreloadScriptParams(params);
|
||||
}
|
||||
parseCallFunctionParams(params) {
|
||||
return Parser.Script.parseCallFunctionParams(params);
|
||||
}
|
||||
parseDisownParams(params) {
|
||||
return Parser.Script.parseDisownParams(params);
|
||||
}
|
||||
parseEvaluateParams(params) {
|
||||
return Parser.Script.parseEvaluateParams(params);
|
||||
}
|
||||
parseGetRealmsParams(params) {
|
||||
return Parser.Script.parseGetRealmsParams(params);
|
||||
}
|
||||
parseRemovePreloadScriptParams(params) {
|
||||
return Parser.Script.parseRemovePreloadScriptParams(params);
|
||||
}
|
||||
// keep-sorted end
|
||||
// Session module
|
||||
// keep-sorted start block=yes
|
||||
parseSubscribeParams(params) {
|
||||
return Parser.Session.parseSubscribeParams(params);
|
||||
}
|
||||
parseUnsubscribeParams(params) {
|
||||
return Parser.Session.parseUnsubscribeParams(params);
|
||||
}
|
||||
// keep-sorted end
|
||||
// Storage module
|
||||
// keep-sorted start block=yes
|
||||
parseDeleteCookiesParams(params) {
|
||||
return Parser.Storage.parseDeleteCookiesParams(params);
|
||||
}
|
||||
parseGetCookiesParams(params) {
|
||||
return Parser.Storage.parseGetCookiesParams(params);
|
||||
}
|
||||
parseSetCookieParams(params) {
|
||||
return Parser.Storage.parseSetCookieParams(params);
|
||||
}
|
||||
// keep-sorted end
|
||||
// WebExtenstion module
|
||||
// keep-sorted start block=yes
|
||||
parseInstallParams(params) {
|
||||
return Parser.WebModule.parseInstallParams(params);
|
||||
}
|
||||
parseUninstallParams(params) {
|
||||
return Parser.WebModule.parseUninstallParams(params);
|
||||
}
|
||||
}
|
||||
exports.BidiParser = BidiParser;
|
||||
//# sourceMappingURL=BidiParser.js.map
|
||||
1
node_modules/chromium-bidi/lib/cjs/bidiTab/BidiParser.js.map
generated
vendored
Normal file
1
node_modules/chromium-bidi/lib/cjs/bidiTab/BidiParser.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
37
node_modules/chromium-bidi/lib/cjs/bidiTab/Transport.d.ts
generated
vendored
Normal file
37
node_modules/chromium-bidi/lib/cjs/bidiTab/Transport.d.ts
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Copyright 2023 Google LLC.
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License. *
|
||||
*/
|
||||
import type { BidiTransport } from '../bidiMapper/BidiMapper.js';
|
||||
import { type ChromiumBidi } from '../protocol/protocol.js';
|
||||
import { LogType } from '../utils/log.js';
|
||||
import type { Transport } from '../utils/transport.js';
|
||||
export declare class WindowBidiTransport implements BidiTransport {
|
||||
#private;
|
||||
static readonly LOGGER_PREFIX_RECV: "bidi:RECV ◂";
|
||||
static readonly LOGGER_PREFIX_SEND: "bidi:SEND ▸";
|
||||
static readonly LOGGER_PREFIX_WARN = LogType.debugWarn;
|
||||
constructor();
|
||||
setOnMessage(onMessage: Parameters<BidiTransport['setOnMessage']>[0]): void;
|
||||
sendMessage(message: ChromiumBidi.Message): void;
|
||||
close(): void;
|
||||
}
|
||||
export declare class WindowCdpTransport implements Transport {
|
||||
#private;
|
||||
constructor();
|
||||
setOnMessage(onMessage: Parameters<Transport['setOnMessage']>[0]): void;
|
||||
sendMessage(message: string): void;
|
||||
close(): void;
|
||||
}
|
||||
150
node_modules/chromium-bidi/lib/cjs/bidiTab/Transport.js
generated
vendored
Normal file
150
node_modules/chromium-bidi/lib/cjs/bidiTab/Transport.js
generated
vendored
Normal file
@@ -0,0 +1,150 @@
|
||||
"use strict";
|
||||
var _a;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.WindowCdpTransport = exports.WindowBidiTransport = void 0;
|
||||
const log_js_1 = require("../utils/log.js");
|
||||
const mapperTabPage_js_1 = require("./mapperTabPage.js");
|
||||
class WindowBidiTransport {
|
||||
static LOGGER_PREFIX_RECV = `${log_js_1.LogType.bidi}:RECV ◂`;
|
||||
static LOGGER_PREFIX_SEND = `${log_js_1.LogType.bidi}:SEND ▸`;
|
||||
static LOGGER_PREFIX_WARN = log_js_1.LogType.debugWarn;
|
||||
#onMessage = null;
|
||||
constructor() {
|
||||
window.onBidiMessage = (message) => {
|
||||
(0, mapperTabPage_js_1.log)(_a.LOGGER_PREFIX_RECV, message);
|
||||
try {
|
||||
const command = _a.#parseBidiMessage(message);
|
||||
this.#onMessage?.call(null, command);
|
||||
}
|
||||
catch (e) {
|
||||
const error = e instanceof Error ? e : new Error(e);
|
||||
// Transport-level error does not provide goog:channel.
|
||||
this.#respondWithError(message, "invalid argument" /* ErrorCode.InvalidArgument */, error, null);
|
||||
}
|
||||
};
|
||||
}
|
||||
setOnMessage(onMessage) {
|
||||
this.#onMessage = onMessage;
|
||||
}
|
||||
sendMessage(message) {
|
||||
(0, mapperTabPage_js_1.log)(_a.LOGGER_PREFIX_SEND, message);
|
||||
const json = JSON.stringify(message);
|
||||
window.sendBidiResponse(json);
|
||||
}
|
||||
close() {
|
||||
this.#onMessage = null;
|
||||
window.onBidiMessage = null;
|
||||
}
|
||||
#respondWithError(plainCommandData, errorCode, error, googChannel) {
|
||||
const errorResponse = _a.#getErrorResponse(plainCommandData, errorCode, error);
|
||||
if (googChannel) {
|
||||
this.sendMessage({
|
||||
...errorResponse,
|
||||
'goog:channel': googChannel,
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.sendMessage(errorResponse);
|
||||
}
|
||||
}
|
||||
static #getJsonType(value) {
|
||||
if (value === null) {
|
||||
return 'null';
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
return 'array';
|
||||
}
|
||||
return typeof value;
|
||||
}
|
||||
static #getErrorResponse(message, errorCode, error) {
|
||||
// XXX: this is bizarre per spec. We reparse the payload and
|
||||
// extract the ID, regardless of what kind of value it was.
|
||||
let messageId;
|
||||
try {
|
||||
const command = JSON.parse(message);
|
||||
if (_a.#getJsonType(command) === 'object' &&
|
||||
'id' in command) {
|
||||
messageId = command.id;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
return {
|
||||
type: 'error',
|
||||
id: messageId,
|
||||
error: errorCode,
|
||||
message: error.message,
|
||||
};
|
||||
}
|
||||
static #parseBidiMessage(message) {
|
||||
let command;
|
||||
try {
|
||||
command = JSON.parse(message);
|
||||
}
|
||||
catch {
|
||||
throw new Error('Cannot parse data as JSON');
|
||||
}
|
||||
const type = _a.#getJsonType(command);
|
||||
if (type !== 'object') {
|
||||
throw new Error(`Expected JSON object but got ${type}`);
|
||||
}
|
||||
// Extract and validate id, method and params.
|
||||
const { id, method, params } = command;
|
||||
const idType = _a.#getJsonType(id);
|
||||
if (idType !== 'number' || !Number.isInteger(id) || id < 0) {
|
||||
// TODO: should uint64_t be the upper limit?
|
||||
// https://tools.ietf.org/html/rfc7049#section-2.1
|
||||
throw new Error(`Expected unsigned integer but got ${idType}`);
|
||||
}
|
||||
const methodType = _a.#getJsonType(method);
|
||||
if (methodType !== 'string') {
|
||||
throw new Error(`Expected string method but got ${methodType}`);
|
||||
}
|
||||
const paramsType = _a.#getJsonType(params);
|
||||
if (paramsType !== 'object') {
|
||||
throw new Error(`Expected object params but got ${paramsType}`);
|
||||
}
|
||||
let googChannel = command['goog:channel'];
|
||||
if (googChannel !== undefined) {
|
||||
const googChannelType = _a.#getJsonType(googChannel);
|
||||
if (googChannelType !== 'string') {
|
||||
throw new Error(`Expected string channel but got ${googChannelType}`);
|
||||
}
|
||||
// Empty string goog:channel is considered as no goog:channel provided.
|
||||
if (googChannel === '') {
|
||||
googChannel = undefined;
|
||||
}
|
||||
}
|
||||
return {
|
||||
id,
|
||||
method,
|
||||
params,
|
||||
'goog:channel': googChannel,
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.WindowBidiTransport = WindowBidiTransport;
|
||||
_a = WindowBidiTransport;
|
||||
class WindowCdpTransport {
|
||||
#onMessage = null;
|
||||
#cdpSend;
|
||||
constructor() {
|
||||
this.#cdpSend = window.cdp.send;
|
||||
// @ts-expect-error removing cdp
|
||||
window.cdp.send = undefined;
|
||||
window.cdp.onmessage = (message) => {
|
||||
this.#onMessage?.call(null, message);
|
||||
};
|
||||
}
|
||||
setOnMessage(onMessage) {
|
||||
this.#onMessage = onMessage;
|
||||
}
|
||||
sendMessage(message) {
|
||||
this.#cdpSend(message);
|
||||
}
|
||||
close() {
|
||||
this.#onMessage = null;
|
||||
window.cdp.onmessage = null;
|
||||
}
|
||||
}
|
||||
exports.WindowCdpTransport = WindowCdpTransport;
|
||||
//# sourceMappingURL=Transport.js.map
|
||||
1
node_modules/chromium-bidi/lib/cjs/bidiTab/Transport.js.map
generated
vendored
Normal file
1
node_modules/chromium-bidi/lib/cjs/bidiTab/Transport.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Transport.js","sourceRoot":"","sources":["../../../src/bidiTab/Transport.ts"],"names":[],"mappings":";;;;AAuBA,4CAAwC;AAGxC,yDAAuC;AAEvC,MAAa,mBAAmB;IAC9B,MAAM,CAAU,kBAAkB,GAAG,GAAG,gBAAO,CAAC,IAAI,SAAkB,CAAC;IACvE,MAAM,CAAU,kBAAkB,GAAG,GAAG,gBAAO,CAAC,IAAI,SAAkB,CAAC;IACvE,MAAM,CAAU,kBAAkB,GAAG,gBAAO,CAAC,SAAS,CAAC;IAEvD,UAAU,GAAqD,IAAI,CAAC;IAEpE;QACE,MAAM,CAAC,aAAa,GAAG,CAAC,OAAe,EAAE,EAAE;YACzC,IAAA,sBAAG,EAAC,EAAmB,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;YACrD,IAAI,CAAC;gBACH,MAAM,OAAO,GAAG,EAAmB,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;gBAC/D,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACvC,CAAC;YAAC,OAAO,CAAU,EAAE,CAAC;gBACpB,MAAM,KAAK,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAW,CAAC,CAAC;gBAC9D,uDAAuD;gBACvD,IAAI,CAAC,iBAAiB,CAAC,OAAO,sDAA6B,KAAK,EAAE,IAAI,CAAC,CAAC;YAC1E,CAAC;QACH,CAAC,CAAC;IACJ,CAAC;IAED,YAAY,CAAC,SAAuD;QAClE,IAAI,CAAC,UAAU,GAAG,SAAS,CA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O,CAAC,CAAC;IACzB,CAAC;IAED,KAAK;QACH,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,MAAM,CAAC,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC;IAC9B,CAAC;CACF;AAzBD,gDAyBC"}
|
||||
32
node_modules/chromium-bidi/lib/cjs/bidiTab/bidiTab.d.ts
generated
vendored
Normal file
32
node_modules/chromium-bidi/lib/cjs/bidiTab/bidiTab.d.ts
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Copyright 2021 Google LLC.
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @license
|
||||
*/
|
||||
declare global {
|
||||
interface Window {
|
||||
runMapperInstance: ((...args: any) => Promise<void>) | null;
|
||||
cdp: {
|
||||
send: (message: string) => void;
|
||||
onmessage: ((message: string) => void) | null;
|
||||
};
|
||||
sendBidiResponse: (response: string) => void;
|
||||
onBidiMessage: ((message: string) => void) | null;
|
||||
sendDebugMessage?: ((message: string) => void) | null;
|
||||
onbeforeunload: ((this: WindowEventHandlers, ev: BeforeUnloadEvent) => any) | null;
|
||||
}
|
||||
}
|
||||
export {};
|
||||
58
node_modules/chromium-bidi/lib/cjs/bidiTab/bidiTab.js
generated
vendored
Normal file
58
node_modules/chromium-bidi/lib/cjs/bidiTab/bidiTab.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Copyright 2021 Google LLC.
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const BidiMapper_js_1 = require("../bidiMapper/BidiMapper.js");
|
||||
const CdpConnection_js_1 = require("../cdp/CdpConnection.js");
|
||||
const log_js_1 = require("../utils/log.js");
|
||||
const BidiParser_js_1 = require("./BidiParser.js");
|
||||
const mapperTabPage_js_1 = require("./mapperTabPage.js");
|
||||
const Transport_js_1 = require("./Transport.js");
|
||||
(0, mapperTabPage_js_1.generatePage)();
|
||||
const mapperTabToServerTransport = new Transport_js_1.WindowBidiTransport();
|
||||
const cdpTransport = new Transport_js_1.WindowCdpTransport();
|
||||
/**
|
||||
* A CdpTransport implementation that uses the window.cdp bindings
|
||||
* injected by Target.exposeDevToolsProtocol.
|
||||
*/
|
||||
const cdpConnection = new CdpConnection_js_1.MapperCdpConnection(cdpTransport, mapperTabPage_js_1.log);
|
||||
/**
|
||||
* Launches the BiDi mapper instance.
|
||||
* @param {string} selfTargetId
|
||||
* @param options Mapper options. E.g. `acceptInsecureCerts`.
|
||||
*/
|
||||
async function runMapperInstance(selfTargetId) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Launching Mapper instance with selfTargetId:', selfTargetId);
|
||||
const bidiServer = await BidiMapper_js_1.BidiServer.createAndStart(mapperTabToServerTransport, cdpConnection,
|
||||
/**
|
||||
* Create a Browser CDP Session per Mapper instance.
|
||||
*/
|
||||
await cdpConnection.createBrowserSession(), selfTargetId, new BidiParser_js_1.BidiParser(), mapperTabPage_js_1.log);
|
||||
(0, mapperTabPage_js_1.log)(log_js_1.LogType.debugInfo, 'Mapper instance has been launched');
|
||||
return bidiServer;
|
||||
}
|
||||
/**
|
||||
* Set `window.runMapper` to a function which launches the BiDi mapper instance.
|
||||
* @param selfTargetId Needed to filter out info related to BiDi target.
|
||||
*/
|
||||
window.runMapperInstance = async (selfTargetId) => {
|
||||
await runMapperInstance(selfTargetId);
|
||||
};
|
||||
//# sourceMappingURL=bidiTab.js.map
|
||||
1
node_modules/chromium-bidi/lib/cjs/bidiTab/bidiTab.js.map
generated
vendored
Normal file
1
node_modules/chromium-bidi/lib/cjs/bidiTab/bidiTab.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"bidiTab.js","sourceRoot":"","sources":["../../../src/bidiTab/bidiTab.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;AAEH,+DAAuD;AACvD,8DAA4D;AAC5D,4CAAwC;AAExC,mDAA2C;AAC3C,yDAAqD;AACrD,iDAAuE;AAgCvE,IAAA,+BAAY,GAAE,CAAC;AACf,MAAM,0BAA0B,GAAG,IAAI,kCAAmB,EAAE,CAAC;AAC7D,MAAM,YAAY,GAAG,IAAI,iCAAkB,EAAE,CAAC;AAC9C;;;GAGG;AACH,MAAM,aAAa,GAAG,IAAI,sCAAmB,CAAC,YAAY,EAAE,sBAAG,CAAC,CAAC;AAEjE;;;;GAIG;AACH,KAAK,UAAU,iBAAiB,CAAC,YAAoB;IACnD,sCAAsC;IACtC,OAAO,CAAC,GAAG,CAAC,8CAA8C,EAAE,YAAY,CAAC,CAAC;IAE1E,MAAM,UAAU,GAAG,MAAM,0BAAU,CAAC,cAAc,CAChD,0BAA0B,EAC1B,aAAa;IACb;;OAEG;IACH,MAAM,aAAa,CAAC,oBAAoB,EAAE,EAC1C,YAAY,EACZ,IAAI,0BAAU,EAAE,EAChB,sBAAG,CACJ,CAAC;IAEF,IAAA,sBAAG,EAAC,gBAAO,CAAC,SAAS,EAAE,mCAAmC,CAAC,CAAC;IAE5D,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,iBAAiB,GAAG,KAAK,EAAE,YAAY,EAAE,EAAE;IAChD,MAAM,iBAAiB,CAAC,YAAY,CAAC,CAAC;AACxC,CAAC,CAAC"}
|
||||
19
node_modules/chromium-bidi/lib/cjs/bidiTab/mapperTabPage.d.ts
generated
vendored
Normal file
19
node_modules/chromium-bidi/lib/cjs/bidiTab/mapperTabPage.d.ts
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Copyright 2022 Google LLC.
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { type LogPrefix } from '../utils/log.js';
|
||||
export declare function generatePage(): void;
|
||||
export declare function log(logPrefix: LogPrefix, ...messages: unknown[]): void;
|
||||
63
node_modules/chromium-bidi/lib/cjs/bidiTab/mapperTabPage.js
generated
vendored
Normal file
63
node_modules/chromium-bidi/lib/cjs/bidiTab/mapperTabPage.js
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.generatePage = generatePage;
|
||||
exports.log = log;
|
||||
/**
|
||||
* Copyright 2022 Google LLC.
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
const log_js_1 = require("../utils/log.js");
|
||||
/** HTML source code for the user-facing Mapper tab. */
|
||||
const mapperPageSource = '<!DOCTYPE html><title>BiDi-CDP Mapper</title><style>body{font-family: Roboto,serif;font-size:13px;color:#202124;}.log{padding: 10px;font-family:Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace;font-size:11px;line-height:180%;background: #f1f3f4;border-radius:4px;}.pre{overflow-wrap: break-word; margin:10px;}.card{margin:60px auto;padding:2px 0;max-width:900px;box-shadow:0 1px 4px rgba(0,0,0,0.15),0 1px 6px rgba(0,0,0,0.2);border-radius:8px;}.divider{height:1px;background:#f0f0f0;}.item{padding:16px 20px;}</style><div class="card"><div class="item"><h1>BiDi-CDP Mapper is controlling this tab</h1><p>Closing or reloading it will stop the BiDi process. <a target="_blank" title="BiDi-CDP Mapper GitHub Repository" href="https://github.com/GoogleChromeLabs/chromium-bidi">Details.</a></p></div><div class="item"><div id="logs" class="log"></div></div></div></div>';
|
||||
function generatePage() {
|
||||
// If run not in browser (e.g. unit test), do nothing.
|
||||
if (!globalThis.document.documentElement) {
|
||||
return;
|
||||
}
|
||||
globalThis.document.documentElement.innerHTML = mapperPageSource;
|
||||
// Show a confirmation dialog when the user tries to leave the Mapper tab.
|
||||
globalThis.window.onbeforeunload = () => 'Closing or reloading this tab will stop the BiDi process. Are you sure you want to leave?';
|
||||
}
|
||||
function stringify(message) {
|
||||
if (typeof message === 'object') {
|
||||
return JSON.stringify(message, null, 2);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
function log(logPrefix, ...messages) {
|
||||
// If run not in browser (e.g. unit test), do nothing.
|
||||
if (!globalThis.document.documentElement) {
|
||||
return;
|
||||
}
|
||||
// Skip sending BiDi logs as they are logged once by `bidi:server:*`
|
||||
if (!logPrefix.startsWith(log_js_1.LogType.bidi)) {
|
||||
// If `sendDebugMessage` is defined, send the log message there.
|
||||
globalThis.window?.sendDebugMessage?.(JSON.stringify({ logType: logPrefix, messages }, null, 2));
|
||||
}
|
||||
const debugContainer = document.getElementById('logs');
|
||||
if (!debugContainer) {
|
||||
return;
|
||||
}
|
||||
// This piece of HTML should be added:
|
||||
// <div class="pre">...log message...</div>
|
||||
const lineElement = document.createElement('div');
|
||||
lineElement.className = 'pre';
|
||||
lineElement.textContent = [logPrefix, ...messages].map(stringify).join(' ');
|
||||
debugContainer.appendChild(lineElement);
|
||||
if (debugContainer.childNodes.length > 400) {
|
||||
debugContainer.removeChild(debugContainer.childNodes[0]);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=mapperTabPage.js.map
|
||||
1
node_modules/chromium-bidi/lib/cjs/bidiTab/mapperTabPage.js.map
generated
vendored
Normal file
1
node_modules/chromium-bidi/lib/cjs/bidiTab/mapperTabPage.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"mapperTabPage.js","sourceRoot":"","sources":["../../../src/bidiTab/mapperTabPage.ts"],"names":[],"mappings":";;AAsBA,oCAUC;AASD,kBA6BC;AAtED;;;;;;;;;;;;;;;GAeG;AACH,4CAAwD;AAExD,uDAAuD;AACvD,MAAM,gBAAgB,GACpB,u3BAAu3B,CAAC;AAE13B,SAAgB,YAAY;IAC1B,sDAAsD;IACtD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC;QACzC,OAAO;IACT,CAAC;IACD,UAAU,CAAC,QAAQ,CAAC,eAAe,CAAC,SAAS,GAAG,gBAAgB,CAAC;IAEjE,0EAA0E;IAC1E,UAAU,CAAC,MAAM,CAAC,cAAc,GAAG,GAAG,EAAE,CACtC,2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