var Ae=Object.defineProperty;var de=(c,e)=>{for(var t in e)Ae(c,t,{get:e[t],enumerable:!0})};var pe={};de(pe,{CertificateSecurityState:()=>$,Events:()=>D,PageVisibleSecurityState:()=>K,SecurityModel:()=>L,SecurityStyleExplanation:()=>u,SummaryMessages:()=>ie,securityStateCompare:()=>te});import*as G from"./../../core/i18n/i18n.js";import*as R from"./../../core/sdk/sdk.js";var E={theSecurityOfThisPageIsUnknown:"The security of this page is unknown.",thisPageIsNotSecure:"This page is not secure.",thisPageIsSecureValidHttps:"This page is secure (valid HTTPS).",thisPageIsNotSecureBrokenHttps:"This page is not secure (broken HTTPS).",cipherWithMAC:"{PH1} with {PH2}",keyExchangeWithGroup:"{PH1} with {PH2}"},me=G.i18n.registerUIStrings("panels/security/SecurityModel.ts",E),he=G.i18n.getLocalizedString.bind(void 0,me),N=G.i18n.getLazilyComputedLocalizedString.bind(void 0,me),L=class extends R.SDKModel.SDKModel{dispatcher;securityAgent;constructor(e){super(e),this.dispatcher=new ee(this),this.securityAgent=e.securityAgent(),e.registerSecurityDispatcher(this.dispatcher),this.securityAgent.invoke_enable()}resourceTreeModel(){return this.target().model(R.ResourceTreeModel.ResourceTreeModel)}networkManager(){return this.target().model(R.NetworkManager.NetworkManager)}};function te(c,e){let t=["info","insecure-broken","insecure","neutral","secure","unknown"];return t.indexOf(c)-t.indexOf(e)}R.SDKModel.SDKModel.register(L,{capabilities:512,autostart:!1});var D;(function(c){c.VisibleSecurityStateChanged="VisibleSecurityStateChanged"})(D||(D={}));var ie={unknown:N(E.theSecurityOfThisPageIsUnknown),insecure:N(E.thisPageIsNotSecure),neutral:N(E.thisPageIsNotSecure),secure:N(E.thisPageIsSecureValidHttps),"insecure-broken":N(E.thisPageIsNotSecureBrokenHttps)},K=class{securityState;certificateSecurityState;safetyTipInfo;securityStateIssueIds;constructor(e,t,i,n){this.securityState=e,this.certificateSecurityState=t?new $(t):null,this.safetyTipInfo=i?new Z(i):null,this.securityStateIssueIds=n}},$=class{protocol;keyExchange;keyExchangeGroup;cipher;mac;certificate;subjectName;issuer;validFrom;validTo;certificateNetworkError;certificateHasWeakSignature;certificateHasSha1Signature;modernSSL;obsoleteSslProtocol;obsoleteSslKeyExchange;obsoleteSslCipher;obsoleteSslSignature;constructor(e){this.protocol=e.protocol,this.keyExchange=e.keyExchange,this.keyExchangeGroup=e.keyExchangeGroup||null,this.cipher=e.cipher,this.mac=e.mac||null,this.certificate=e.certificate,this.subjectName=e.subjectName,this.issuer=e.issuer,this.validFrom=e.validFrom,this.validTo=e.validTo,this.certificateNetworkError=e.certificateNetworkError||null,this.certificateHasWeakSignature=e.certificateHasWeakSignature,this.certificateHasSha1Signature=e.certificateHasSha1Signature,this.modernSSL=e.modernSSL,this.obsoleteSslProtocol=e.obsoleteSslProtocol,this.obsoleteSslKeyExchange=e.obsoleteSslKeyExchange,this.obsoleteSslCipher=e.obsoleteSslCipher,this.obsoleteSslSignature=e.obsoleteSslSignature}isCertificateExpiringSoon(){let e=new Date(this.validTo*1e3).getTime();return e<new Date(Date.now()).setHours(48)&&e>Date.now()}getKeyExchangeName(){return this.keyExchangeGroup?this.keyExchange?he(E.keyExchangeWithGroup,{PH1:this.keyExchange,PH2:this.keyExchangeGroup}):this.keyExchangeGroup:this.keyExchange}getCipherFullName(){return this.mac?he(E.cipherWithMAC,{PH1:this.cipher,PH2:this.mac}):this.cipher}},Z=class{safetyTipStatus;safeUrl;constructor(e){this.safetyTipStatus=e.safetyTipStatus,this.safeUrl=e.safeUrl||null}},u=class{securityState;title;summary;description;certificate;mixedContentType;recommendations;constructor(e,t,i,n,o=[],l="none",d=[]){this.securityState=e,this.title=t,this.summary=i,this.description=n,this.certificate=o,this.mixedContentType=l,this.recommendations=d}},ee=class{model;constructor(e){this.model=e}securityStateChanged(e){}visibleSecurityStateChanged({visibleSecurityState:e}){let t=new K(e.securityState,e.certificateSecurityState||null,e.safetyTipInfo||null,e.securityStateIssueIds);this.model.dispatchEventToListeners(D.VisibleSecurityStateChanged,t)}certificateError(e){}};var ke={};de(ke,{OriginGroup:()=>p,SecurityDetailsTable:()=>U,SecurityMainView:()=>Y,SecurityOriginView:()=>X,SecurityPanel:()=>V,createHighlightedUrl:()=>_,getSecurityStateIconForDetailedView:()=>I,getSecurityStateIconForOverview:()=>A});import*as x from"./../../core/common/common.js";import*as ne from"./../../core/host/host.js";import*as J from"./../../core/i18n/i18n.js";import*as S from"./../../core/sdk/sdk.js";import*as H from"./../network/forward/forward.js";import{createIcon as Se}from"./../../ui/kit/kit.js";import*as a from"./../../ui/legacy/legacy.js";import{html as Ue,render as Le}from"./../../ui/lit/lit.js";import*as Q from"./../../ui/visual_logging/visual_logging.js";var O=`.lock-icon,
.security-property{height:var(--sys-size-9);width:var(--sys-size-9)}.lock-icon-secure{color:var(--sys-color-green)}.lock-icon-insecure{color:var(--sys-color-error)}.lock-icon-insecure-broken{color:var(--sys-color-error)}.security-property-secure{color:var(--sys-color-green)}.security-property-neutral{color:var(--sys-color-error)}.security-property-insecure{color:var(--sys-color-error)}.security-property-insecure-broken{color:var(--sys-color-error)}.security-property-info{color:var(--sys-color-on-surface-subtle)}.security-property-unknown{color:var(--sys-color-on-surface-subtle)}.url-scheme-secure{color:var(--sys-color-green)}.url-scheme-neutral,
.url-scheme-insecure,
.url-scheme-insecure-broken{color:var(--sys-color-error)}
/*# sourceURL=${import.meta.resolve("./lockIcon.css")} */`;var ge=`.devtools-link{display:inline-block}.security-main-view{overflow:hidden auto;background-color:var(--sys-color-cdt-base-container)}.security-main-view > div{flex-shrink:0}.security-summary-section-title{font-size:15px;margin:12px 16px;user-select:text}.lock-spectrum{margin:8px 16px;display:flex;align-items:flex-start}.security-summary .lock-icon{flex:none;width:16px;height:16px;margin:0}.security-summary .lock-icon-neutral{margin:0 16px}.security-summary:not(.security-summary-secure) .lock-icon-secure,
.security-summary:not(.security-summary-neutral) .lock-icon-neutral,
.security-summary:not(.security-summary-insecure) .lock-icon-insecure,
.security-summary:not(.security-summary-insecure-broken) .lock-icon-insecure-broken{color:var(--sys-color-state-disabled)}@media (forced-colors: active){.security-summary-neutral .lock-icon-neutral{color:Highlight}.security-summary:not(.security-summary-secure) .lock-icon-secure,
  .security-summary:not(.security-summary-neutral) .lock-icon-neutral,
  .security-summary:not(.security-summary-insecure) .lock-icon-insecure,
  .security-summary:not(.security-summary-insecure-broken) .lock-icon-insecure-broken{color:canvastext}}.triangle-pointer-container{margin:8px 24px 0;padding:0}.triangle-pointer-wrapper{transform:translateX(0);transition:transform 0.3s}.triangle-pointer{width:12px;height:12px;margin-bottom:-6px;margin-left:-6px;transform:rotate(-45deg);border-style:solid;border-width:1px 1px 0 0;background:var(--sys-color-cdt-base-container);border-color:var(--sys-color-neutral-outline)}.security-summary-secure .triangle-pointer-wrapper{transform:translateX(0)}.security-summary-neutral .triangle-pointer-wrapper{transform:translateX(32px)}.security-summary-insecure .triangle-pointer-wrapper{transform:translateX(64px)}.security-summary-insecure-broken .triangle-pointer-wrapper{transform:translateX(64px)}.security-summary-text{padding:16px 24px;border-style:solid;border-width:1px 0;font-size:15px;background:var(--sys-color-cdt-base-container);border-color:var(--sys-color-neutral-outline);user-select:text}.security-summary-secure .triangle-pointer,
.security-summary-secure .security-summary-text,
.security-explanation-title-secure{color:var(--sys-color-green)}.security-summary-insecure-broken .triangle-pointer,
.security-summary-insecure-broken .security-summary-text,
.security-explanation-title-neutral,
.security-explanation-title-insecure,
.security-explanation-title-insecure-broken{color:var(--sys-color-error)}.security-explanation-list{padding-bottom:16px}.security-explanation-list:empty{border-bottom:none;padding:0}.security-explanations-main{margin-top:-5px;background-color:var(--sys-color-cdt-base-container);border-bottom:1px solid var(--sys-color-divider)}.security-explanations-extra{background-color:transparent}.security-explanation{padding:11px;display:flex;white-space:nowrap;border:none;color:var(--sys-color-token-subtle)}.security-explanation-text{flex:auto;white-space:normal;max-width:400px}.origin-button{margin-top:var(--sys-size-4)}.security-explanation .security-property{flex:none;width:16px;height:16px;margin-right:16px}.security-explanation-title{color:var(--sys-color-token-subtle);margin-top:1px;margin-bottom:8px}.security-mixed-content{margin-top:8px}.security-explanation-recommendations{padding-inline-start:16px}.security-explanation-recommendations > li{margin-bottom:4px}
/*# sourceURL=${import.meta.resolve("./mainView.css")} */`;import*as j from"./../../ui/legacy/legacy.js";var z=class extends j.TreeOutline.TreeElement{constructor(e="",t=!1,i){super(e,t,i),j.ARIAUtils.setLabel(this.listItemElement,e)}get elemId(){return"overview"}showElement(){throw new Error("Unimplemented Method")}onselect(e){if(e){let t=this.elemId;this.listItemElement.dispatchEvent(new CustomEvent("update-sidebar-selection",{bubbles:!0,composed:!0,detail:{id:t}})),this.showElement()}return!1}};var M=class c extends Event{static eventName="showorigin";origin;constructor(e){super(c.eventName,{bubbles:!0,composed:!0}),this.origin=e}},P=class extends z{#t;#i;#e=null;constructor(e,t,i=null){super(),this.#i=t,this.#e=i,this.listItemElement.classList.add(e),this.#t=null,this.setSecurityState("unknown")}setSecurityState(e){this.#t=e,this.#i(this)}securityState(){return this.#t}origin(){return this.#e}showElement(){this.listItemElement.dispatchEvent(new M(this.#e))}};var ye=`.title-section{padding:16px 0 24px;border-bottom:1px solid var(--sys-color-divider)}.title-section-header{padding-left:16px;padding-bottom:10px;font-size:14px}.security-origin-view{overflow:hidden scroll;display:block;user-select:text}.security-origin-view .origin-view-section{border-bottom:1px solid var(--sys-color-divider);padding:12px 6px 12px 24px;font-size:12px}.origin-view-notes{margin-top:2px;color:var(--sys-color-token-subtle)}.origin-view-section-notes{margin-top:6px;color:var(--sys-color-token-subtle)}.security-origin-view .origin-display{font-size:12px;padding-left:var(--sys-size-8);display:flex;align-items:center}.title-section > .view-network-button{padding:6px 0 0 16px}.security-origin-view .origin-display devtools-icon{width:var(--sys-size-8);height:var(--sys-size-8);margin-right:var(--sys-size-6)}.security-origin-view .origin-view-section-title{margin-top:4px;margin-bottom:4px;font-weight:bold}.security-origin-view .details-table{border-spacing:0}.security-origin-view .details-table-row{white-space:nowrap;overflow:hidden;line-height:22px;vertical-align:top}.security-origin-view .details-table-row > td{padding:0}.security-origin-view .details-table-row > td:first-child{color:var(--sys-color-token-subtle);width:calc(120px + 1em);text-align:right;padding-right:1em}.security-origin-view .details-table-row > td:nth-child(2){white-space:normal}.security-origin-view .sct-details .details-table .details-table-row:last-child td:last-child{border-bottom:1px solid var(--sys-color-divider);padding-bottom:10px}.security-origin-view .sct-details .details-table:last-child .details-table-row:last-child td:last-child{border-bottom:none;padding-bottom:0}.security-origin-view .details-toggle{margin-left:126px}.security-origin-view .sct-toggle{margin-left:145px;padding-top:5px}.security-origin-view .details-table .empty-san{color:var(--sys-color-state-disabled)}.security-origin-view .details-table .san-entry{display:block}.security-origin-view .truncated-san .truncated-entry{display:none}.origin-view-section:last-child{border-bottom:none}.devtools-link{display:inline-flex}
/*# sourceURL=${import.meta.resolve("./originView.css")} */`;import*as we from"./../../core/common/common.js";import*as se from"./../../core/i18n/i18n.js";import*as ve from"./../../core/platform/platform.js";import*as v from"./../../ui/legacy/legacy.js";var fe=`.tree-outline-disclosure{width:100%}.tree-outline li.security-group-list-item{& + ol{padding-left:0}&::before{display:none}&:not(:first-child){margin-top:var(--sys-size-6)}}.security-main-view-reload-message{color:var(--sys-color-token-subtle)}.tree-outline li.security-sidebar-origins + .children > li{&.selected{.url-scheme-secure{color:var(--sys-color-green)}.url-scheme-neutral,
    .url-scheme-insecure,
    .url-scheme-insecure-broken{color:var(--sys-color-error)}}}.security-main-view-reload-message,
.tree-outline li.security-sidebar-origins,
.tree-outline li.security-group-list-item,
.tree-outline span{font:var(--sys-typescale-body4-medium);&:hover:not(:has(devtools-checkbox)) .selection{background:transparent}}.tree-outline li{& .leading-icons{flex:none}& .tree-element-title,
  .highlighted-url,
  .title{overflow:hidden;text-overflow:ellipsis}}
/*# sourceURL=${import.meta.resolve("./sidebar.css")} */`;var C={security:"Security",mainOrigin:"Main origin",nonsecureOrigins:"Non-secure origins",secureOrigins:"Secure origins",unknownCanceled:"Unknown / canceled",overview:"Overview",reloadToViewDetails:"Reload to view details"},Re=se.i18n.registerUIStrings("panels/security/SecurityPanelSidebar.ts",C),k=se.i18n.getLocalizedString.bind(void 0,Re),F=class extends v.Widget.VBox{#t;sidebarTree;#i;#e;securityOverviewElement;#r;#s;#n;constructor(e){super(e),this.#t=we.Settings.Settings.instance().createSetting("security-last-selected-element-path",""),this.#n=null,this.sidebarTree=new v.TreeOutline.TreeOutlineInShadow("NavigationTree"),this.sidebarTree.registerRequiredCSS(O,fe),this.sidebarTree.element.classList.add("security-sidebar"),this.contentElement.appendChild(this.sidebarTree.element);let t=k(C.security),i=this.#l(t,"security");this.securityOverviewElement=new P("security-main-view-sidebar-tree-item",this.#c),this.securityOverviewElement.tooltip=k(C.overview),i.appendChild(this.securityOverviewElement),this.#i=new Map([[p.MainOrigin,{title:k(C.mainOrigin)}],[p.NonSecure,{title:k(C.nonsecureOrigins),icon:I("insecure","lock-icon lock-icon-insecure")}],[p.Secure,{title:k(C.secureOrigins),icon:I("secure","lock-icon lock-icon-secure")}],[p.Unknown,{title:k(C.unknownCanceled),icon:I("unknown","lock-icon lock-icon-unknown")}]]),this.#e=new Map;for(let o of Object.values(p)){let l=this.#d(this.#i.get(o)?.title,this.#i.get(o)?.icon);this.#e.set(o,l),i.appendChild(l)}this.#s=new v.TreeOutline.TreeElement(k(C.reloadToViewDetails)),this.#s.selectable=!1,this.#s.listItemElement.classList.add("security-main-view-reload-message"),this.#e.get(p.MainOrigin).appendChild(this.#s),this.#a(),this.#r=new Map,this.element.addEventListener("update-sidebar-selection",o=>{let l=o.detail.id;this.#t.set(l)}),this.showLastSelectedElement()}elementsByOrigin(){return this.#r}showLastSelectedElement(){this.securityOverviewElement.select(),this.securityOverviewElement.showElement()}#l(e,t){let i=new v.TreeOutline.TreeElement(e,!0,t);return i.listItemElement.classList.add("security-group-list-item"),i.setCollapsible(!1),i.selectable=!1,this.sidebarTree.appendChild(i),v.ARIAUtils.markAsHeading(i.listItemElement,3),v.ARIAUtils.setLabel(i.childrenListElement,e),i}#u(e){return this.#i.get(e)?.title}#o(e){return this.#e.get(e)}#d(e,t){let i=new v.TreeOutline.TreeElement(e,!0);return i.expand(),i.listItemElement.classList.add("security-sidebar-origins"),t&&i.setLeadingIcons([t]),v.ARIAUtils.setLabel(i.childrenListElement,e),i}toggleOriginsList(e){for(let t of this.#e.values())t.hidden=e}addOrigin(e,t){this.#s.hidden=!0;let i=new P("security-sidebar-tree-item",this.#c,e);i.tooltip=e,this.#r.set(e,i),this.updateOrigin(e,t)}setMainOrigin(e){this.#n=e}get mainOrigin(){return this.#n}get originGroups(){return this.#e}updateOrigin(e,t){let i=this.#r.get(e);i.setSecurityState(t);let n;if(e===this.#n)n=this.#e.get(p.MainOrigin),n.title=k(C.mainOrigin),t==="secure"?n.setLeadingIcons([A(t,`lock-icon lock-icon-${t}`)]):n.setLeadingIcons([A(t,`lock-icon lock-icon-${t}`)]),v.ARIAUtils.setLabel(n.childrenListElement,n.title);else switch(t){case"secure":n=this.#o(p.Secure);break;case"unknown":n=this.#o(p.Unknown);break;default:n=this.#o(p.NonSecure);break}let o=i.parent;o!==n&&(o&&(o.removeChild(i),o.childCount()===0&&(o.hidden=!0)),n.appendChild(i),n.hidden=!1)}#a(){for(let[e,t]of this.#e)if(e===p.MainOrigin){for(let i=t.childCount()-1;i>0;i--)t.removeChildAtIndex(i);t.title=this.#u(p.MainOrigin),t.hidden=!1,this.#s.hidden=!1}else t.removeChildren(),t.hidden=!0}clearOrigins(){this.#a(),this.#r.clear()}focus(){this.sidebarTree.focus()}#c(e){if(e instanceof P){let t=e.securityState()??"unknown",i=e.listItemElement.classList.contains("security-main-view-sidebar-tree-item"),n=i?A(t,`lock-icon lock-icon-${t}`):I(t,`security-property security-property-${t}`);if(e.setLeadingIcons([n]),i)e.title=k(C.overview);else{let o=_(e.origin()??ve.DevToolsPath.EmptyUrlString,t);e.listItemElement.lastChild&&e.listItemElement.removeChild(e.listItemElement.lastChild),e.listItemElement.appendChild(o)}}}};var{widget:De,widgetRef:Pe}=a.Widget,s={securityOverview:"Security overview",secure:"Secure",info:"Info",notSecure:"Not secure",viewCertificate:"View certificate",notSecureBroken:"Not secure (broken)",thisPageIsDangerousFlaggedBy:"This page is dangerous (flagged by Google Safe Browsing).",flaggedByGoogleSafeBrowsing:"Flagged by Google Safe Browsing",toCheckThisPagesStatusVisit:"To check this page's status, visit g.co/safebrowsingstatus.",thisIsAnErrorPage:"This is an error page.",thisPageIsInsecureUnencrypted:"This page is insecure (unencrypted HTTP).",thisPageHasANonhttpsSecureOrigin:"This page has a non-HTTPS secure origin.",thisPageIsSuspicious:"This page is suspicious",chromeHasDeterminedThatThisSiteS:"Chrome has determined that this site could be fake or fraudulent.",ifYouBelieveThisIsShownIn:"If you believe this is shown in error please visit https://g.co/chrome/lookalike-warnings.",possibleSpoofingUrl:"Possible spoofing URL",thisSitesHostnameLooksSimilarToP:"This site's hostname looks similar to {PH1}. Attackers sometimes mimic sites by making small, hard-to-see changes to the domain name.",ifYouBelieveThisIsShownInErrorSafety:"If you believe this is shown in error please visit https://g.co/chrome/lookalike-warnings.",thisPageIsSuspiciousFlaggedBy:"This page is suspicious (flagged by Chrome).",certificate:"Certificate",insecureSha:"insecure (SHA-1)",theCertificateChainForThisSite:"The certificate chain for this site contains a certificate signed using SHA-1.",subjectAlternativeNameMissing:"`Subject Alternative Name` missing",theCertificateForThisSiteDoesNot:"The certificate for this site does not contain a `Subject Alternative Name` extension containing a domain name or IP address.",missing:"missing",thisSiteIsMissingAValidTrusted:"This site is missing a valid, trusted certificate ({PH1}).",validAndTrusted:"valid and trusted",theConnectionToThisSiteIsUsingA:"The connection to this site is using a valid, trusted server certificate issued by {PH1}.",publickeypinningBypassed:"Public-Key-Pinning bypassed",publickeypinningWasBypassedByA:"Public-Key-Pinning was bypassed by a local root certificate.",certificateExpiresSoon:"Certificate expires soon",theCertificateForThisSiteExpires:"The certificate for this site expires in less than 48 hours and needs to be renewed.",connection:"Connection",secureConnectionSettings:"secure connection settings",theConnectionToThisSiteIs:"The connection to this site is encrypted and authenticated using {PH1}, {PH2}, and {PH3}.",sIsObsoleteEnableTlsOrLater:"{PH1} is obsolete. Enable TLS 1.2 or later.",rsaKeyExchangeIsObsoleteEnableAn:"RSA key exchange is obsolete. Enable an ECDHE-based cipher suite.",sIsObsoleteEnableAnAesgcmbased:"{PH1} is obsolete. Enable an AES-GCM-based cipher suite.",theServerSignatureUsesShaWhichIs:"The server signature uses SHA-1, which is obsolete. Enable a SHA-2 signature algorithm instead. (Note this is different from the signature in the certificate.)",obsoleteConnectionSettings:"obsolete connection settings",resources:"Resources",activeMixedContent:"active mixed content",youHaveRecentlyAllowedNonsecure:"You have recently allowed non-secure content (such as scripts or iframes) to run on this site.",mixedContent:"mixed content",thisPageIncludesHttpResources:"This page includes HTTP resources.",nonsecureForm:"non-secure form",thisPageIncludesAFormWithA:'This page includes a form with a non-secure "action" attribute.',activeContentWithCertificate:"active content with certificate errors",youHaveRecentlyAllowedContent:"You have recently allowed content loaded with certificate errors (such as scripts or iframes) to run on this site.",contentWithCertificateErrors:"content with certificate errors",thisPageIncludesResourcesThat:"This page includes resources that were loaded with certificate errors.",allServedSecurely:"all served securely",allResourcesOnThisPageAreServed:"All resources on this page are served securely.",blockedMixedContent:"Blocked mixed content",yourPageRequestedNonsecure:"Your page requested non-secure resources that were blocked.",reloadThePageToRecordRequestsFor:"Reload the page to record requests for HTTP resources.",viewDRequestsInNetworkPanel:"{n, plural, =1 {View # request in Network Panel} other {View # requests in Network Panel}}",origin:"Origin",viewRequestsInNetworkPanel:"View requests in Network Panel",protocol:"Protocol",keyExchange:"Key exchange",cipher:"Cipher",serverSignature:"Server signature",encryptedClientHello:"Encrypted ClientHello",certificateTransparency:"Certificate Transparency",subject:"Subject",validFrom:"Valid from",validUntil:"Valid until",issuer:"Issuer",openFullCertificateDetails:"Open full certificate details",sct:"SCT",logName:"Log name",logId:"Log ID",validationStatus:"Validation status",source:"Source",issuedAt:"Issued at",hashAlgorithm:"Hash algorithm",signatureAlgorithm:"Signature algorithm",signatureData:"Signature data",showFullDetails:"Show full details",hideFullDetails:"Hide full details",thisRequestCompliesWithChromes:"This request complies with `Chrome`'s Certificate Transparency policy.",thisRequestDoesNotComplyWith:"This request does not comply with `Chrome`'s Certificate Transparency policy.",thisResponseWasLoadedFromCache:"This response was loaded from cache. Some security details might be missing.",theSecurityDetailsAboveAreFrom:"The security details above are from the first inspected response.",thisOriginIsANonhttpsSecure:"This origin is a non-HTTPS secure origin.",yourConnectionToThisOriginIsNot:"Your connection to this origin is not secure.",noSecurityInformation:"No security information",noSecurityDetailsAreAvailableFor:"No security details are available for this origin.",na:"(n/a)",showLess:"Show less",showMoreSTotal:"Show more ({PH1} total)",unknownField:"unknown",enabled:"enabled"},He=J.i18n.registerUIStrings("panels/security/SecurityPanel.ts",s),r=J.i18n.getLocalizedString.bind(void 0,He),re,Ne=new Map([[513,"RSA with SHA-1"],[1025,"RSA with SHA-256"],[1281,"RSA with SHA-384"],[1537,"RSA with SHA-512"],[1027,"ECDSA with SHA-256"],[1283,"ECDSA with SHA-384"],[2052,"RSA-PSS with SHA-256"],[2053,"RSA-PSS with SHA-384"],[2054,"RSA-PSS with SHA-512"]]),xe="lock",be="warning",Ce="indeterminate-question-box";function I(c,e){let t;switch(c){case"neutral":case"insecure":case"insecure-broken":t=be;break;case"secure":t=xe;break;case"info":case"unknown":t=Ce;break}return Se(t,e)}function A(c,e){let t;switch(c){case"unknown":case"neutral":t=Ce;break;case"insecure":case"insecure-broken":t=be;break;case"secure":t=xe;break;case"info":throw new Error(`Unexpected security state ${c}`)}return Se(t,e)}function _(c,e){let i=c.indexOf("://");if(i===-1){let d=document.createElement("span");return d.textContent=c,d}let n=document.createElement("span");n.classList.add("highlighted-url");let o=c.substr(0,i),l=c.substr(i+3);return n.createChild("span","url-scheme-"+e).textContent=o,n.createChild("span","url-scheme-separator").textContent="://",n.createChild("span").textContent=l,n}var Oe=(c,e,t)=>{Le(Ue`
    <devtools-split-view direction="column" name="security"
      ${a.Widget.widgetRef(a.SplitWidget.SplitWidget,i=>{e.splitWidget=i})}>
      <devtools-widget
        slot="sidebar"
        ${De(F)}
        ${Pe(F,i=>{e.sidebar=i})}>
      </devtools-widget>
  </devtools-split-view>`,t)},V=class c extends a.Panel.Panel{view;mainView;sidebar;lastResponseReceivedForLoaderId;origins;filterRequestCounts;visibleView;eventListeners;securityModel;splitWidget;constructor(e=Oe){super("security"),this.view=e,this.update(),this.sidebar.setMinimumSize(100,25),this.sidebar.element.classList.add("panel-sidebar"),this.sidebar.element.setAttribute("jslog",`${Q.pane("sidebar").track({resize:!0})}`),this.mainView=new Y,this.mainView.panel=this,this.element.addEventListener(M.eventName,t=>{t.origin?this.showOrigin(t.origin):this.setVisibleView(this.mainView)}),this.lastResponseReceivedForLoaderId=new Map,this.origins=new Map,this.filterRequestCounts=new Map,this.visibleView=null,this.eventListeners=[],this.securityModel=null,S.TargetManager.TargetManager.instance().observeModels(L,this,{scoped:!0}),S.TargetManager.TargetManager.instance().addModelListener(S.ResourceTreeModel.ResourceTreeModel,S.ResourceTreeModel.Events.PrimaryPageChanged,this.onPrimaryPageChanged,this),this.sidebar.showLastSelectedElement()}static instance(e={forceNew:null}){let{forceNew:t}=e;return(!re||t)&&(re=new c),re}static createCertificateViewerButtonForOrigin(e,t){let i=a.UIUtils.createTextButton(e,async n=>{n.consume();let o=await S.NetworkManager.MultitargetNetworkManager.instance().getCertificate(t);o.length>0&&ne.InspectorFrontendHost.InspectorFrontendHostInstance.showCertificateViewer(o)},{className:"origin-button",jslogContext:"security.view-certificate-for-origin",title:e});return a.ARIAUtils.markAsButton(i),i}static createCertificateViewerButtonForCert(e,t){let i=a.UIUtils.createTextButton(e,n=>{n.consume(),ne.InspectorFrontendHost.InspectorFrontendHostInstance.showCertificateViewer(t)},{className:"origin-button",jslogContext:"security.view-certificate"});return a.ARIAUtils.markAsButton(i),i}update(){this.view({panel:this},this,this.contentElement)}updateVisibleSecurityState(e){this.sidebar.securityOverviewElement.setSecurityState(e.securityState),this.mainView.updateVisibleSecurityState(e)}onVisibleSecurityStateChanged({data:e}){this.updateVisibleSecurityState(e)}showOrigin(e){let t=this.origins.get(e);t&&(t.originView||(t.originView=new X(e,t)),this.setVisibleView(t.originView))}wasShown(){super.wasShown(),this.visibleView||this.sidebar.showLastSelectedElement()}focus(){this.sidebar.focus()}setVisibleView(e){this.visibleView!==e&&(this.visibleView&&this.visibleView.detach(),this.visibleView=e,e&&this.splitWidget.setMainWidget(e))}onResponseReceived(e){let t=e.data.request;t.resourceType()===x.ResourceType.resourceTypes.Document&&t.loaderId&&this.lastResponseReceivedForLoaderId.set(t.loaderId,t)}processRequest(e){let t=x.ParsedURL.ParsedURL.extractOrigin(e.url());if(!t)return;let i=e.securityState();(e.mixedContentType==="blockable"||e.mixedContentType==="optionally-blockable")&&(i="insecure");let n=this.origins.get(t);if(n){if(te(i,n.securityState)<0){n.securityState=i;let o=e.securityDetails();o&&(n.securityDetails=o),this.sidebar.updateOrigin(t,i),n.originView&&n.originView.setSecurityState(i)}}else{let o={securityState:i,securityDetails:e.securityDetails(),loadedFromCache:e.cached()};this.origins.set(t,o),this.sidebar.addOrigin(t,i)}}onRequestFinished(e){let t=e.data;this.updateFilterRequestCounts(t),this.processRequest(t)}updateFilterRequestCounts(e){if(e.mixedContentType==="none")return;let t="all";e.wasBlocked()?t="blocked":e.mixedContentType==="blockable"?t="block-overridden":e.mixedContentType==="optionally-blockable"&&(t="displayed");let i=this.filterRequestCounts.get(t);i?this.filterRequestCounts.set(t,i+1):this.filterRequestCounts.set(t,1),this.mainView.refreshExplanations()}filterRequestCount(e){return this.filterRequestCounts.get(e)||0}modelAdded(e){if(e.target()!==e.target().outermostTarget())return;this.securityModel=e;let t=e.resourceTreeModel(),i=e.networkManager();this.eventListeners.length&&x.EventTarget.removeEventListeners(this.eventListeners),this.eventListeners=[e.addEventListener(D.VisibleSecurityStateChanged,this.onVisibleSecurityStateChanged,this),t.addEventListener(S.ResourceTreeModel.Events.InterstitialShown,this.onInterstitialShown,this),t.addEventListener(S.ResourceTreeModel.Events.InterstitialHidden,this.onInterstitialHidden,this),i.addEventListener(S.NetworkManager.Events.ResponseReceived,this.onResponseReceived,this),i.addEventListener(S.NetworkManager.Events.RequestFinished,this.onRequestFinished,this)],t.isInterstitialShowing&&this.onInterstitialShown()}modelRemoved(e){this.securityModel===e&&(this.securityModel=null,x.EventTarget.removeEventListeners(this.eventListeners))}onPrimaryPageChanged(e){let{frame:t}=e.data,i=this.lastResponseReceivedForLoaderId.get(t.loaderId);this.sidebar.showLastSelectedElement(),this.sidebar.clearOrigins(),this.origins.clear(),this.lastResponseReceivedForLoaderId.clear(),this.filterRequestCounts.clear(),this.mainView.refreshExplanations();let n=x.ParsedURL.ParsedURL.extractOrigin(i?i.url():t.url);this.sidebar.setMainOrigin(n),i&&this.processRequest(i)}onInterstitialShown(){this.sidebar.showLastSelectedElement(),this.sidebar.toggleOriginsList(!0)}onInterstitialHidden(){this.sidebar.toggleOriginsList(!1)}},p;(function(c){c.MainOrigin="MainOrigin",c.NonSecure="NonSecure",c.Secure="Secure",c.Unknown="Unknown"})(p||(p={}));var Y=class extends a.Widget.VBox{panel;summarySection;securityExplanationsMain;securityExplanationsExtra;lockSpectrum;summaryText;explanations;securityState;constructor(e){super(e,{jslog:`${Q.pane("security.main-view")}`}),this.registerRequiredCSS(O,ge),this.setMinimumSize(200,100),this.contentElement.classList.add("security-main-view"),this.summarySection=this.contentElement.createChild("div","security-summary"),this.securityExplanationsMain=this.contentElement.createChild("div","security-explanation-list security-explanations-main"),this.securityExplanationsExtra=this.contentElement.createChild("div","security-explanation-list security-explanations-extra");let t=this.summarySection.createChild("div","security-summary-section-title");t.textContent=r(s.securityOverview),a.ARIAUtils.markAsHeading(t,1);let i=this.summarySection.createChild("div","lock-spectrum");this.lockSpectrum=new Map([["secure",i.appendChild(A("secure","lock-icon lock-icon-secure"))],["neutral",i.appendChild(A("neutral","lock-icon lock-icon-neutral"))],["insecure",i.appendChild(A("insecure","lock-icon lock-icon-insecure"))]]),a.Tooltip.Tooltip.install(this.getLockSpectrumDiv("secure"),r(s.secure)),a.Tooltip.Tooltip.install(this.getLockSpectrumDiv("neutral"),r(s.info)),a.Tooltip.Tooltip.install(this.getLockSpectrumDiv("insecure"),r(s.notSecure)),this.summarySection.createChild("div","triangle-pointer-container").createChild("div","triangle-pointer-wrapper").createChild("div","triangle-pointer"),this.summaryText=this.summarySection.createChild("div","security-summary-text"),a.ARIAUtils.markAsHeading(this.summaryText,2),this.explanations=null,this.securityState=null}getLockSpectrumDiv(e){let t=this.lockSpectrum.get(e);if(!t)throw new Error(`Invalid argument: ${e}`);return t}addExplanation(e,t){let i=e.createChild("div","security-explanation");i.classList.add("security-explanation-"+t.securityState);let n=I(t.securityState,"security-property security-property-"+t.securityState);i.appendChild(n);let o=i.createChild("div","security-explanation-text"),l=o.createChild("div","security-explanation-title");if(t.title?(l.createChild("span").textContent=t.title+" - ",l.createChild("span","security-explanation-title-"+t.securityState).textContent=t.summary):l.textContent=t.summary,o.createChild("div").textContent=t.description,t.certificate.length&&o.appendChild(V.createCertificateViewerButtonForCert(r(s.viewCertificate),t.certificate)),t.recommendations?.length){let d=o.createChild("ul","security-explanation-recommendations");for(let b of t.recommendations)d.createChild("li").textContent=b}return o}updateVisibleSecurityState(e){this.summarySection.classList.remove("security-summary-"+this.securityState),this.securityState=e.securityState,this.summarySection.classList.add("security-summary-"+this.securityState),this.securityState==="insecure"?(this.getLockSpectrumDiv("insecure").classList.add("lock-icon-insecure"),this.getLockSpectrumDiv("insecure").classList.remove("lock-icon-insecure-broken"),a.Tooltip.Tooltip.install(this.getLockSpectrumDiv("insecure"),r(s.notSecure))):this.securityState==="insecure-broken"&&(this.getLockSpectrumDiv("insecure").classList.add("lock-icon-insecure-broken"),this.getLockSpectrumDiv("insecure").classList.remove("lock-icon-insecure"),a.Tooltip.Tooltip.install(this.getLockSpectrumDiv("insecure"),r(s.notSecureBroken)));let{summary:t,explanations:i}=this.getSecuritySummaryAndExplanations(e);this.summaryText.textContent=t||ie[this.securityState](),this.explanations=this.orderExplanations(i),this.refreshExplanations()}getSecuritySummaryAndExplanations(e){let{securityState:t,securityStateIssueIds:i}=e,n,o=[];if(n=this.explainSafetyTipSecurity(e,n,o),i.includes("malicious-content"))n=r(s.thisPageIsDangerousFlaggedBy),o.unshift(new u("insecure",void 0,r(s.flaggedByGoogleSafeBrowsing),r(s.toCheckThisPagesStatusVisit)));else{if(i.includes("is-error-page")&&e.certificateSecurityState?.certificateNetworkError===null)return n=r(s.thisIsAnErrorPage),{summary:n,explanations:o};t==="insecure-broken"&&i.includes("scheme-is-not-cryptographic")&&(n=n||r(s.thisPageIsInsecureUnencrypted))}return i.includes("scheme-is-not-cryptographic")?(t==="neutral"&&!i.includes("insecure-origin")&&(n=r(s.thisPageHasANonhttpsSecureOrigin)),{summary:n,explanations:o}):(this.explainCertificateSecurity(e,o),this.explainConnectionSecurity(e,o),this.explainContentSecurity(e,o),{summary:n,explanations:o})}explainSafetyTipSecurity(e,t,i){let{securityStateIssueIds:n,safetyTipInfo:o}=e,l=[];if(n.includes("bad_reputation")){let d=`${r(s.chromeHasDeterminedThatThisSiteS)}

${r(s.ifYouBelieveThisIsShownIn)}`;l.push({summary:r(s.thisPageIsSuspicious),description:d})}else if(n.includes("lookalike")&&o?.safeUrl){let b={PH1:new URL(o.safeUrl).hostname},g=`${r(s.thisSitesHostnameLooksSimilarToP,b)}

${r(s.ifYouBelieveThisIsShownInErrorSafety)}`;l.push({summary:r(s.possibleSpoofingUrl),description:g})}return l.length>0&&(t=t||r(s.thisPageIsSuspiciousFlaggedBy),i.push(new u("insecure",void 0,l[0].summary,l[0].description))),t}explainCertificateSecurity(e,t){let{certificateSecurityState:i,securityStateIssueIds:n}=e,o=r(s.certificate);if(i?.certificateHasSha1Signature){let l=r(s.insecureSha),d=r(s.theCertificateChainForThisSite);i.certificateHasWeakSignature?t.push(new u("insecure",o,l,d,i.certificate,"none")):t.push(new u("neutral",o,l,d,i.certificate,"none"))}i&&n.includes("cert-missing-subject-alt-name")&&t.push(new u("insecure",o,r(s.subjectAlternativeNameMissing),r(s.theCertificateForThisSiteDoesNot),i.certificate,"none")),i&&i.certificateNetworkError!==null?t.push(new u("insecure",o,r(s.missing),r(s.thisSiteIsMissingAValidTrusted,{PH1:i.certificateNetworkError}),i.certificate,"none")):i&&!i.certificateHasSha1Signature&&t.push(new u("secure",o,r(s.validAndTrusted),r(s.theConnectionToThisSiteIsUsingA,{PH1:i.issuer}),i.certificate,"none")),n.includes("pkp-bypassed")&&t.push(new u("info",o,r(s.publickeypinningBypassed),r(s.publickeypinningWasBypassedByA))),i?.isCertificateExpiringSoon()&&t.push(new u("info",void 0,r(s.certificateExpiresSoon),r(s.theCertificateForThisSiteExpires)))}explainConnectionSecurity(e,t){let i=e.certificateSecurityState;if(!i)return;let n=r(s.connection);if(i.modernSSL){t.push(new u("secure",n,r(s.secureConnectionSettings),r(s.theConnectionToThisSiteIs,{PH1:i.protocol,PH2:i.getKeyExchangeName(),PH3:i.getCipherFullName()})));return}let o=[];i.obsoleteSslProtocol&&o.push(r(s.sIsObsoleteEnableTlsOrLater,{PH1:i.protocol})),i.obsoleteSslKeyExchange&&o.push(r(s.rsaKeyExchangeIsObsoleteEnableAn)),i.obsoleteSslCipher&&o.push(r(s.sIsObsoleteEnableAnAesgcmbased,{PH1:i.cipher})),i.obsoleteSslSignature&&o.push(r(s.theServerSignatureUsesShaWhichIs)),t.push(new u("info",n,r(s.obsoleteConnectionSettings),r(s.theConnectionToThisSiteIs,{PH1:i.protocol,PH2:i.getKeyExchangeName(),PH3:i.getCipherFullName()}),void 0,void 0,o))}explainContentSecurity(e,t){let i=!0,n=r(s.resources),o=e.securityStateIssueIds;o.includes("ran-mixed-content")&&(i=!1,t.push(new u("insecure",n,r(s.activeMixedContent),r(s.youHaveRecentlyAllowedNonsecure),[],"blockable"))),o.includes("displayed-mixed-content")&&(i=!1,t.push(new u("neutral",n,r(s.mixedContent),r(s.thisPageIncludesHttpResources),[],"optionally-blockable"))),o.includes("contained-mixed-form")&&(i=!1,t.push(new u("neutral",n,r(s.nonsecureForm),r(s.thisPageIncludesAFormWithA)))),e.certificateSecurityState?.certificateNetworkError===null&&(o.includes("ran-content-with-cert-error")&&(i=!1,t.push(new u("insecure",n,r(s.activeContentWithCertificate),r(s.youHaveRecentlyAllowedContent)))),o.includes("displayed-content-with-cert-errors")&&(i=!1,t.push(new u("neutral",n,r(s.contentWithCertificateErrors),r(s.thisPageIncludesResourcesThat))))),i&&(o.includes("scheme-is-not-cryptographic")||t.push(new u("secure",n,r(s.allServedSecurely),r(s.allResourcesOnThisPageAreServed))))}orderExplanations(e){if(e.length===0)return e;let t=["insecure","neutral","secure","info"],i=[];for(let n of t)i.push(...e.filter(o=>o.securityState===n));return i}refreshExplanations(){if(this.securityExplanationsMain.removeChildren(),this.securityExplanationsExtra.removeChildren(),!!this.explanations){for(let e of this.explanations)if(e.securityState==="info")this.addExplanation(this.securityExplanationsExtra,e);else switch(e.mixedContentType){case"blockable":this.addMixedContentExplanation(this.securityExplanationsMain,e,"block-overridden");break;case"optionally-blockable":this.addMixedContentExplanation(this.securityExplanationsMain,e,"displayed");break;default:this.addExplanation(this.securityExplanationsMain,e);break}if(this.panel.filterRequestCount("blocked")>0){let e={securityState:"info",summary:r(s.blockedMixedContent),description:r(s.yourPageRequestedNonsecure),mixedContentType:"blockable",certificate:[],title:""};this.addMixedContentExplanation(this.securityExplanationsMain,e,"blocked")}}}addMixedContentExplanation(e,t,i){let n=this.addExplanation(e,t),o=this.panel.filterRequestCount(i);if(!o){let d=n.createChild("div","security-mixed-content");d.textContent=r(s.reloadThePageToRecordRequestsFor);return}let l=n.createChild("button","security-mixed-content devtools-link text-button link-style");a.ARIAUtils.markAsLink(l),l.tabIndex=0,l.textContent=r(s.viewDRequestsInNetworkPanel,{n:o}),l.addEventListener("click",this.showNetworkFilter.bind(this,i))}showNetworkFilter(e,t){t.consume(),x.Revealer.reveal(H.UIFilter.UIRequestFilter.filters([{filterType:H.UIFilter.FilterType.MixedContent,filterValue:e}]))}},X=class extends a.Widget.VBox{originLockIcon;constructor(e,t){super({jslog:`${Q.pane("security.origin-view")}`}),this.registerRequiredCSS(ye,O),this.setMinimumSize(200,100),this.element.classList.add("security-origin-view");let i=this.element.createChild("div","title-section"),n=i.createChild("div","title-section-header");n.textContent=r(s.origin),a.ARIAUtils.markAsHeading(n,1);let o=i.createChild("div","origin-display");this.originLockIcon=o.createChild("span");let l=I(t.securityState,`security-property security-property-${t.securityState}`);this.originLockIcon.appendChild(l),o.appendChild(_(e,t.securityState));let d=i.createChild("div","view-network-button"),b=a.UIUtils.createTextButton(r(s.viewRequestsInNetworkPanel),g=>{g.consume();let f=new x.ParsedURL.ParsedURL(e);x.Revealer.reveal(H.UIFilter.UIRequestFilter.filters([{filterType:H.UIFilter.FilterType.Domain,filterValue:f.host},{filterType:H.UIFilter.FilterType.Scheme,filterValue:f.scheme}]))},{jslogContext:"reveal-in-network"});if(d.appendChild(b),a.ARIAUtils.markAsLink(b),t.securityDetails){let g=this.element.createChild("div","origin-view-section"),f=g.createChild("div","origin-view-section-title");f.textContent=r(s.connection),a.ARIAUtils.markAsHeading(f,2);let m=new U;if(g.appendChild(m.element()),m.addRow(r(s.protocol),t.securityDetails.protocol),t.securityDetails.keyExchange&&t.securityDetails.keyExchangeGroup?m.addRow(r(s.keyExchange),t.securityDetails.keyExchange+" with "+t.securityDetails.keyExchangeGroup):t.securityDetails.keyExchange?m.addRow(r(s.keyExchange),t.securityDetails.keyExchange):t.securityDetails.keyExchangeGroup&&m.addRow(r(s.keyExchange),t.securityDetails.keyExchangeGroup),t.securityDetails.serverSignatureAlgorithm){let y=Ne.get(t.securityDetails.serverSignatureAlgorithm);y??=r(s.unknownField)+" ("+t.securityDetails.serverSignatureAlgorithm+")",m.addRow(r(s.serverSignature),y)}m.addRow(r(s.cipher),t.securityDetails.cipher+(t.securityDetails.mac?" with "+t.securityDetails.mac:"")),t.securityDetails.encryptedClientHello&&m.addRow(r(s.encryptedClientHello),r(s.enabled));let oe=this.element.createChild("div","origin-view-section"),ae=oe.createChild("div","origin-view-section-title");ae.textContent=r(s.certificate),a.ARIAUtils.markAsHeading(ae,2);let B=t.securityDetails.signedCertificateTimestampList.length,ce=t.securityDetails.certificateTransparencyCompliance,T;if(B||ce!=="unknown"){T=this.element.createChild("div","origin-view-section");let y=T.createChild("div","origin-view-section-title");y.textContent=r(s.certificateTransparency),a.ARIAUtils.markAsHeading(y,2)}let Ie=this.createSanDiv(t.securityDetails.sanList),Te=new Date(1e3*t.securityDetails.validFrom).toUTCString(),Ee=new Date(1e3*t.securityDetails.validTo).toUTCString();if(m=new U,oe.appendChild(m.element()),m.addRow(r(s.subject),t.securityDetails.subjectName),m.addRow(J.i18n.lockedString("SAN"),Ie),m.addRow(r(s.validFrom),Te),m.addRow(r(s.validUntil),Ee),m.addRow(r(s.issuer),t.securityDetails.issuer),m.addRow("",V.createCertificateViewerButtonForOrigin(r(s.openFullCertificateDetails),e)),!T)return;let q=new U;q.element().classList.add("sct-summary"),T.appendChild(q.element());for(let y=0;y<B;y++){let h=t.securityDetails.signedCertificateTimestampList[y];q.addRow(r(s.sct),h.logDescription+" ("+h.origin+", "+h.status+")")}let W=T.createChild("div","sct-details");W.classList.add("hidden");for(let y=0;y<B;y++){let h=new U;W.appendChild(h.element());let w=t.securityDetails.signedCertificateTimestampList[y];h.addRow(r(s.logName),w.logDescription),h.addRow(r(s.logId),w.logId.replace(/(.{2})/g,"$1 ")),h.addRow(r(s.validationStatus),w.status),h.addRow(r(s.source),w.origin),h.addRow(r(s.issuedAt),new Date(w.timestamp).toUTCString()),h.addRow(r(s.hashAlgorithm),w.hashAlgorithm),h.addRow(r(s.signatureAlgorithm),w.signatureAlgorithm),h.addRow(r(s.signatureData),w.signatureData.replace(/(.{2})/g,"$1 "))}if(B){let y=function(){let w,ue=!W.classList.contains("hidden");ue?w=r(s.showFullDetails):w=r(s.hideFullDetails),h.textContent=w,a.ARIAUtils.setLabel(h,w),a.ARIAUtils.setExpanded(h,!ue),q.element().classList.toggle("hidden"),W.classList.toggle("hidden")},h=a.UIUtils.createTextButton(r(s.showFullDetails),y,{className:"details-toggle",jslogContext:"security.toggle-scts-details"});T.appendChild(h)}switch(ce){case"compliant":T.createChild("div","origin-view-section-notes").textContent=r(s.thisRequestCompliesWithChromes);break;case"not-compliant":T.createChild("div","origin-view-section-notes").textContent=r(s.thisRequestDoesNotComplyWith);break;case"unknown":break}let le=this.element.createChild("div","origin-view-section origin-view-notes");t.loadedFromCache&&(le.createChild("div").textContent=r(s.thisResponseWasLoadedFromCache)),le.createChild("div").textContent=r(s.theSecurityDetailsAboveAreFrom)}else if(t.securityState==="secure"){let g=this.element.createChild("div","origin-view-section"),f=g.createChild("div","origin-view-section-title");f.textContent=r(s.secure),a.ARIAUtils.markAsHeading(f,2),g.createChild("div").textContent=r(s.thisOriginIsANonhttpsSecure)}else if(t.securityState!=="unknown"){let g=this.element.createChild("div","origin-view-section"),f=g.createChild("div","origin-view-section-title");f.textContent=r(s.notSecure),a.ARIAUtils.markAsHeading(f,2),g.createChild("div").textContent=r(s.yourConnectionToThisOriginIsNot)}else{let g=this.element.createChild("div","origin-view-section"),f=g.createChild("div","origin-view-section-title");f.textContent=r(s.noSecurityInformation),a.ARIAUtils.markAsHeading(f,2),g.createChild("div").textContent=r(s.noSecurityDetailsAreAvailableFor)}}createSanDiv(e){let t=document.createElement("div");if(e.length===0)t.textContent=r(s.na),t.classList.add("empty-san");else{let n=e.length>3;for(let o=0;o<e.length;o++){let l=t.createChild("span","san-entry");l.textContent=e[o],n&&o>=2&&l.classList.add("truncated-entry")}if(n){let o=function(){let d=t.classList.contains("truncated-san"),b;d?(t.classList.remove("truncated-san"),b=r(s.showLess)):(t.classList.add("truncated-san"),b=r(s.showMoreSTotal,{PH1:e.length})),l.textContent=b,a.ARIAUtils.setLabel(l,b),a.ARIAUtils.setExpanded(l,d)},l=a.UIUtils.createTextButton(r(s.showMoreSTotal,{PH1:e.length}),o,{jslogContext:"security.toggle-san-truncation"});t.appendChild(l),o()}}return t}setSecurityState(e){this.originLockIcon.removeChildren();let t=I(e,`security-property security-property-${e}`);this.originLockIcon.appendChild(t)}},U=class{#t;constructor(){this.#t=document.createElement("table"),this.#t.classList.add("details-table")}element(){return this.#t}addRow(e,t){let i=this.#t.createChild("tr","details-table-row");i.createChild("td").textContent=e;let n=i.createChild("td");typeof t=="string"?n.textContent=t:n.appendChild(t)}};export{pe as SecurityModel,ke as SecurityPanel};
//# sourceMappingURL=security.js.map
