import*as Common from"../common/common.js";import*as Root from"../root/root.js";import*as SDK from"../sdk/sdk.js";import*as UI from"../ui/ui.js";import*as i18n from"../i18n/i18n.js";const UIStrings={application:"Application",showApplication:"Show Application",pwa:"pwa",clearSiteData:"Clear site data",clearSiteDataIncludingThirdparty:"Clear site data (including third-party cookies)",startRecordingEvents:"Start recording events",stopRecordingEvents:"Stop recording events"},str_=i18n.i18n.registerUIStrings("resources/resources-meta.ts",UIStrings),i18nLazyString=i18n.i18n.getLazilyComputedLocalizedString.bind(void 0,str_);let loadedResourcesModule;async function loadResourcesModule(){return loadedResourcesModule||(await Root.Runtime.Runtime.instance().loadModulePromise("resources"),loadedResourcesModule=await import("./resources.js")),loadedResourcesModule}function maybeRetrieveContextTypes(e){return void 0===loadedResourcesModule?[]:e(loadedResourcesModule)}UI.ViewManager.registerViewExtension({location:"panel",id:"resources",title:i18nLazyString(UIStrings.application),commandPrompt:i18nLazyString(UIStrings.showApplication),order:70,loadView:async()=>(await loadResourcesModule()).ResourcesPanel.ResourcesPanel.instance(),tags:[i18nLazyString(UIStrings.pwa)]}),UI.ActionRegistration.registerActionExtension({category:UI.ActionRegistration.ActionCategory.RESOURCES,actionId:"resources.clear",title:i18nLazyString(UIStrings.clearSiteData),loadActionDelegate:async()=>(await loadResourcesModule()).StorageView.ActionDelegate.instance()}),UI.ActionRegistration.registerActionExtension({category:UI.ActionRegistration.ActionCategory.RESOURCES,actionId:"resources.clear-incl-third-party-cookies",title:i18nLazyString(UIStrings.clearSiteDataIncludingThirdparty),loadActionDelegate:async()=>(await loadResourcesModule()).StorageView.ActionDelegate.instance()}),UI.ActionRegistration.registerActionExtension({actionId:"background-service.toggle-recording",iconClass:"largeicon-start-recording",toggleable:!0,toggledIconClass:"largeicon-stop-recording",toggleWithRedColor:!0,contextTypes:()=>maybeRetrieveContextTypes((e=>[e.BackgroundServiceView.BackgroundServiceView])),loadActionDelegate:async()=>(await loadResourcesModule()).BackgroundServiceView.ActionDelegate.instance(),category:UI.ActionRegistration.ActionCategory.BACKGROUND_SERVICES,options:[{value:!0,title:i18nLazyString(UIStrings.startRecordingEvents)},{value:!1,title:i18nLazyString(UIStrings.stopRecordingEvents)}],bindings:[{platform:"windows,linux",shortcut:"Ctrl+E"},{platform:"mac",shortcut:"Meta+E"}]}),Common.Revealer.registerRevealer({contextTypes:()=>[SDK.Resource.Resource],destination:Common.Revealer.RevealerDestination.APPLICATION_PANEL,loadRevealer:async()=>(await loadResourcesModule()).ResourcesPanel.ResourceRevealer.instance()}),Common.Revealer.registerRevealer({contextTypes:()=>[SDK.Cookie.CookieReference],destination:Common.Revealer.RevealerDestination.APPLICATION_PANEL,loadRevealer:async()=>(await loadResourcesModule()).ResourcesPanel.CookieReferenceRevealer.instance()});