UNPKG

@react-native/debugger-frontend

Version:
1 lines 238 kB
import*as e from"../../core/common/common.js";import*as t from"../../core/host/host.js";import*as i from"../../core/i18n/i18n.js";import*as s from"../../core/platform/platform.js";import{assertNotNullOrUndefined as r}from"../../core/platform/platform.js";import*as a from"../../core/root/root.js";import*as o from"../../core/sdk/sdk.js";import*as n from"../../models/issues_manager/issues_manager.js";import*as d from"../../ui/components/icon_button/icon_button.js";import*as l from"../../ui/components/legacy_wrapper/legacy_wrapper.js";import*as c from"../../ui/legacy/components/source_frame/source_frame.js";import*as h from"../../ui/legacy/legacy.js";import*as g from"../../ui/components/buttons/buttons.js";import*as u from"../../ui/legacy/components/inline_editor/inline_editor.js";import*as p from"../../ui/legacy/components/utils/utils.js";import*as m from"../../ui/visual_logging/visual_logging.js";import*as w from"./components/components.js";import{StorageMetadataView as v}from"./components/components.js";import*as S from"../../models/bindings/bindings.js";import*as b from"../../ui/legacy/components/data_grid/data_grid.js";import*as k from"../../ui/components/report_view/report_view.js";import*as y from"../../ui/legacy/components/object_ui/object_ui.js";import*as f from"../../ui/lit-html/lit-html.js";import*as C from"../../ui/components/split_view/split_view.js";import*as T from"./preloading/components/components.js";import*as I from"../../models/text_utils/text_utils.js";import*as E from"../network/components/components.js";import*as x from"../network/network.js";import*as M from"../../models/logs/logs.js";import*as R from"../network/forward/forward.js";import*as L from"../mobile_throttling/mobile_throttling.js";import*as B from"../../ui/legacy/components/perf_ui/perf_ui.js";import*as A from"../../ui/legacy/components/cookie_table/cookie_table.js";class P extends h.TreeOutline.TreeElement{resourcesPanel;constructor(e,t,i,s){super(t,i,s),this.resourcesPanel=e,h.ARIAUtils.setLabel(this.listItemElement,t),this.listItemElement.tabIndex=-1}deselect(){super.deselect(),this.listItemElement.tabIndex=-1}get itemURL(){throw new Error("Unimplemented Method")}onselect(e){if(!e)return!1;const t=[];for(let e=this;e;e=e.parent){const i=e instanceof P&&e.itemURL;if(!i)break;t.push(i)}return this.resourcesPanel.setLastSelectedItemPath(t),!1}showView(e){this.resourcesPanel.showView(e)}}class D extends P{expandedSetting;categoryName;categoryLink;constructor(t,i,s,r=!1){super(t,i,!1,s),this.expandedSetting=e.Settings.Settings.instance().createSetting("resources-"+s+"-expanded",r),this.categoryName=i,this.categoryLink=null}get itemURL(){return"category://"+this.categoryName}setLink(e){this.categoryLink=e}onselect(e){return super.onselect(e),this.resourcesPanel.showCategoryView(this.categoryName,this.categoryLink),!1}onattach(){super.onattach(),this.expandedSetting.get()&&this.expand()}onexpand(){this.expandedSetting.set(!0)}oncollapse(){this.expandedSetting.set(!1)}}const F=new CSSStyleSheet;F.replaceSync('.report-field-name{flex-basis:152px}.manifest-view-header{min-width:600px;flex-shrink:0;flex-grow:0}.manifest-container{overflow:auto}.inline-icon{margin-inline:4px;width:16px;height:16px;&[name="check-circle"]{color:var(--icon-checkmark-green)}}.multiline-value{white-space:normal}.chrome-select{margin:4px}.inline-button{vertical-align:sub}\n/*# sourceURL=appManifestView.css */\n');const V={errorsAndWarnings:"Errors and warnings",installability:"Installability",identity:"Identity",presentation:"Presentation",protocolHandlers:"Protocol Handlers",icons:"Icons",windowControlsOverlay:"Window Controls Overlay",name:"Name",shortName:"Short name",url:"URL",computedAppId:"Computed App ID",appIdExplainer:"This is used by the browser to know whether the manifest should be updating an existing application, or whether it refers to a new web app that can be installed.",learnMore:"Learn more",appIdNote:"{PH1} {PH2} is not specified in the manifest, {PH3} is used instead. To specify an App ID that matches the current identity, set the {PH4} field to {PH5} {PH6}.",note:"Note:",copyToClipboard:"Copy suggested ID to clipboard",copiedToClipboard:"Copied suggested ID {PH1} to clipboard",description:"Description",startUrl:"Start URL",themeColor:"Theme color",backgroundColor:"Background color",orientation:"Orientation",display:"Display",newNoteUrl:"New note URL",descriptionMayBeTruncated:"Description may be truncated.",shortcutsMayBeNotAvailable:"The maximum number of shortcuts is platform dependent. Some shortcuts may be not available.",showOnlyTheMinimumSafeAreaFor:"Show only the minimum safe area for maskable icons",documentationOnMaskableIcons:"documentation on maskable icons",needHelpReadOurS:"Need help? Read the {PH1}.",shortcutS:"Shortcut #{PH1}",shortcutSShouldIncludeAXPixel:"Shortcut #{PH1} should include a 96×96 pixel icon",screenshotS:"Screenshot #{PH1}",pageIsNotLoadedInTheMainFrame:"Page is not loaded in the main frame",pageIsNotServedFromASecureOrigin:"Page is not served from a secure origin",pageHasNoManifestLinkUrl:"Page has no manifest <link> `URL`",manifestCouldNotBeFetchedIsEmpty:"Manifest could not be fetched, is empty, or could not be parsed",manifestStartUrlIsNotValid:"Manifest '`start_url`' is not valid",manifestDoesNotContainANameOr:"Manifest does not contain a '`name`' or '`short_name`' field",manifestDisplayPropertyMustBeOne:"Manifest '`display`' property must be one of '`standalone`', '`fullscreen`', or '`minimal-ui`'",manifestDoesNotContainASuitable:"Manifest does not contain a suitable icon—PNG, SVG, or WebP format of at least {PH1}px is required, the '`sizes`' attribute must be set, and the '`purpose`' attribute, if set, must include '`any`'.",avoidPurposeAnyAndMaskable:"Declaring an icon with '`purpose`' of '`any maskable`' is discouraged. It is likely to look incorrect on some platforms due to too much or too little padding.",noSuppliedIconIsAtLeastSpxSquare:"No supplied icon is at least {PH1} pixels square in `PNG`, `SVG`, or `WebP` format, with the purpose attribute unset or set to '`any`'.",couldNotDownloadARequiredIcon:"Could not download a required icon from the manifest",downloadedIconWasEmptyOr:"Downloaded icon was empty or corrupted",theSpecifiedApplicationPlatform:"The specified application platform is not supported on Android",noPlayStoreIdProvided:"No Play store ID provided",thePlayStoreAppUrlAndPlayStoreId:"The Play Store app URL and Play Store ID do not match",theAppIsAlreadyInstalled:"The app is already installed",aUrlInTheManifestContainsA:"A URL in the manifest contains a username, password, or port",pageIsLoadedInAnIncognitoWindow:"Page is loaded in an incognito window",pageDoesNotWorkOffline:"Page does not work offline",couldNotCheckServiceWorker:"Could not check `service worker` without a '`start_url`' field in the manifest",manifestSpecifies:"Manifest specifies '`prefer_related_applications`: true'",preferrelatedapplicationsIsOnly:"'`prefer_related_applications`' is only supported on `Chrome` Beta and Stable channels on `Android`.",manifestContainsDisplayoverride:"Manifest contains '`display_override`' field, and the first supported display mode must be one of '`standalone`', '`fullscreen`', or '`minimal-ui`'",pageDoesNotWorkOfflineThePage:"Page does not work offline. Starting in Chrome 93, the installability criteria are changing, and this site will not be installable. See {PH1} for more information.",imageFromS:"Image from {PH1}",screenshot:"Screenshot",formFactor:"Form factor",label:"Label",platform:"Platform",icon:"Icon",sSrcIsNotSet:"{PH1} '`src`' is not set",sUrlSFailedToParse:"{PH1} URL ''{PH2}'' failed to parse",sSFailedToLoad:"{PH1} {PH2} failed to load",sSDoesNotSpecifyItsSizeInThe:"{PH1} {PH2} does not specify its size in the manifest",sSShouldSpecifyItsSizeAs:"{PH1} {PH2} should specify its size as `[width]x[height]`",sSShouldHaveSquareIcon:"Most operating systems require square icons. Please include at least one square icon in the array.",actualSizeSspxOfSSDoesNotMatch:"Actual size ({PH1}×{PH2})px of {PH3} {PH4} does not match specified size ({PH5}×{PH6}px)",actualWidthSpxOfSSDoesNotMatch:"Actual width ({PH1}px) of {PH2} {PH3} does not match specified width ({PH4}px)",actualHeightSpxOfSSDoesNotMatch:"Actual height ({PH1}px) of {PH2} {PH3} does not match specified height ({PH4}px)",sSSizeShouldBeAtLeast320:"{PH1} {PH2} size should be at least 320×320",sSSizeShouldBeAtMost3840:"{PH1} {PH2} size should be at most 3840×3840",sSWidthDoesNotComplyWithRatioRequirement:"{PH1} {PH2} width can't be more than 2.3 times as long as the height",sSHeightDoesNotComplyWithRatioRequirement:"{PH1} {PH2} height can't be more than 2.3 times as long as the width",screenshotPixelSize:"Screenshot {url} should specify a pixel size `[width]x[height]` instead of `any` as first size.",noScreenshotsForRicherPWAInstallOnDesktop:"Richer PWA Install UI won’t be available on desktop. Please add at least one screenshot with the `form_factor` set to `wide`.",noScreenshotsForRicherPWAInstallOnMobile:"Richer PWA Install UI won’t be available on mobile. Please add at least one screenshot for which `form_factor` is not set or set to a value other than `wide`.",tooManyScreenshotsForDesktop:"No more than 8 screenshots will be displayed on desktop. The rest will be ignored.",tooManyScreenshotsForMobile:"No more than 5 screenshots will be displayed on mobile. The rest will be ignored.",screenshotsMustHaveSameAspectRatio:"All screenshots with the same `form_factor` must have the same aspect ratio as the first screenshot with that `form_factor`. Some screenshots will be ignored.",wcoFound:"Chrome has successfully found the {PH1} value for the {PH2} field in the {PH3}.",wcoNotFound:"Define {PH1} in the manifest to use the Window Controls Overlay API and customize your app's title bar.",customizePwaTitleBar:"Customize the window controls overlay of your PWA's title bar",wcoNeedHelpReadMore:"Need help? Read {PH1}.",selectWindowControlsOverlayEmulationOs:"Emulate the Window Controls Overlay on"},O=i.i18n.registerUIStrings("panels/application/AppManifestView.ts",V),W=i.i18n.getLocalizedString.bind(void 0,O);class U extends(e.ObjectWrapper.eventMixin(h.Widget.VBox)){emptyView;reportView;errorsSection;installabilitySection;identitySection;presentationSection;iconsSection;windowControlsSection;protocolHandlersSection;shortcutSections;screenshotsSections;nameField;shortNameField;descriptionField;startURLField;themeColorSwatch;backgroundColorSwatch;orientationField;displayField;newNoteUrlField;throttler;registeredListeners;target;resourceTreeModel;serviceWorkerManager;overlayModel;protocolHandlersView;constructor(e,t,i){super(!0),this.contentElement.classList.add("manifest-container"),this.contentElement.setAttribute("jslog",`${m.pane("manifest")}`),this.emptyView=e,this.emptyView.appendLink("https://web.dev/add-manifest/"),this.emptyView.show(this.contentElement),this.emptyView.hideWidget(),this.reportView=t,this.reportView.element.classList.add("manifest-view-header"),this.reportView.show(this.contentElement),this.reportView.hideWidget(),this.errorsSection=this.reportView.appendSection(W(V.errorsAndWarnings),void 0,"errors-and-warnings"),this.installabilitySection=this.reportView.appendSection(W(V.installability),void 0,"installability"),this.identitySection=this.reportView.appendSection(W(V.identity),"undefined,identity"),this.presentationSection=this.reportView.appendSection(W(V.presentation),"undefined,presentation"),this.protocolHandlersSection=this.reportView.appendSection(W(V.protocolHandlers),"undefined,protocol-handlers"),this.protocolHandlersView=new w.ProtocolHandlersView.ProtocolHandlersView,this.protocolHandlersSection.appendFieldWithCustomView(this.protocolHandlersView),this.iconsSection=this.reportView.appendSection(W(V.icons),"report-section-icons","icons"),this.windowControlsSection=this.reportView.appendSection(V.windowControlsOverlay,void 0,"window-controls-overlay"),this.shortcutSections=[],this.screenshotsSections=[],this.nameField=this.identitySection.appendField(W(V.name)),this.shortNameField=this.identitySection.appendField(W(V.shortName)),this.descriptionField=this.identitySection.appendFlexedField(W(V.description)),this.startURLField=this.presentationSection.appendField(W(V.startUrl)),h.ARIAUtils.setLabel(this.startURLField,W(V.startUrl));const s=this.presentationSection.appendField(W(V.themeColor));this.themeColorSwatch=new u.ColorSwatch.ColorSwatch,s.appendChild(this.themeColorSwatch);const r=this.presentationSection.appendField(W(V.backgroundColor));this.backgroundColorSwatch=new u.ColorSwatch.ColorSwatch,r.appendChild(this.backgroundColorSwatch),this.orientationField=this.presentationSection.appendField(W(V.orientation)),this.displayField=this.presentationSection.appendField(W(V.display)),this.newNoteUrlField=this.presentationSection.appendField(W(V.newNoteUrl)),this.throttler=i,o.TargetManager.TargetManager.instance().observeTargets(this),this.registeredListeners=[]}getStaticSections(){return[this.identitySection,this.presentationSection,this.protocolHandlersSection,this.iconsSection,this.windowControlsSection]}getManifestElement(){return this.reportView.getHeaderElement()}targetAdded(e){e===o.TargetManager.TargetManager.instance().primaryPageTarget()&&(this.target=e,this.resourceTreeModel=e.model(o.ResourceTreeModel.ResourceTreeModel),this.serviceWorkerManager=e.model(o.ServiceWorkerManager.ServiceWorkerManager),this.overlayModel=e.model(o.OverlayModel.OverlayModel),this.resourceTreeModel&&this.serviceWorkerManager&&this.overlayModel&&(this.updateManifest(!0),this.registeredListeners=[this.resourceTreeModel.addEventListener(o.ResourceTreeModel.Events.DOMContentLoaded,(()=>{this.updateManifest(!0)})),this.serviceWorkerManager.addEventListener("RegistrationUpdated",(()=>{this.updateManifest(!1)}))]))}targetRemoved(t){this.target===t&&this.resourceTreeModel&&this.serviceWorkerManager&&this.overlayModel&&(delete this.resourceTreeModel,delete this.serviceWorkerManager,delete this.overlayModel,e.EventTarget.removeEventListeners(this.registeredListeners))}async updateManifest(e){if(!this.resourceTreeModel)return;const[{url:t,data:i,errors:s},r,a]=await Promise.all([this.resourceTreeModel.fetchAppManifest(),this.resourceTreeModel.getInstallabilityErrors(),this.resourceTreeModel.getAppId()]);this.throttler.schedule((()=>this.renderManifest(t,i,s,r,a)),e?"AsSoonAsPossible":"Default")}async renderManifest(s,r,a,o,n){const l=n?.appId||null,c=n?.recommendedId||null;if(!(r&&"{}"!==r||a.length))return this.emptyView.showWidget(),this.reportView.hideWidget(),void this.dispatchEventToListeners("ManifestDetected",!1);this.emptyView.hideWidget(),this.reportView.showWidget(),this.dispatchEventToListeners("ManifestDetected",!0);const u=p.Linkifier.Linkifier.linkifyURL(s);u.tabIndex=0,this.reportView.setURL(u),this.errorsSection.clearContent(),this.errorsSection.element.classList.toggle("hidden",!a.length);for(const e of a){const t=h.UIUtils.createIconLabel({title:e.message,iconName:e.critical?"cross-circle-filled":"warning-filled",color:e.critical?"var(--icon-error)":"var(--icon-warning)"});this.errorsSection.appendRow().appendChild(t)}if(!r)return;65279===r.charCodeAt(0)&&(r=r.slice(1));const w=JSON.parse(r);this.nameField.textContent=_("name"),this.shortNameField.textContent=_("short_name");const v=[],S=_("description");this.descriptionField.textContent=S,S.length>300&&v.push(W(V.descriptionMayBeTruncated));const b=_("start_url");if(l&&c){const e=this.identitySection.appendField(W(V.computedAppId));h.ARIAUtils.setLabel(e,"App Id"),e.textContent=l;const s=d.Icon.create("help","inline-icon");s.title=W(V.appIdExplainer),s.setAttribute("jslog",`${m.action("help").track({hover:!0})}`),e.appendChild(s);const r=h.XLink.XLink.create("https://developer.chrome.com/blog/pwa-manifest-id/",W(V.learnMore),void 0,void 0,"learn-more");if(e.appendChild(r),!_("id")){const s=e.createChild("div","multiline-value"),r=document.createElement("b");r.textContent=W(V.note);const a=document.createElement("code");a.textContent="id";const o=document.createElement("code");o.textContent="id";const n=document.createElement("code");n.textContent="start_url";const d=document.createElement("code");d.textContent=c;const l=new g.Button.Button;l.className="inline-button",l.variant="icon",l.size="SMALL",l.iconName="copy",l.jslogContext="manifest.copy-id",l.title=W(V.copyToClipboard),l.addEventListener("click",(()=>{h.ARIAUtils.alert(W(V.copiedToClipboard,{PH1:c})),t.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(c)})),s.appendChild(i.i18n.getFormatLocalizedString(O,V.appIdNote,{PH1:r,PH2:a,PH3:n,PH4:o,PH5:d,PH6:l}))}}else this.identitySection.removeField(W(V.computedAppId));if(this.startURLField.removeChildren(),b){const t=e.ParsedURL.ParsedURL.completeURL(s,b);if(t){const e=p.Linkifier.Linkifier.linkifyURL(t,{text:b});e.tabIndex=0,e.setAttribute("jslog",`${m.link("start-url").track({click:!0})}`),this.startURLField.appendChild(e)}}this.themeColorSwatch.classList.toggle("hidden",!_("theme_color"));const k=e.Color.parse(_("theme_color")||"white")||e.Color.parse("white");k&&this.themeColorSwatch.renderColor(k),this.backgroundColorSwatch.classList.toggle("hidden",!_("background_color"));const y=e.Color.parse(_("background_color")||"white")||e.Color.parse("white");y&&this.backgroundColorSwatch.renderColor(y),this.orientationField.textContent=_("orientation");const f=_("display");this.displayField.textContent=f;const C=(w.note_taking||{}).new_note_url,T="string"==typeof C;if(this.newNoteUrlField.parentElement?.classList.toggle("hidden",!T),this.newNoteUrlField.removeChildren(),T){const t=e.ParsedURL.ParsedURL.completeURL(s,C),i=p.Linkifier.Linkifier.linkifyURL(t,{text:C});i.tabIndex=0,this.newNoteUrlField.appendChild(i)}const I=w.protocol_handlers||[];this.protocolHandlersView.data={protocolHandlers:I,manifestLink:s};const E=w.icons||[];this.iconsSection.clearContent();const x=w.shortcuts||[];for(const e of this.shortcutSections)e.detach(!0);const M=w.screenshots||[];for(const e of this.screenshotsSections)e.detach(!0);const R=[],L=h.UIUtils.CheckboxLabel.create(W(V.showOnlyTheMinimumSafeAreaFor));L.classList.add("mask-checkbox"),L.setAttribute("jslog",`${m.toggle("show-minimal-safe-area-for-maskable-icons").track({change:!0})}`),L.addEventListener("click",(()=>{this.iconsSection.setIconMasked(L.checkboxElement.checked)})),this.iconsSection.appendRow().appendChild(L);const B=h.XLink.XLink.create("https://web.dev/maskable-icon/",W(V.documentationOnMaskableIcons),void 0,void 0,"learn-more");this.iconsSection.appendRow().appendChild(i.i18n.getFormatLocalizedString(O,V.needHelpReadOurS,{PH1:B}));let A=!1;for(const e of E){const t=await this.appendImageResourceToSection(s,e,this.iconsSection,!1);R.push(...t.imageResourceErrors),A=t.squareSizedIconAvailable||A}A||R.push(W(V.sSShouldHaveSquareIcon)),x.length>4&&v.push(W(V.shortcutsMayBeNotAvailable));let P=1;for(const t of x){const i=this.reportView.appendSection(W(V.shortcutS,{PH1:P}));i.element.setAttribute("jslog",`${m.section("shortcuts")}`),this.shortcutSections.push(i),i.appendFlexedField(W(V.name),t.name),t.short_name&&i.appendFlexedField(W(V.shortName),t.short_name),t.description&&i.appendFlexedField(W(V.description),t.description);const r=i.appendFlexedField(W(V.url)),a=e.ParsedURL.ParsedURL.completeURL(s,t.url),o=p.Linkifier.Linkifier.linkifyURL(a,{text:t.url});o.setAttribute("jslog",`${m.link("shortcut").track({click:!0})}`),o.tabIndex=0,r.appendChild(o);const n=t.icons||[];let d=!1;for(const e of n){const{imageResourceErrors:t}=await this.appendImageResourceToSection(s,e,i,!1);if(R.push(...t),!d&&e.sizes){const t=e.sizes.match(/^(\d+)x(\d+)$/);t&&t[1]>=96&&t[2]>=96&&(d=!0)}}d||R.push(W(V.shortcutSShouldIncludeAXPixel,{PH1:P})),P++}let D=1;const F=new Map;let U=!1;for(const e of M){const t=this.reportView.appendSection(W(V.screenshotS,{PH1:D}));this.screenshotsSections.push(t),e.form_factor&&t.appendFlexedField(W(V.formFactor),e.form_factor),e.label&&t.appendFlexedField(W(V.label),e.label),e.platform&&t.appendFlexedField(W(V.platform),e.platform);const{imageResourceErrors:i,naturalWidth:r,naturalHeight:a}=await this.appendImageResourceToSection(s,e,t,!0);if(R.push(...i),e.form_factor&&r&&a){F.has(e.form_factor)||F.set(e.form_factor,{width:r,height:a});const t=F.get(e.form_factor);t&&(U=U||r*t.height!=a*t.width)}D++}U&&v.push(W(V.screenshotsMustHaveSameAspectRatio));const N=M.filter((e=>"wide"===e.form_factor)),H=M.filter((e=>"wide"!==e.form_factor));N.length<1&&v.push(W(V.noScreenshotsForRicherPWAInstallOnDesktop)),H.length<1&&v.push(W(V.noScreenshotsForRicherPWAInstallOnMobile)),N.length>8&&v.push(W(V.tooManyScreenshotsForDesktop)),H.length>5&&v.push(W(V.tooManyScreenshotsForMobile)),this.installabilitySection.clearContent(),this.installabilitySection.element.classList.toggle("hidden",!o.length);const j=this.getInstallabilityErrorMessages(o);for(const e of j){const t=h.UIUtils.createIconLabel({title:e,iconName:"warning-filled",color:"var(--icon-warning)"});this.installabilitySection.appendRow().appendChild(t)}this.errorsSection.element.classList.toggle("hidden",!a.length&&!R.length&&!v.length);for(const e of v){const t=h.UIUtils.createIconLabel({title:e,iconName:"warning-filled",color:"var(--icon-warning)"});this.errorsSection.appendRow().appendChild(t)}for(const e of R){const t=h.UIUtils.createIconLabel({title:e,iconName:"warning-filled",color:"var(--icon-warning)"});this.errorsSection.appendRow().appendChild(t)}function _(e){const t=w[e];return"string"!=typeof t?"":t}this.windowControlsSection.clearContent();const G=(w.display_override||[]).includes("window-controls-overlay"),K=h.XLink.XLink.create("https://developer.mozilla.org/en-US/docs/Web/Manifest/display_override","display-override",void 0,void 0,"display-override"),z=document.createElement("code");z.appendChild(K);const q=this.windowControlsSection.appendRow();if(G){const e=d.Icon.create("check-circle","inline-icon");q.appendChild(e);const t=document.createElement("code");t.classList.add("wco"),t.textContent="window-controls-overlay",q.appendChild(i.i18n.getFormatLocalizedString(O,V.wcoFound,{PH1:t,PH2:z,PH3:u})),this.overlayModel&&await this.appendWindowControlsToSection(this.overlayModel,s,_("theme_color"))}else{const e=d.Icon.create("info","inline-icon");q.appendChild(e),q.appendChild(i.i18n.getFormatLocalizedString(O,V.wcoNotFound,{PH1:z}))}const $=h.XLink.XLink.create("https://learn.microsoft.com/en-us/microsoft-edge/progressive-web-apps-chromium/how-to/window-controls-overlay",W(V.customizePwaTitleBar),void 0,void 0,"customize-pwa-tittle-bar");this.windowControlsSection.appendRow().appendChild(i.i18n.getFormatLocalizedString(O,V.wcoNeedHelpReadMore,{PH1:$})),this.dispatchEventToListeners("ManifestRendered")}getInstallabilityErrorMessages(e){const t=[];for(const i of e){let e;switch(i.errorId){case"not-in-main-frame":e=W(V.pageIsNotLoadedInTheMainFrame);break;case"not-from-secure-origin":e=W(V.pageIsNotServedFromASecureOrigin);break;case"no-manifest":e=W(V.pageHasNoManifestLinkUrl);break;case"manifest-empty":e=W(V.manifestCouldNotBeFetchedIsEmpty);break;case"start-url-not-valid":e=W(V.manifestStartUrlIsNotValid);break;case"manifest-missing-name-or-short-name":e=W(V.manifestDoesNotContainANameOr);break;case"manifest-display-not-supported":e=W(V.manifestDisplayPropertyMustBeOne);break;case"manifest-missing-suitable-icon":if(1!==i.errorArguments.length||"minimum-icon-size-in-pixels"!==i.errorArguments[0].name){console.error("Installability error does not have the correct errorArguments");break}e=W(V.manifestDoesNotContainASuitable,{PH1:i.errorArguments[0].value});break;case"no-acceptable-icon":if(1!==i.errorArguments.length||"minimum-icon-size-in-pixels"!==i.errorArguments[0].name){console.error("Installability error does not have the correct errorArguments");break}e=W(V.noSuppliedIconIsAtLeastSpxSquare,{PH1:i.errorArguments[0].value});break;case"cannot-download-icon":e=W(V.couldNotDownloadARequiredIcon);break;case"no-icon-available":e=W(V.downloadedIconWasEmptyOr);break;case"platform-not-supported-on-android":e=W(V.theSpecifiedApplicationPlatform);break;case"no-id-specified":e=W(V.noPlayStoreIdProvided);break;case"ids-do-not-match":e=W(V.thePlayStoreAppUrlAndPlayStoreId);break;case"already-installed":e=W(V.theAppIsAlreadyInstalled);break;case"url-not-supported-for-webapk":e=W(V.aUrlInTheManifestContainsA);break;case"in-incognito":e=W(V.pageIsLoadedInAnIncognitoWindow);break;case"not-offline-capable":e=W(V.pageDoesNotWorkOffline);break;case"no-url-for-service-worker":e=W(V.couldNotCheckServiceWorker);break;case"prefer-related-applications":e=W(V.manifestSpecifies);break;case"prefer-related-applications-only-beta-stable":e=W(V.preferrelatedapplicationsIsOnly);break;case"manifest-display-override-not-supported":e=W(V.manifestContainsDisplayoverride);break;case"warn-not-offline-capable":e=W(V.pageDoesNotWorkOfflineThePage,{PH1:"https://developer.chrome.com/blog/improved-pwa-offline-detection/"});break;default:console.error(`Installability error id '${i.errorId}' is not recognized`)}e&&t.push(e)}return t}async loadImage(e){const t=document.createElement("div");t.classList.add("image-wrapper");const i=document.createElement("img"),s=new Promise(((e,t)=>{i.onload=e,i.onerror=t}));i.src=e,i.alt=W(V.imageFromS,{PH1:e}),t.appendChild(i);try{return await s,{wrapper:t,image:i}}catch(e){}return null}parseSizes(e,t,i,s){const r=e?e.split(/\s+/):[],a=[];for(const e of r){if("any"===e){a.find((e=>"any"in e))||a.push({any:"any",formatted:"any"});continue}const r=e.match(/^(?<width>\d+)[xX](?<height>\d+)$/);if(r){const e=parseInt(r.groups?.width||"",10),t=parseInt(r.groups?.height||"",10),i=`${e}×${t}px`;a.push({width:e,height:t,formatted:i})}else s.push(W(V.sSShouldSpecifyItsSizeAs,{PH1:t,PH2:i}))}return a}checkSizeProblem(e,t,i,s,r){if("any"in e)return{hasSquareSize:i.naturalWidth===i.naturalHeight};const a=e.width===e.height;return i.naturalWidth!==e.width&&i.naturalHeight!==e.height?{error:W(V.actualSizeSspxOfSSDoesNotMatch,{PH1:i.naturalWidth,PH2:i.naturalHeight,PH3:s,PH4:r,PH5:e.width,PH6:e.height}),hasSquareSize:a}:i.naturalWidth!==e.width?{error:W(V.actualWidthSpxOfSSDoesNotMatch,{PH1:i.naturalWidth,PH2:s,PH3:r,PH4:e.width}),hasSquareSize:a}:i.naturalHeight!==e.height?{error:W(V.actualHeightSpxOfSSDoesNotMatch,{PH1:i.naturalHeight,PH2:s,PH3:r,PH4:e.height}),hasSquareSize:a}:{hasSquareSize:a}}async appendImageResourceToSection(t,i,s,r){const a=[],o=W(r?V.screenshot:V.icon);if(!i.src)return a.push(W(V.sSrcIsNotSet,{PH1:o})),{imageResourceErrors:a};const n=e.ParsedURL.ParsedURL.completeURL(t,i.src);if(!n)return a.push(W(V.sUrlSFailedToParse,{PH1:o,PH2:i.src})),{imageResourceErrors:a};const d=await this.loadImage(n);if(!d)return a.push(W(V.sSFailedToLoad,{PH1:o,PH2:n})),{imageResourceErrors:a};const{wrapper:l,image:c}=d,{naturalWidth:h,naturalHeight:g}=c,u=this.parseSizes(i.sizes,o,n,a),p=u.map((e=>e.formatted)).join(" ")+"\n"+(i.type||""),m=s.appendFlexedField(p);let w=!1;if(i.sizes){r&&u.length>0&&"any"in u[0]&&a.push(W(V.screenshotPixelSize,{url:n}));for(const e of u){const{error:t,hasSquareSize:s}=this.checkSizeProblem(e,i.type,c,o,n);if(w=w||s,t)a.push(t);else if(r){const t="any"in e?c.naturalWidth:e.width,i="any"in e?c.naturalHeight:e.height;t<320||i<320?a.push(W(V.sSSizeShouldBeAtLeast320,{PH1:o,PH2:n})):t>3840||i>3840?a.push(W(V.sSSizeShouldBeAtMost3840,{PH1:o,PH2:n})):t>2.3*i?a.push(W(V.sSWidthDoesNotComplyWithRatioRequirement,{PH1:o,PH2:n})):i>2.3*t&&a.push(W(V.sSHeightDoesNotComplyWithRatioRequirement,{PH1:o,PH2:n}))}}}else a.push(W(V.sSDoesNotSpecifyItsSizeInThe,{PH1:o,PH2:n}));c.width=c.naturalWidth;const v="string"==typeof i.purpose?i.purpose.toLowerCase():"";return v.includes("any")&&v.includes("maskable")&&a.push(W(V.avoidPurposeAnyAndMaskable)),m.appendChild(l),{imageResourceErrors:a,squareSizedIconAvailable:w,naturalWidth:h,naturalHeight:g}}wasShown(){super.wasShown(),this.reportView.registerCSSFiles([F]),this.registerCSSFiles([F])}async appendWindowControlsToSection(e,t,i){if(!await e.hasStyleSheetText(t))return;await e.toggleWindowControlsToolbar(!1);const s=h.UIUtils.CheckboxLabel.create(W(V.selectWindowControlsOverlayEmulationOs),!1);s.checkboxElement.addEventListener("click",(async()=>{await(this.overlayModel?.toggleWindowControlsToolbar(s.checkboxElement.checked))}));const r=s.createChild("select","chrome-select");r.appendChild(h.UIUtils.createOption("Windows","Windows","windows")),r.appendChild(h.UIUtils.createOption("macOS","Mac","macos")),r.appendChild(h.UIUtils.createOption("Linux","Linux","linux")),r.selectedIndex=0,this.overlayModel&&(r.value=this.overlayModel?.getWindowControlsConfig().selectedPlatform),r.addEventListener("change",(async()=>{const e=r.options[r.selectedIndex].value;this.overlayModel&&(this.overlayModel.setWindowControlsPlatform(e),await this.overlayModel.toggleWindowControlsToolbar(s.checkboxElement.checked))})),this.windowControlsSection.appendRow().appendChild(s),e.setWindowControlsThemeColor(i)}}var N=Object.freeze({__proto__:null,AppManifestView:U});const H={backForwardCache:"Back/forward cache"},j=i.i18n.registerUIStrings("panels/application/BackForwardCacheTreeElement.ts",H),_=i.i18n.getLocalizedString.bind(void 0,j);class G extends P{view;constructor(e){super(e,_(H.backForwardCache),!1,"bfcache");const t=d.Icon.create("database");this.setLeadingIcons([t])}get itemURL(){return"bfcache://"}onselect(e){return super.onselect(e),this.view||(this.view=l.LegacyWrapper.legacyWrapper(h.Widget.Widget,new w.BackForwardCacheView.BackForwardCacheView)),this.showView(this.view),t.userMetrics.panelShown("back-forward-cache"),!1}}class K extends o.SDKModel.SDKModel{backgroundServiceAgent;events;constructor(e){super(e),this.backgroundServiceAgent=e.backgroundServiceAgent(),e.registerBackgroundServiceDispatcher(this),this.events=new Map}enable(e){this.events.set(e,[]),this.backgroundServiceAgent.invoke_startObserving({service:e})}setRecording(e,t){this.backgroundServiceAgent.invoke_setRecording({shouldRecord:e,service:t})}clearEvents(e){this.events.set(e,[]),this.backgroundServiceAgent.invoke_clearEvents({service:e})}getEvents(e){return this.events.get(e)||[]}recordingStateChanged({isRecording:e,service:t}){this.dispatchEventToListeners(z.RecordingStateChanged,{isRecording:e,serviceName:t})}backgroundServiceEventReceived({backgroundServiceEvent:e}){this.events.get(e.service).push(e),this.dispatchEventToListeners(z.BackgroundServiceEventReceived,e)}}var z;o.SDKModel.SDKModel.register(K,{capabilities:1,autostart:!1}),function(e){e.RecordingStateChanged="RecordingStateChanged",e.BackgroundServiceEventReceived="BackgroundServiceEventReceived"}(z||(z={}));var q=Object.freeze({__proto__:null,BackgroundServiceModel:K,get Events(){return z}});const $=new CSSStyleSheet;$.replaceSync(".empty-bold-text{display:block;font-size:1.5em;margin:0.83em 0;font-weight:bold}.empty-view{color:var(--sys-color-token-subtle);padding:30px;text-align:center;min-width:70px}.empty-view-scroller{justify-content:center;overflow:auto}.empty-view p{white-space:initial;line-height:18px;max-width:300px;flex-shrink:0}\n/*# sourceURL=emptyWidget.css */\n");const J=new CSSStyleSheet;J.replaceSync('.background-service-toolbar{background-color:var(--sys-color-cdt-base-container);border-bottom:var(--sys-color-divider)}.data-grid{flex:auto;border:none}[slot="insertion-point-main"]{overflow:auto}.background-service-preview{position:absolute;background-color:var(--sys-color-cdt-base-container);justify-content:center;align-items:center;overflow:auto;font-size:13px;color:var(--sys-color-on-surface-subtle)}.background-service-preview > div{max-width:450px;margin:10px;text-align:center}.background-service-preview > div > p{flex:none;white-space:pre-line}.background-service-shortcut{color:var(--sys-color-on-surface-subtle)}.background-service-metadata{padding-left:5px;padding-top:10px}.background-service-metadata-entry{padding-left:10px;padding-bottom:5px}.background-service-metadata-name{color:var(--sys-color-on-surface-subtle);display:inline-block;margin-right:0.25em;font-weight:bold}.background-service-metadata-value{display:inline;margin-right:1em;white-space:pre-wrap;word-break:break-all;user-select:text}.background-service-empty-value{color:var(--sys-color-state-disabled);font-style:italic}.background-service-record-inline-button{margin-bottom:6px}\n/*# sourceURL=backgroundServiceView.css */\n');const Q={backgroundFetch:"Background fetch",backgroundSync:"Background sync",pushMessaging:"Push messaging",notifications:"Notifications",paymentHandler:"Payment handler",periodicBackgroundSync:"Periodic background sync",clear:"Clear",saveEvents:"Save events",showEventsFromOtherDomains:"Show events from other domains",showEventsForOtherStorageKeys:"Show events from other storage partitions",stopRecordingEvents:"Stop recording events",startRecordingEvents:"Start recording events",timestamp:"Timestamp",event:"Event",origin:"Origin",storageKey:"Storage Key",swScope:"Service Worker Scope",instanceId:"Instance ID",backgroundServices:"Background services",learnMore:"Learn more",selectAnEntryToViewMetadata:"Select an entry to view metadata",recordingSActivity:"Recording {PH1} activity...",devtoolsWillRecordAllSActivity:"DevTools will record all {PH1} activity for up to 3 days, even when closed.",clickTheRecordButtonSOrHitSTo:"Click the record button {PH1} or hit {PH2} to start recording.",empty:"empty",noMetadataForThisEvent:"No metadata for this event"},X=i.i18n.registerUIStrings("panels/application/BackgroundServiceView.ts",Q),Y=i.i18n.getLocalizedString.bind(void 0,X);class Z extends h.Widget.VBox{serviceName;model;serviceWorkerManager;securityOriginManager;storageKeyManager;recordAction;recordButton;originCheckbox;storageKeyCheckbox;saveButton;toolbar;splitWidget;dataGrid;previewPanel;selectedEventNode;preview;static getUIString(e){switch(e){case"backgroundFetch":return Y(Q.backgroundFetch);case"backgroundSync":return Y(Q.backgroundSync);case"pushMessaging":return Y(Q.pushMessaging);case"notifications":return Y(Q.notifications);case"paymentHandler":return Y(Q.paymentHandler);case"periodicBackgroundSync":return Y(Q.periodicBackgroundSync);default:return""}}constructor(e,t){super(!0),this.serviceName=e;const i=s.StringUtilities.toKebabCase(e);if(this.element.setAttribute("jslog",`${m.pane().context(i)}`),this.model=t,this.model.addEventListener(z.RecordingStateChanged,this.onRecordingStateChanged,this),this.model.addEventListener(z.BackgroundServiceEventReceived,this.onEventReceived,this),this.model.enable(this.serviceName),this.serviceWorkerManager=this.model.target().model(o.ServiceWorkerManager.ServiceWorkerManager),this.securityOriginManager=this.model.target().model(o.SecurityOriginManager.SecurityOriginManager),!this.securityOriginManager)throw new Error("SecurityOriginManager instance is missing");if(this.securityOriginManager.addEventListener(o.SecurityOriginManager.Events.MainSecurityOriginChanged,(()=>this.onOriginChanged())),this.storageKeyManager=this.model.target().model(o.StorageKeyManager.StorageKeyManager),!this.storageKeyManager)throw new Error("StorageKeyManager instance is missing");this.storageKeyManager.addEventListener("MainStorageKeyChanged",(()=>this.onStorageKeyChanged())),this.recordAction=h.ActionRegistry.ActionRegistry.instance().getAction("background-service.toggle-recording"),this.toolbar=new h.Toolbar.Toolbar("background-service-toolbar",this.contentElement),this.toolbar.element.setAttribute("jslog",`${m.toolbar()}`),this.setupToolbar(),this.splitWidget=new h.SplitWidget.SplitWidget(!1,!0),this.splitWidget.show(this.contentElement),this.dataGrid=this.createDataGrid(),this.previewPanel=new h.Widget.VBox,this.previewPanel.element.setAttribute("jslog",`${m.pane("preview").track({resize:!0})}`),this.selectedEventNode=null,this.preview=null,this.splitWidget.setMainWidget(this.dataGrid.asWidget()),this.splitWidget.setSidebarWidget(this.previewPanel),this.showPreview(null)}getDataGrid(){return this.dataGrid}async setupToolbar(){this.toolbar.makeWrappable(!0),this.recordButton=h.Toolbar.Toolbar.createActionButton(this.recordAction),this.toolbar.appendToolbarItem(this.recordButton);const e=new h.Toolbar.ToolbarButton(Y(Q.clear),"clear",void 0,"background-service.clear");e.addEventListener("Click",(()=>this.clearEvents())),this.toolbar.appendToolbarItem(e),this.toolbar.appendSeparator(),this.saveButton=new h.Toolbar.ToolbarButton(Y(Q.saveEvents),"download",void 0,"background-service.save-events"),this.saveButton.addEventListener("Click",(e=>{this.saveToFile()})),this.saveButton.setEnabled(!1),this.toolbar.appendToolbarItem(this.saveButton),this.toolbar.appendSeparator(),this.originCheckbox=new h.Toolbar.ToolbarCheckbox(Y(Q.showEventsFromOtherDomains),Y(Q.showEventsFromOtherDomains),(()=>this.refreshView()),"show-events-from-other-domains"),this.toolbar.appendToolbarItem(this.originCheckbox),this.storageKeyCheckbox=new h.Toolbar.ToolbarCheckbox(Y(Q.showEventsForOtherStorageKeys),Y(Q.showEventsForOtherStorageKeys),(()=>this.refreshView()),"show-events-from-other-partitions"),this.toolbar.appendToolbarItem(this.storageKeyCheckbox)}refreshView(){this.clearView();const e=this.model.getEvents(this.serviceName).filter((e=>this.acceptEvent(e)));for(const t of e)this.addEvent(t)}clearView(){this.selectedEventNode=null,this.dataGrid.rootNode().removeChildren(),this.saveButton.setEnabled(!1),this.showPreview(null)}toggleRecording(){this.model.setRecording(!this.recordButton.toggled(),this.serviceName)}clearEvents(){this.model.clearEvents(this.serviceName),this.clearView()}onRecordingStateChanged({data:e}){e.serviceName===this.serviceName&&e.isRecording!==this.recordButton.toggled()&&(this.recordButton.setToggled(e.isRecording),this.updateRecordButtonTooltip(),this.showPreview(this.selectedEventNode))}updateRecordButtonTooltip(){const e=this.recordButton.toggled()?Y(Q.stopRecordingEvents):Y(Q.startRecordingEvents);this.recordButton.setTitle(e,"background-service.toggle-recording")}onEventReceived({data:e}){this.acceptEvent(e)&&this.addEvent(e)}onOriginChanged(){this.originCheckbox.checked()||this.refreshView()}onStorageKeyChanged(){this.storageKeyCheckbox.checked()||this.refreshView()}addEvent(e){const t=this.createEventData(e),i=new ee(t,e.eventMetadata);this.dataGrid.rootNode().appendChild(i),1===this.dataGrid.rootNode().children.length&&(this.saveButton.setEnabled(!0),this.showPreview(this.selectedEventNode))}createDataGrid(){const e=[{id:"id",title:"#",weight:1},{id:"timestamp",title:Y(Q.timestamp),weight:7},{id:"event-name",title:Y(Q.event),weight:8},{id:"origin",title:Y(Q.origin),weight:8},{id:"storage-key",title:Y(Q.storageKey),weight:8},{id:"sw-scope",title:Y(Q.swScope),weight:4},{id:"instance-id",title:Y(Q.instanceId),weight:8}],t=new b.DataGrid.DataGridImpl({displayName:Y(Q.backgroundServices),columns:e,editCallback:void 0,refreshCallback:void 0,deleteCallback:void 0});return t.setStriped(!0),t.addEventListener("SelectedNode",(e=>this.showPreview(e.data))),t}createEventData(e){let t="";const i=this.serviceWorkerManager?this.serviceWorkerManager.registrations().get(e.serviceWorkerRegistrationId):void 0;return i&&(t=i.scopeURL.substr(i.securityOrigin.length)),{id:this.dataGrid.rootNode().children.length+1,timestamp:h.UIUtils.formatTimestamp(1e3*e.timestamp,!0),origin:e.origin,"storage-key":e.storageKey,"sw-scope":t,"event-name":e.eventName,"instance-id":e.instanceId}}acceptEvent(e){if(e.service!==this.serviceName)return!1;if(this.originCheckbox.checked()||this.storageKeyCheckbox.checked())return!0;const t=e.origin.substr(0,e.origin.length-1),i=e.storageKey;return this.securityOriginManager.securityOrigins().includes(t)||this.storageKeyManager.storageKeys().includes(i)}createLearnMoreLink(){let e="https://developer.chrome.com/docs/devtools/javascript/background-services/?utm_source=devtools";switch(this.serviceName){case"backgroundFetch":e+="#fetch";break;case"backgroundSync":e+="#sync";break;case"pushMessaging":e+="#push";break;case"notifications":e+="#notifications"}return h.XLink.XLink.create(e,Y(Q.learnMore),void 0,void 0,"learn-more")}showPreview(e){if(this.selectedEventNode&&this.selectedEventNode===e)return;if(this.selectedEventNode=e,this.preview&&this.preview.detach(),this.selectedEventNode)return this.preview=this.selectedEventNode.createPreview(),void this.preview.show(this.previewPanel.contentElement);this.preview=new h.Widget.VBox,this.preview.contentElement.classList.add("background-service-preview","fill");const t=this.preview.contentElement.createChild("div");if(this.dataGrid.rootNode().children.length)t.createChild("p").textContent=Y(Q.selectAnEntryToViewMetadata);else if(this.recordButton.toggled()){const e=Z.getUIString(this.serviceName).toLowerCase();t.createChild("p").textContent=Y(Q.recordingSActivity,{PH1:e}),t.createChild("p").textContent=Y(Q.devtoolsWillRecordAllSActivity,{PH1:e})}else{const e=h.Toolbar.Toolbar.createActionButton(this.recordAction),s=document.createElement("b");s.classList.add("background-service-shortcut"),s.textContent=h.ShortcutRegistry.ShortcutRegistry.instance().shortcutsForAction("background-service.toggle-recording")[0].title();const r=h.UIUtils.createInlineButton(e);r.classList.add("background-service-record-inline-button"),t.createChild("p").appendChild(i.i18n.getFormatLocalizedString(X,Q.clickTheRecordButtonSOrHitSTo,{PH1:r,PH2:s})),t.appendChild(this.createLearnMoreLink())}this.preview.show(this.previewPanel.contentElement)}async saveToFile(){const e=`${this.serviceName}-${s.DateUtilities.toISO8601Compact(new Date)}.json`,t=new S.FileUtils.FileOutputStream;if(!await t.open(e))return;const i=this.model.getEvents(this.serviceName).filter((e=>this.acceptEvent(e)));await t.write(JSON.stringify(i,void 0,2)),t.close()}wasShown(){super.wasShown(),this.registerCSSFiles([$,J])}}class ee extends b.DataGrid.DataGridNode{eventMetadata;constructor(e,t){super(e),this.eventMetadata=t.sort(((e,t)=>s.StringUtilities.compare(e.key,t.key)))}createPreview(){const e=new h.Widget.VBox;e.element.classList.add("background-service-metadata"),e.element.setAttribute("jslog",`${m.section("metadata")}`);for(const t of this.eventMetadata){const i=document.createElement("div");i.classList.add("background-service-metadata-entry"),i.createChild("div","background-service-metadata-name").textContent=t.key+": ",t.value?i.createChild("div","background-service-metadata-value source-code").textContent=t.value:i.createChild("div","background-service-metadata-value background-service-empty-value").textContent=Y(Q.empty),e.element.appendChild(i)}if(!e.element.children.length){const t=document.createElement("div");t.classList.add("background-service-metadata-entry"),t.createChild("div","background-service-metadata-name background-service-empty-value").textContent=Y(Q.noMetadataForThisEvent),e.element.appendChild(t)}return e}}var te=Object.freeze({__proto__:null,BackgroundServiceView:Z,EventDataNode:ee,ActionDelegate:class{handleAction(e,t){const i=e.flavor(Z);if("background-service.toggle-recording"===t){if(!i)throw new Error("BackgroundServiceView instance is missing");return i.toggleRecording(),!0}return!1}}});const ie={bounceTrackingMitigations:"Bounce tracking mitigations"},se=i.i18n.registerUIStrings("panels/application/BounceTrackingMitigationsTreeElement.ts",ie),re=i.i18n.getLocalizedString.bind(void 0,se);class ae extends P{view;constructor(e){super(e,re(ie.bounceTrackingMitigations),!1,"bounce-tracking-mitigations");const t=d.Icon.create("database");this.setLeadingIcons([t])}get itemURL(){return"bounce-tracking-mitigations://"}onselect(e){return super.onselect(e),this.view||(this.view=l.LegacyWrapper.legacyWrapper(h.Widget.Widget,new w.BounceTrackingMitigationsView.BounceTrackingMitigationsView)),this.showView(this.view),t.userMetrics.panelShown("bounce-tracking-mitigations"),!1}}var oe=Object.freeze({__proto__:null,i18nString:re,BounceTrackingMitigationsTreeElement:ae});class ne extends e.ObjectWrapper.ObjectWrapper{model;storageKeyInternal;isLocalStorageInternal;constructor(e,t,i){super(),this.model=e,this.storageKeyInternal=t,this.isLocalStorageInternal=i}static storageId(e,t){return{storageKey:e,isLocalStorage:t}}get id(){return ne.storageId(this.storageKeyInternal,this.isLocalStorageInternal)}get storageKey(){return this.storageKeyInternal}get isLocalStorage(){return this.isLocalStorageInternal}getItems(){return this.model.agent.invoke_getDOMStorageItems({storageId:this.id}).then((({entries:e})=>e))}setItem(e,t){this.model.agent.invoke_setDOMStorageItem({storageId:this.id,key:e,value:t})}removeItem(e){this.model.agent.invoke_removeDOMStorageItem({storageId:this.id,key:e})}clear(){this.model.agent.invoke_clear({storageId:this.id})}}class de extends o.SDKModel.SDKModel{storageKeyManagerInternal;storagesInternal;agent;enabled;constructor(e){super(e),this.storageKeyManagerInternal=e.model(o.StorageKeyManager.StorageKeyManager),this.storagesInternal={},this.agent=e.domstorageAgent()}get storageKeyManagerForTest(){return this.storageKeyManagerInternal}enable(){if(!this.enabled){if(this.target().registerDOMStorageDispatcher(new le(this)),this.storageKeyManagerInternal){this.storageKeyManagerInternal.addEventListener("StorageKeyAdded",this.storageKeyAdded,this),this.storageKeyManagerInternal.addEventListener("StorageKeyRemoved",this.storageKeyRemoved,this);for(const e of this.storageKeyManagerInternal.storageKeys())this.addStorageKey(e)}this.agent.invoke_enable(),this.enabled=!0}}clearForStorageKey(e){if(this.enabled){for(const t of[!0,!1]){const i=this.storageKey(e,t),s=this.storagesInternal[i];if(!s)return;s.clear()}this.removeStorageKey(e),this.addStorageKey(e)}}storageKeyAdded(e){this.addStorageKey(e.data)}addStorageKey(e){for(const t of[!0,!1]){const i=this.storageKey(e,t);console.assert(!this.storagesInternal[i]);const s=new ne(this,e,t);this.storagesInternal[i]=s,this.dispatchEventToListeners("DOMStorageAdded",s)}}storageKeyRemoved(e){this.removeStorageKey(e.data)}removeStorageKey(e){for(const t of[!0,!1]){const i=this.storageKey(e,t),s=this.storagesInternal[i];s&&(delete this.storagesInternal[i],this.dispatchEventToListeners("DOMStorageRemoved",s))}}storageKey(e,t){return JSON.stringify(ne.storageId(e,t))}domStorageItemsCleared(e){const t=this.storageForId(e);t&&t.dispatchEventToListeners("DOMStorageItemsCleared")}domStorageItemRemoved(e,t){const i=this.storageForId(e);if(!i)return;const s={key:t};i.dispatchEventToListeners("DOMStorageItemRemoved",s)}domStorageItemAdded(e,t,i){const s=this.storageForId(e);if(!s)return;const r={key:t,value:i};s.dispatchEventToListeners("DOMStorageItemAdded",r)}domStorageItemUpdated(e,t,i,s){const r=this.storageForId(e);if(!r)return;const a={key:t,oldValue:i,value:s};r.dispatchEventToListeners("DOMStorageItemUpdated",a)}storageForId(e){return console.assert(Boolean(e.storageKey)),this.storagesInternal[this.storageKey(e.storageKey||"",e.isLocalStorage)]}storages(){const e=[];for(const t in this.storagesInternal)e.push(this.storagesInternal[t]);return e}}o.SDKModel.SDKModel.register(de,{capabilities:2,autostart:!1});class le{model;constructor(e){this.model=e}domStorageItemsCleared({storageId:e}){this.model.domStorageItemsCleared(e)}domStorageItemRemoved({storageId:e,key:t}){this.model.domStorageItemRemoved(e,t)}domStorageItemAdded({storageId:e,key:t,newValue:i}){this.model.domStorageItemAdded(e,t,i)}domStorageItemUpdated({storageId:e,key:t,oldValue:i,newValue:s}){this.model.domStorageItemUpdated(e,t,i,s)}}var ce=Object.freeze({__proto__:null,DOMStorage:ne,DOMStorageModel:de,DOMStorageDispatcher:le});const he="";class ge extends o.SDKModel.SDKModel{storageBucketModel;indexedDBAgent;storageAgent;databasesInternal;databaseNamesByStorageKeyAndBucket;updatedStorageBuckets;throttler;enabled;constructor(t){super(t),t.registerStorageDispatcher(this),this.storageBucketModel=t.model(o.StorageBucketsModel.StorageBucketsModel),this.indexedDBAgent=t.indexedDBAgent(),this.storageAgent=t.storageAgent(),this.databasesInternal=new Map,this.databaseNamesByStorageKeyAndBucket=new Map,this.updatedStorageBuckets=new Set,this.throttler=new e.Throttler.Throttler(1e3)}static keyFromIDBKey(e){if(null==e)return;let t;switch(typeof e){case"number":t={type:"number",number:e};break;case"string":t={type:"string",string:e};break;case"object":if(e instanceof Date)t={type:"date",date:e.getTime()};else{if(!Array.isArray(e))return;{const i=[];for(let t=0;t<e.length;++t){const s=ge.keyFromIDBKey(e[t]);s&&i.push(s)}t={type:"array",array:i}}}break;default:return}return t}static keyRangeFromIDBKeyRange(e){return{lower:ge.keyFromIDBKey(e.lower),upper:ge.keyFromIDBKey(e.upper),lowerOpen:Boolean(e.lowerOpen),upperOpen:Boolean(e.upperOpen)}}static idbKeyPathFromKeyPath(e){let t;switch(e.type){case"null":t=null;break;case"string":t=e.string;break;case"array":t=e.array}return t}static keyPathStringFromIDBKeyPath(e){return"string"==typeof e?'"'+e+'"':e instanceof Array?'["'+e.join('", "')+'"]':null}enable(){if(!this.enabled){if(this.indexedDBAgent.invoke_enable(),this.storageBucketModel){this.storageBucketModel.addEventListener("BucketAdded",this.storageBucketAdded,this),this.storageBucketModel.addEventListener("BucketRemoved",this.storageBucketRemoved,this);for(const{bucket:e}of this.storageBucketModel.getBuckets())this.addStorageBucket(e)}this.enabled=!0}}clearForStorageKey(e){if(!this.enabled||!this.databaseNamesByStorageKeyAndBucket.has(e))return;for(const[t]of this.databaseNamesByStorageKeyAndBucket.get(e)||[]){const i=this.storageBucketModel?.getBucketByName(e,t??void 0)?.bucket;i&&this.removeStorageBucket(i)}this.databaseNamesByStorageKeyAndBucket.delete(e);const t=this.storageBucketModel?.getBucketsForStorageKey(e)||[];for(const{bucket:e}of t)this.addStorageBucket(e)}async deleteDatabase(e){this.enabled&&(await this.indexedDBAgent.invoke_deleteDatabase({storageBucket:e.storageBucket,databaseName:e.name}),this.loadDatabaseNamesByStorageBucket(e.storageBucket)