import*as i18n from"../i18n/i18n.js";import{Issue,IssueCategory,resolveLazyDescription}from"./Issue.js";const UIStrings={changesToQualityCriteriaForPwas:"Changes to quality criteria for PWAs using Trusted Web Activity"},str_=i18n.i18n.registerUIStrings("sdk/TrustedWebActivityIssue.ts",UIStrings),i18nLazyString=i18n.i18n.getLazilyComputedLocalizedString.bind(void 0,str_);export class TrustedWebActivityIssue extends Issue{constructor(i){super([Protocol.Audits.InspectorIssueCode.TrustedWebActivityIssue,i.violationType].join("::")),this.issueDetails=i}details(){return this.issueDetails}getDescription(){const i=resolveLazyDescription(issueDescriptions.get(this.issueDetails.violationType));if(i)return i;throw new Error("Incorrect violationType")}getCategory(){return IssueCategory.TrustedWebActivity}primaryKey(){return`${Protocol.Audits.InspectorIssueCode.TrustedWebActivityIssue}-${JSON.stringify(this.issueDetails)}`}}const twaDigitalAssetLinksFailed={file:"issues/descriptions/TwaDigitalAssetLinksFailed.md",substitutions:void 0,links:[{link:"https://blog.chromium.org/2020/06/changes-to-quality-criteria-for-pwas.html",linkTitle:i18nLazyString(UIStrings.changesToQualityCriteriaForPwas)}]},twaHttpError={file:"issues/descriptions/TwaHttpError.md",substitutions:void 0,links:[{link:"https://blog.chromium.org/2020/06/changes-to-quality-criteria-for-pwas.html",linkTitle:i18nLazyString(UIStrings.changesToQualityCriteriaForPwas)}]},twaPageUnavailableOffline={file:"issues/descriptions/TwaPageUnavailableOffline.md",substitutions:void 0,links:[{link:"https://blog.chromium.org/2020/06/changes-to-quality-criteria-for-pwas.html",linkTitle:i18nLazyString(UIStrings.changesToQualityCriteriaForPwas)}]};export const httpViolationCode=[Protocol.Audits.InspectorIssueCode.TrustedWebActivityIssue,Protocol.Audits.TwaQualityEnforcementViolationType.KHttpError].join("::");export const offlineViolationCode=[Protocol.Audits.InspectorIssueCode.TrustedWebActivityIssue,Protocol.Audits.TwaQualityEnforcementViolationType.KUnavailableOffline].join("::");export const assetlinkViolationCode=[Protocol.Audits.InspectorIssueCode.TrustedWebActivityIssue,Protocol.Audits.TwaQualityEnforcementViolationType.KDigitalAssetLinks].join("::");const issueDescriptions=new Map([[Protocol.Audits.TwaQualityEnforcementViolationType.KHttpError,twaHttpError],[Protocol.Audits.TwaQualityEnforcementViolationType.KUnavailableOffline,twaPageUnavailableOffline],[Protocol.Audits.TwaQualityEnforcementViolationType.KDigitalAssetLinks,twaDigitalAssetLinksFailed]]);