// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import { readFile } from 'node:fs/promises';
import { URL } from 'node:url';
import { streamWrite } from '../front_end/core/host/ResourceLoader.js';
export class McpHostBindings {
    connectAutomaticFileSystem() {
    }
    disconnectAutomaticFileSystem() {
    }
    addFileSystem() {
    }
    loadCompleted() {
    }
    indexPath() {
    }
    setInspectedPageBounds() {
    }
    showCertificateViewer() {
    }
    setWhitelistedShortcuts() {
    }
    setEyeDropperActive() {
    }
    inspectElementCompleted() {
    }
    openInNewTab() {
    }
    openSearchResultsInNewTab() {
    }
    showItemInFolder() {
    }
    removeFileSystem() {
    }
    requestFileSystems() {
    }
    save() {
    }
    append() {
    }
    close() {
    }
    searchInPath() {
    }
    stopIndexing() {
    }
    bringToFront() {
    }
    closeWindow() {
    }
    copyText() {
    }
    inspectedURLChanged() {
    }
    isolatedFileSystem() {
        return null;
    }
    loadNetworkResource(urlString, _headers, streamId, callback) {
        let url;
        try {
            url = new URL(urlString);
        }
        catch {
            callback({
                statusCode: 404,
                urlValid: false,
            });
            return;
        }
        let contentPromise;
        if (url.protocol === 'file:') {
            contentPromise = readFile(url, { encoding: 'utf8' });
        }
        else if (url.protocol === 'http:' || url.protocol === 'https:') {
            // We skip parsing headers. DevTools only sets cache and user agent, which is probably fine to not forward.
            contentPromise = fetch(url).then(response => {
                if (!response.ok) {
                    throw new Error('Fetch failed');
                }
                return response.text();
            });
        }
        else {
            // Unknown protocol.
            callback({
                statusCode: 404,
                urlValid: false,
            });
            return;
        }
        contentPromise
            .then(content => {
            streamWrite(streamId, content);
            callback({ statusCode: 200 });
        })
            .catch(() => {
            callback({ statusCode: 404 });
        });
    }
    registerPreference() {
    }
    getPreferences() {
    }
    getPreference() {
    }
    setPreference() {
    }
    removePreference() {
    }
    clearPreferences() {
    }
    getSyncInformation() {
    }
    getHostConfig() {
    }
    upgradeDraggedFileSystemPermissions() {
    }
    platform() {
        switch (process.platform) {
            case 'darwin':
                return 'mac';
            case 'win32':
                return 'windows';
            default:
                return 'linux';
        }
    }
    recordCountHistogram() {
    }
    recordEnumeratedHistogram() {
    }
    recordPerformanceHistogram() {
    }
    recordUserMetricsAction() {
    }
    recordNewBadgeUsage() {
    }
    sendMessageToBackend() {
    }
    setDevicesDiscoveryConfig() {
    }
    setDevicesUpdatesEnabled() {
    }
    openRemotePage() {
    }
    openNodeFrontend() {
    }
    setInjectedScriptForOrigin() {
    }
    setIsDocked() {
    }
    showSurvey() {
    }
    canShowSurvey() {
    }
    zoomFactor() {
        return 1;
    }
    zoomIn() {
    }
    zoomOut() {
    }
    resetZoom() {
    }
    showContextMenuAtPoint() {
    }
    reattach() {
    }
    readyForTest() {
    }
    connectionReady() {
    }
    setOpenNewWindowForPopups() {
    }
    isHostedMode() {
        return true;
    }
    setAddExtensionCallback() {
    }
    initialTargetId() {
        return Promise.resolve(null);
    }
    doAidaConversation(_request, _streamId, cb) {
        cb({
            error: 'Not implemented',
        });
    }
    registerAidaClientEvent(_request, cb) {
        cb({
            error: 'Not implemented',
        });
    }
    aidaCodeComplete(_request, cb) {
        cb({
            error: 'Not implemented',
        });
    }
    dispatchHttpRequest(_request, cb) {
        cb({
            error: 'Not implemented',
        });
    }
    recordImpression() {
    }
    recordResize() {
    }
    recordClick() {
    }
    recordHover() {
    }
    recordDrag() {
    }
    recordChange() {
    }
    recordKeyDown() {
    }
    recordSettingAccess() {
    }
    recordFunctionCall() {
    }
}
//# sourceMappingURL=HostBindings.js.map