"use strict";
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
Object.defineProperty(exports, "__esModule", { value: true });
exports.navigateToApplicationTab = navigateToApplicationTab;
exports.navigateToServiceWorkers = navigateToServiceWorkers;
exports.navigateToFrame = navigateToFrame;
exports.navigateToStorage = navigateToStorage;
exports.navigateToOpenedWindows = navigateToOpenedWindows;
exports.navigateToWebWorkers = navigateToWebWorkers;
exports.navigateToFrameServiceWorkers = navigateToFrameServiceWorkers;
exports.navigateToCookiesForTopDomain = navigateToCookiesForTopDomain;
exports.navigateToSessionStorageForTopDomain = navigateToSessionStorageForTopDomain;
exports.navigateToSharedStorage = navigateToSharedStorage;
exports.navigateToSharedStorageForTopDomain = navigateToSharedStorageForTopDomain;
exports.getDataGridData = getDataGridData;
exports.getTrimmedTextContent = getTrimmedTextContent;
exports.getFrameTreeTitles = getFrameTreeTitles;
exports.getStorageItemsData = getStorageItemsData;
exports.filterStorageItems = filterStorageItems;
exports.clearStorageItemsFilter = clearStorageItemsFilter;
exports.clearStorageItems = clearStorageItems;
exports.selectStorageItemAtIndex = selectStorageItemAtIndex;
exports.deleteSelectedStorageItem = deleteSelectedStorageItem;
exports.selectCookieByName = selectCookieByName;
exports.waitForQuotaUsage = waitForQuotaUsage;
exports.getQuotaUsage = getQuotaUsage;
exports.getPieChartLegendRows = getPieChartLegendRows;
exports.unregisterServiceWorker = unregisterServiceWorker;
exports.veImpressionForApplicationPanel = veImpressionForApplicationPanel;
const datagrid_helpers_js_1 = require("./datagrid-helpers.js");
const quick_open_helpers_js_1 = require("./quick_open-helpers.js");
const visual_logging_helpers_js_1 = require("./visual-logging-helpers.js");
async function navigateToApplicationTab(testName, devToolsPage, inspectedPage) {
    await inspectedPage.bringToFront();
    await inspectedPage.goToResource(`application/${testName}.html`);
    await devToolsPage.bringToFront();
    await (0, quick_open_helpers_js_1.openCommandMenu)(devToolsPage);
    await devToolsPage.typeText('Application');
    await devToolsPage.pressKey('Enter');
    await devToolsPage.waitFor('#tab-resources');
    // Make sure the application navigation list is shown
    await devToolsPage.waitFor('.storage-group-list-item');
    await (0, visual_logging_helpers_js_1.expectVeEvents)([veImpressionForApplicationPanel()], undefined, devToolsPage);
}
async function navigateToServiceWorkers(devToolsPage) {
    const SERVICE_WORKER_ROW_SELECTOR = '[aria-label="Service workers"]';
    await devToolsPage.click(SERVICE_WORKER_ROW_SELECTOR);
    await devToolsPage.waitFor('.service-worker-list');
    await (0, visual_logging_helpers_js_1.expectVeEvents)([
        (0, visual_logging_helpers_js_1.veClick)('Panel: resources > Pane: sidebar > Tree > TreeItem: application > TreeItem: service-workers'),
        (0, visual_logging_helpers_js_1.veImpressionsUnder)('Panel: resources', [veImpressionForServiceWorkersView()]),
    ], undefined, devToolsPage);
}
async function navigateToFrame(name, devToolsPage) {
    await doubleClickTreeItem(`[aria-label="${name}"]`, devToolsPage);
    await devToolsPage.waitFor('[title="Click to open in Sources panel"]');
    await (0, visual_logging_helpers_js_1.expectVeEvents)([
        (0, visual_logging_helpers_js_1.veClick)('Panel: resources > Pane: sidebar > Tree > TreeItem: frames > TreeItem: frame'),
        (0, visual_logging_helpers_js_1.veImpressionsUnder)('Panel: resources', [veImpressionForFrameDetails()]),
    ], undefined, devToolsPage);
}
async function navigateToStorage(devToolsPage) {
    const STORAGE_SELECTOR = '[aria-label="Storage"]';
    await devToolsPage.click(STORAGE_SELECTOR);
    await devToolsPage.waitFor('.clear-storage-button');
    await (0, visual_logging_helpers_js_1.expectVeEvents)([
        (0, visual_logging_helpers_js_1.veClick)('Panel: resources > Pane: sidebar > Tree > TreeItem: application > TreeItem: storage'),
        (0, visual_logging_helpers_js_1.veImpressionsUnder)('Panel: resources', [veImpressionForStorageOverview()]),
    ], undefined, devToolsPage);
}
async function navigateToOpenedWindows(devToolsPage) {
    await doubleClickTreeItem('[aria-label="Opened Windows"]', devToolsPage);
    await devToolsPage.waitFor('.empty-state');
    await (0, visual_logging_helpers_js_1.expectVeEvents)([
        (0, visual_logging_helpers_js_1.veClick)('Panel: resources > Pane: sidebar > Tree > TreeItem: frames > TreeItem: frame > TreeItem: opened-windows'),
        (0, visual_logging_helpers_js_1.veImpressionsUnder)('Panel: resources', [(0, visual_logging_helpers_js_1.veImpression)('Pane', 'opened-windows', [(0, visual_logging_helpers_js_1.veImpression)('Section', 'empty-view')])]),
    ], undefined, devToolsPage);
}
async function navigateToWebWorkers(devToolsPage) {
    const WEB_WORKERS_SELECTOR = '[aria-label="Web Workers"]';
    await doubleClickTreeItem(WEB_WORKERS_SELECTOR, devToolsPage);
    await devToolsPage.waitFor(`${WEB_WORKERS_SELECTOR} + ol li:first-child`);
    await devToolsPage.waitFor('.empty-state');
    await (0, visual_logging_helpers_js_1.expectVeEvents)([
        (0, visual_logging_helpers_js_1.veClick)('Panel: resources > Pane: sidebar > Tree > TreeItem: frames > TreeItem: frame > TreeItem: web-workers'),
        (0, visual_logging_helpers_js_1.veImpressionsUnder)('Panel: resources', [(0, visual_logging_helpers_js_1.veImpression)('Pane', 'web-workers', [(0, visual_logging_helpers_js_1.veImpression)('Section', 'empty-view')])]),
    ], undefined, devToolsPage);
}
async function navigateToFrameServiceWorkers(frameName, devToolsPage) {
    await navigateToFrame(frameName, devToolsPage);
    const SERVICE_WORKERS_SELECTOR = `[aria-label="${frameName}"] ~ ol [aria-label="Service workers"]`;
    await doubleClickTreeItem(SERVICE_WORKERS_SELECTOR, devToolsPage);
    await devToolsPage.waitFor(`${SERVICE_WORKERS_SELECTOR} + ol li:first-child`);
    const emptyState = devToolsPage.waitFor('.empty-state');
    const veEvents = (0, visual_logging_helpers_js_1.expectVeEvents)([
        (0, visual_logging_helpers_js_1.veClick)('Panel: resources > Pane: sidebar > Tree > TreeItem: frames > TreeItem: frame > TreeItem: service-workers'),
        (0, visual_logging_helpers_js_1.veImpressionsUnder)('Panel: resources', [(0, visual_logging_helpers_js_1.veImpression)('Pane', 'service-workers', [(0, visual_logging_helpers_js_1.veImpression)('Section', 'empty-view')])]),
    ], undefined, devToolsPage);
    await Promise.all([emptyState, veEvents]);
}
async function navigateToCookiesForTopDomain(devToolsPage, inspectedPage) {
    // The parent suffix makes sure we wait for the Cookies item to have children before trying to click it.
    const COOKIES_SELECTOR = '[aria-label="Cookies"].parent';
    const DOMAIN_SELECTOR = `${COOKIES_SELECTOR} + ol > [aria-label="${inspectedPage.domain()}"]`;
    await doubleClickTreeItem(COOKIES_SELECTOR, devToolsPage);
    await doubleClickTreeItem(DOMAIN_SELECTOR, devToolsPage);
    await (0, visual_logging_helpers_js_1.expectVeEvents)([
        (0, visual_logging_helpers_js_1.veClick)('Panel: resources > Pane: sidebar > Tree > TreeItem: storage > TreeItem: cookies'),
        (0, visual_logging_helpers_js_1.veImpressionsUnder)('Panel: resources', [
            (0, visual_logging_helpers_js_1.veImpression)('Pane', 'cookies', [(0, visual_logging_helpers_js_1.veImpression)('Section', 'empty-view', [(0, visual_logging_helpers_js_1.veImpression)('Link', 'learn-more')])]),
            (0, visual_logging_helpers_js_1.veImpressionsUnder)('Pane: sidebar > Tree > TreeItem: storage > TreeItem: cookies', [(0, visual_logging_helpers_js_1.veImpression)('TreeItem', 'cookies-for-frame')]),
        ]),
        (0, visual_logging_helpers_js_1.veClick)('Panel: resources > Pane: sidebar > Tree > TreeItem: storage > TreeItem: cookies > TreeItem: cookies-for-frame'),
        (0, visual_logging_helpers_js_1.veImpressionsUnder)('Panel: resources', [veImpressionForCookieTable()]),
    ], undefined, devToolsPage);
}
async function navigateToSessionStorageForTopDomain(devToolsPage, inspectedPage) {
    const SESSION_STORAGE_SELECTOR = '[aria-label="Session storage"].parent';
    const DOMAIN_SELECTOR = `${SESSION_STORAGE_SELECTOR} + ol > [aria-label="${inspectedPage.domain()}"]`;
    await doubleClickTreeItem(SESSION_STORAGE_SELECTOR, devToolsPage);
    await doubleClickTreeItem(DOMAIN_SELECTOR, devToolsPage);
    await (0, visual_logging_helpers_js_1.expectVeEvents)([
        (0, visual_logging_helpers_js_1.veClick)('Panel: resources > Pane: sidebar > Tree > TreeItem: storage > TreeItem: session-storage'),
        (0, visual_logging_helpers_js_1.veImpressionsUnder)('Panel: resources', [
            (0, visual_logging_helpers_js_1.veImpression)('Pane', 'session-storage', [(0, visual_logging_helpers_js_1.veImpression)('Section', 'empty-view', [(0, visual_logging_helpers_js_1.veImpression)('Link', 'learn-more')])]),
            (0, visual_logging_helpers_js_1.veImpressionsUnder)('Pane: sidebar > Tree > TreeItem: storage > TreeItem: session-storage', [(0, visual_logging_helpers_js_1.veImpression)('TreeItem', 'session-storage-for-domain')]),
        ]),
        (0, visual_logging_helpers_js_1.veClick)('Panel: resources > Pane: sidebar > Tree > TreeItem: storage > TreeItem: session-storage > TreeItem: session-storage-for-domain'),
        (0, visual_logging_helpers_js_1.veImpressionsUnder)('Panel: resources', [veImpressionForSessionStorageView()]),
    ], undefined, devToolsPage);
}
const SHARED_STORAGE_SELECTOR = '[aria-label="Shared storage"].parent';
async function navigateToSharedStorage(devToolsPage) {
    await doubleClickTreeItem(SHARED_STORAGE_SELECTOR, devToolsPage);
    await devToolsPage.waitFor('.empty-state');
    await (0, visual_logging_helpers_js_1.expectVeEvents)([
        (0, visual_logging_helpers_js_1.veImpressionsUnder)('Panel: resources', [(0, visual_logging_helpers_js_1.veImpression)('Pane', 'manifest', [(0, visual_logging_helpers_js_1.veImpression)('Section', 'empty-view')])]),
    ], undefined, devToolsPage);
}
async function navigateToSharedStorageForTopDomain(devToolsPage, inspectedPage) {
    await navigateToSharedStorage(devToolsPage);
    const DOMAIN_SELECTOR = `${SHARED_STORAGE_SELECTOR} + ol > [aria-label="${inspectedPage.domain()}"]`;
    await doubleClickTreeItem(DOMAIN_SELECTOR, devToolsPage);
    await (0, visual_logging_helpers_js_1.expectVeEvents)([
        (0, visual_logging_helpers_js_1.veClick)('Panel: resources > Pane: sidebar > Tree > TreeItem: storage > TreeItem: shared-storage > TreeItem: shared-storage-instance'),
        (0, visual_logging_helpers_js_1.veImpressionsUnder)('Panel: resources', [veImpressionForSharedStorageView()]),
    ], undefined, devToolsPage);
}
async function doubleClickTreeItem(selector, devToolsPage) {
    const element = await devToolsPage.waitFor(selector);
    await element.evaluate(el => el.scrollIntoView(true));
    await devToolsPage.click(selector, { clickOptions: { count: 2 } });
}
async function getDataGridData(selector, columns, devToolsPage) {
    // Wait for Storage data-grid to show up
    await devToolsPage.waitFor(selector);
    const dataGridNodes = await devToolsPage.$$('.data-grid-data-grid-node:not(.creation-node)');
    const dataGridRowValues = await Promise.all(dataGridNodes.map(node => node.evaluate((row, columns) => {
        const data = {};
        for (const column of columns) {
            const columnElement = row.querySelector(`.${column}-column`);
            data[column] = (columnElement?.textContent?.trim()) || '';
        }
        return data;
    }, columns)));
    return dataGridRowValues;
}
async function getTrimmedTextContent(selector, devToolsPage) {
    const elements = await devToolsPage.$$(selector);
    return await Promise.all(elements.map(element => element.evaluate(e => {
        return (e.textContent || '').trim().replace(/[ \n]{2,}/gm, ''); // remove multiple consecutive whitespaces
    })));
}
async function getFrameTreeTitles(devToolsPage) {
    const treeTitles = await devToolsPage.$$('[aria-label="Resources Section"] ~ ol .tree-element-title');
    return await Promise.all(treeTitles.map(node => node.evaluate(e => e.textContent)));
}
async function getStorageItemsData(columns, leastExpected = 1, devToolsPage) {
    const gridData = await devToolsPage.waitForFunction(async () => {
        const values = await getDataGridData('.data-grid table', columns, devToolsPage);
        if (values.length >= leastExpected) {
            return values;
        }
        return undefined;
    });
    return gridData;
}
async function filterStorageItems(filter, devToolsPage) {
    const element = await devToolsPage.waitFor('.toolbar-input-prompt');
    await (0, visual_logging_helpers_js_1.expectVeEvents)([(0, visual_logging_helpers_js_1.veImpressionsUnder)('Panel: resources > Pane: cookies-data > Toolbar', [(0, visual_logging_helpers_js_1.veImpression)('TextField', 'filter')])], undefined, devToolsPage);
    await element.type(filter);
    await (0, visual_logging_helpers_js_1.expectVeEvents)([
        (0, visual_logging_helpers_js_1.veChange)('Panel: resources > Pane: cookies-data > Toolbar > TextField: filter'),
        (0, visual_logging_helpers_js_1.veImpressionsUnder)('Panel: resources > Pane: cookies-data > Toolbar > TextField: filter', [(0, visual_logging_helpers_js_1.veImpression)('Action', 'clear')]),
    ], undefined, devToolsPage);
}
async function clearStorageItemsFilter(devToolsPage) {
    await devToolsPage.click('.toolbar-input .toolbar-input-clear-button');
    await (0, visual_logging_helpers_js_1.expectVeEvents)([(0, visual_logging_helpers_js_1.veClick)('Panel: resources > Pane: cookies-data > Toolbar > TextField: filter > Action: clear')], undefined, devToolsPage);
}
async function clearStorageItems(devToolsPage) {
    await devToolsPage.click('#storage-items-delete-all');
}
async function selectStorageItemAtIndex(index, devToolsPage) {
    await devToolsPage.waitForFunction(async () => {
        try {
            const dataGridNodes = await (0, datagrid_helpers_js_1.getDataGridRows)(index + 1, await devToolsPage.waitFor('.storage-view devtools-data-grid'), /* matchExactNumberOfRows=*/ false, devToolsPage);
            await dataGridNodes[index][1].click();
            await (0, visual_logging_helpers_js_1.expectVeEvents)([(0, visual_logging_helpers_js_1.veClick)('Panel: resources > Pane: session-storage-data > TableRow > TableCell: value')], undefined, devToolsPage);
        }
        catch (error) {
            if (error.message === 'Node is detached from document') {
                return false;
            }
            throw error;
        }
        return true;
    });
}
async function deleteSelectedStorageItem(devToolsPage) {
    await devToolsPage.click('[title="Delete Selected"]');
    await (0, visual_logging_helpers_js_1.expectVeEvents)([(0, visual_logging_helpers_js_1.veClick)('Panel: resources > Pane: session-storage-data > Toolbar > Action: storage-items-view.delete-selected')], undefined, devToolsPage);
}
async function selectCookieByName(name, devToolsPage) {
    const dataGrid = await devToolsPage.waitFor('.cookies-table devtools-data-grid');
    const cell = await devToolsPage.waitForFunction(async () => {
        const rows = await (0, datagrid_helpers_js_1.getDataGridRows)(
        /* expectedNumberOfRows=*/ 1, dataGrid, /* matchExactNumberOfRows=*/ false, devToolsPage);
        for (const row of rows) {
            for (const cell of row) {
                const cellContent = await cell.evaluate(x => {
                    return (x.classList.contains('name-column') && x.textContent?.trim()) ?? '';
                });
                if (cellContent === name) {
                    return cell;
                }
            }
        }
        return undefined;
    });
    await (0, visual_logging_helpers_js_1.expectVeEvents)([(0, visual_logging_helpers_js_1.veImpressionsUnder)('Panel: resources', [(0, visual_logging_helpers_js_1.veImpression)('Pane', 'cookies-data')])], undefined, devToolsPage);
    await cell.click();
    await (0, visual_logging_helpers_js_1.expectVeEvents)([(0, visual_logging_helpers_js_1.veClick)('Panel: resources > Pane: cookies-data > TableRow > TableCell: name')], undefined, devToolsPage);
}
async function waitForQuotaUsage(p, devToolsPage) {
    await devToolsPage.bringToFront();
    await devToolsPage.waitForFunction(async () => {
        const usedQuota = await getQuotaUsage(devToolsPage);
        return p(usedQuota);
    });
}
async function getQuotaUsage(devToolsPage) {
    const storageRow = await devToolsPage.waitFor('.quota-usage-row');
    const quotaString = await storageRow.evaluate(el => el.textContent);
    const [usedQuotaText, modifier] = quotaString.replaceAll(',', '').replace(/^\D*([\d.]+)\D*(kM?)B.used.out.of\D*\d+\D*.?B.*$/, '$1 $2').split(' ');
    let usedQuota = Number.parseInt(usedQuotaText, 10);
    if (modifier === 'k') {
        usedQuota *= 1000;
    }
    else if (modifier === 'M') {
        usedQuota *= 1000000;
    }
    return usedQuota;
}
async function getPieChartLegendRows(devToolsPage) {
    const pieChartLegend = await devToolsPage.waitFor('.pie-chart-legend');
    const rows = await pieChartLegend.evaluate(legend => {
        const rows = [];
        for (const tableRow of legend.children) {
            const row = [];
            for (const cell of tableRow.children) {
                row.push(cell.textContent);
            }
            rows.push(row);
        }
        return rows;
    });
    return rows;
}
async function unregisterServiceWorker(devToolsPage) {
    const UNREGISTER_SERVICE_WORKER_SELECTOR = '[title="Unregister service worker"]';
    await devToolsPage.click('#tab-resources');
    await navigateToServiceWorkers(devToolsPage);
    await devToolsPage.click(UNREGISTER_SERVICE_WORKER_SELECTOR);
    await devToolsPage.waitForNone(UNREGISTER_SERVICE_WORKER_SELECTOR);
}
function veImpressionForApplicationPanel() {
    return (0, visual_logging_helpers_js_1.veImpression)('Panel', 'resources', [
        (0, visual_logging_helpers_js_1.veImpression)('Pane', 'sidebar', [
            (0, visual_logging_helpers_js_1.veImpression)('Tree', undefined, [
                (0, visual_logging_helpers_js_1.veImpression)('TreeItem', 'application', [
                    (0, visual_logging_helpers_js_1.veImpression)('Expand'),
                    (0, visual_logging_helpers_js_1.veImpression)('TreeItem', 'manifest', [(0, visual_logging_helpers_js_1.veImpression)('Expand')]),
                    (0, visual_logging_helpers_js_1.veImpression)('TreeItem', 'service-workers'),
                    (0, visual_logging_helpers_js_1.veImpression)('TreeItem', 'storage'),
                ]),
                (0, visual_logging_helpers_js_1.veImpression)('TreeItem', 'storage', [
                    (0, visual_logging_helpers_js_1.veImpression)('Expand'),
                    (0, visual_logging_helpers_js_1.veImpression)('TreeItem', 'cache-storage'),
                    (0, visual_logging_helpers_js_1.veImpression)('TreeItem', 'cookies'),
                    (0, visual_logging_helpers_js_1.veImpression)('TreeItem', 'indexed-db'),
                    (0, visual_logging_helpers_js_1.veImpression)('TreeItem', 'interest-groups'),
                    (0, visual_logging_helpers_js_1.veImpression)('TreeItem', 'local-storage'),
                    (0, visual_logging_helpers_js_1.veImpression)('TreeItem', 'private-state-tokens'),
                    (0, visual_logging_helpers_js_1.veImpression)('TreeItem', 'session-storage'),
                    (0, visual_logging_helpers_js_1.veImpression)('TreeItem', 'shared-storage'),
                    (0, visual_logging_helpers_js_1.veImpression)('TreeItem', 'storage-buckets'),
                ]),
                (0, visual_logging_helpers_js_1.veImpression)('TreeItem', 'background-services', [
                    (0, visual_logging_helpers_js_1.veImpression)('Expand'),
                    (0, visual_logging_helpers_js_1.veImpression)('TreeItem', 'background-fetch'),
                    (0, visual_logging_helpers_js_1.veImpression)('TreeItem', 'background-sync'),
                    (0, visual_logging_helpers_js_1.veImpression)('TreeItem', 'bfcache'),
                    (0, visual_logging_helpers_js_1.veImpression)('TreeItem', 'bounce-tracking-mitigations'),
                    (0, visual_logging_helpers_js_1.veImpression)('TreeItem', 'notifications'),
                    (0, visual_logging_helpers_js_1.veImpression)('TreeItem', 'payment-handler'),
                    (0, visual_logging_helpers_js_1.veImpression)('TreeItem', 'periodic-background-sync'),
                    (0, visual_logging_helpers_js_1.veImpression)('TreeItem', 'preloading', [(0, visual_logging_helpers_js_1.veImpression)('Expand')]),
                    (0, visual_logging_helpers_js_1.veImpression)('TreeItem', 'push-messaging'),
                    (0, visual_logging_helpers_js_1.veImpression)('TreeItem', 'reporting-api'),
                ]),
                (0, visual_logging_helpers_js_1.veImpression)('TreeItem', 'frames', [
                    (0, visual_logging_helpers_js_1.veImpression)('Expand'),
                    (0, visual_logging_helpers_js_1.veImpression)('TreeItem', 'frame', [(0, visual_logging_helpers_js_1.veImpression)('Expand')]),
                ]),
            ]),
        ]),
        (0, visual_logging_helpers_js_1.veImpression)('Pane', 'manifest', []),
    ]);
}
function veImpressionForCookieTable() {
    return (0, visual_logging_helpers_js_1.veImpression)('Pane', 'cookies-data', [
        (0, visual_logging_helpers_js_1.veImpression)('Pane', 'preview', [(0, visual_logging_helpers_js_1.veImpression)('Section', 'empty-view')]),
        (0, visual_logging_helpers_js_1.veImpression)('TableHeader', 'domain'),
        (0, visual_logging_helpers_js_1.veImpression)('TableHeader', 'expires'),
        (0, visual_logging_helpers_js_1.veImpression)('TableHeader', 'http-only'),
        (0, visual_logging_helpers_js_1.veImpression)('TableHeader', 'name'),
        (0, visual_logging_helpers_js_1.veImpression)('TableHeader', 'partition-key-site'),
        (0, visual_logging_helpers_js_1.veImpression)('TableHeader', 'path'),
        (0, visual_logging_helpers_js_1.veImpression)('TableHeader', 'priority'),
        (0, visual_logging_helpers_js_1.veImpression)('TableHeader', 'same-site'),
        (0, visual_logging_helpers_js_1.veImpression)('TableHeader', 'secure'),
        (0, visual_logging_helpers_js_1.veImpression)('TableHeader', 'size'),
        (0, visual_logging_helpers_js_1.veImpression)('TableHeader', 'value'),
        (0, visual_logging_helpers_js_1.veImpression)('Toolbar', undefined, [
            (0, visual_logging_helpers_js_1.veImpression)('Action', 'storage-items-view.clear-all'),
            (0, visual_logging_helpers_js_1.veImpression)('Action', 'storage-items-view.delete-selected'),
            (0, visual_logging_helpers_js_1.veImpression)('Action', 'storage-items-view.refresh'),
            (0, visual_logging_helpers_js_1.veImpression)('TextField', 'filter'),
            (0, visual_logging_helpers_js_1.veImpression)('Toggle', 'only-show-cookies-with-issues'),
        ]),
    ]);
}
function veImpressionForFrameDetails() {
    return (0, visual_logging_helpers_js_1.veImpression)('Pane', 'frames', [
        (0, visual_logging_helpers_js_1.veImpression)('Link', 'node'),
        (0, visual_logging_helpers_js_1.veImpression)('Action', 'reveal-in-network'),
        (0, visual_logging_helpers_js_1.veImpression)('Action', 'reveal-in-sources'),
        (0, visual_logging_helpers_js_1.veImpression)('Link', 'learn-more.coop-coep'),
        (0, visual_logging_helpers_js_1.veImpression)('Link', 'learn-more.monitor-memory-usage'),
        (0, visual_logging_helpers_js_1.veImpression)('Link', 'learn-more.origin-trials'),
    ]);
}
function veImpressionForStorageViewToolbar() {
    return (0, visual_logging_helpers_js_1.veImpression)('Toolbar', undefined, [
        (0, visual_logging_helpers_js_1.veImpression)('Action', 'storage-items-view.refresh'),
        (0, visual_logging_helpers_js_1.veImpression)('TextField', 'filter'),
        (0, visual_logging_helpers_js_1.veImpression)('Action', 'storage-items-view.clear-all'),
        (0, visual_logging_helpers_js_1.veImpression)('Action', 'storage-items-view.delete-selected'),
    ]);
}
function veImpressionForSessionStorageView() {
    return (0, visual_logging_helpers_js_1.veImpression)('Pane', 'session-storage-data', [
        veImpressionForStorageViewToolbar(),
        (0, visual_logging_helpers_js_1.veImpression)('Pane', 'preview'),
        (0, visual_logging_helpers_js_1.veImpression)('TableHeader', 'key'),
        (0, visual_logging_helpers_js_1.veImpression)('TableHeader', 'value'),
    ]);
}
function veImpressionForSharedStorageView() {
    return (0, visual_logging_helpers_js_1.veImpression)('Pane', 'shared-storage-data', [
        veImpressionForStorageViewToolbar(),
        (0, visual_logging_helpers_js_1.veImpression)('TableHeader', 'key'),
        (0, visual_logging_helpers_js_1.veImpression)('TableHeader', 'value'),
        (0, visual_logging_helpers_js_1.veImpression)('Action', 'reset-entropy-budget'),
        (0, visual_logging_helpers_js_1.veImpression)('Pane', 'preview', [(0, visual_logging_helpers_js_1.veImpression)('Section', 'empty-view')]),
    ]);
}
function veImpressionForServiceWorkersView() {
    return (0, visual_logging_helpers_js_1.veImpression)('Pane', 'service-workers', [
        (0, visual_logging_helpers_js_1.veImpression)('Section', 'other-origin', [(0, visual_logging_helpers_js_1.veImpression)('Link', 'view-all')]),
        (0, visual_logging_helpers_js_1.veImpression)('Section', 'this-origin', [
            (0, visual_logging_helpers_js_1.veImpression)('Action', 'periodic-sync-tag'),
            (0, visual_logging_helpers_js_1.veImpression)('Action', 'push-message'),
            (0, visual_logging_helpers_js_1.veImpression)('Action', 'show-network-requests'),
            (0, visual_logging_helpers_js_1.veImpression)('Action', 'sync-tag'),
            (0, visual_logging_helpers_js_1.veImpression)('Action', 'unregister'),
            (0, visual_logging_helpers_js_1.veImpression)('Action', 'update'),
            (0, visual_logging_helpers_js_1.veImpression)('Link', 'source-location'),
            (0, visual_logging_helpers_js_1.veImpression)('TextField', 'periodic-sync-tag'),
            (0, visual_logging_helpers_js_1.veImpression)('TextField', 'push-message'),
            (0, visual_logging_helpers_js_1.veImpression)('TextField', 'sync-tag'),
            (0, visual_logging_helpers_js_1.veImpression)('Toggle', 'bypass-service-worker'),
            (0, visual_logging_helpers_js_1.veImpression)('Toggle', 'disconnect-from-network'),
            (0, visual_logging_helpers_js_1.veImpression)('Toggle', 'service-worker-update-on-reload'),
            (0, visual_logging_helpers_js_1.veImpression)('Tree', 'update-timing-table'),
        ]),
    ]);
}
function veImpressionForStorageOverview() {
    return (0, visual_logging_helpers_js_1.veImpression)('Pane', 'clear-storage', [
        (0, visual_logging_helpers_js_1.veImpression)('Action', 'storage.clear-site-data'),
        (0, visual_logging_helpers_js_1.veImpression)('Section', 'application', [(0, visual_logging_helpers_js_1.veImpression)('Toggle', 'clear-storage-service-workers')]),
        (0, visual_logging_helpers_js_1.veImpression)('Section', 'storage', [
            (0, visual_logging_helpers_js_1.veImpression)('Toggle', 'clear-storage-cache-storage'),
            (0, visual_logging_helpers_js_1.veImpression)('Toggle', 'clear-storage-cookies'),
            (0, visual_logging_helpers_js_1.veImpression)('Toggle', 'clear-storage-indexeddb'),
            (0, visual_logging_helpers_js_1.veImpression)('Toggle', 'clear-storage-local-storage'),
        ]),
        (0, visual_logging_helpers_js_1.veImpression)('Section', 'usage', [
            (0, visual_logging_helpers_js_1.veImpression)('Link', 'learn-more'),
            (0, visual_logging_helpers_js_1.veImpression)('PieChart', undefined, [
                (0, visual_logging_helpers_js_1.veImpression)('Section', 'legend', [(0, visual_logging_helpers_js_1.veImpression)('PieChartTotal', 'select-total')]),
            ]),
            (0, visual_logging_helpers_js_1.veImpression)('Toggle', 'simulate-custom-quota'),
        ]),
        (0, visual_logging_helpers_js_1.veImpression)('Toggle', 'clear-storage-include-third-party-cookies'),
    ]);
}
//# sourceMappingURL=application-helpers.js.map