"use strict";(()=>{function a(){let r=document.getElementById("vscode-markdown-preview-data");if(r){let e=r.getAttribute("data-strings");if(e)return JSON.parse(e)}throw new Error("Could not load strings")}var i=class{constructor(e){this.settingsManager=e;this.didShow=!1;this.didHaveCspWarning=!1;document.addEventListener("securitypolicyviolation",()=>{this.onCspWarning()}),window.addEventListener("message",t=>{t&&t.data&&t.data.name==="vscode-did-block-svg"&&this.onCspWarning()})}setPoster(e){this.messaging=e,this.didHaveCspWarning&&this.showCspWarning()}onCspWarning(){this.didHaveCspWarning=!0,this.showCspWarning()}showCspWarning(){let e=a(),t=this.settingsManager.settings;if(this.didShow||t.disableSecurityWarnings||!this.messaging)return;this.didShow=!0;let s=document.createElement("a");s.innerText=e.cspAlertMessageText,s.setAttribute("id","code-csp-warning"),s.setAttribute("title",e.cspAlertMessageTitle),s.setAttribute("role","button"),s.setAttribute("aria-label",e.cspAlertMessageLabel),s.onclick=()=>{this.messaging.postMessage("showPreviewSecuritySelector",{source:t.source})},document.body.appendChild(s)}};var n=class{constructor(){this.unloadedStyles=[];this.finishedLoading=!1;let e=t=>{let s=t.target.dataset.source;this.unloadedStyles.push(s)};window.addEventListener("DOMContentLoaded",()=>{for(let t of document.getElementsByClassName("code-user-style"))t.dataset.source&&(t.onerror=e)}),window.addEventListener("load",()=>{!this.unloadedStyles.length||(this.finishedLoading=!0,this.poster?.postMessage("previewStyleLoadError",{unloadedStyles:this.unloadedStyles}))})}setPoster(e){this.poster=e,this.finishedLoading&&e.postMessage("previewStyleLoadError",{unloadedStyles:this.unloadedStyles})}};function d(r){let e=document.getElementById("vscode-markdown-preview-data");if(e){let t=e.getAttribute(r);if(t)return JSON.parse(t)}throw new Error(`Could not load data for ${r}`)}var o=class{constructor(){this._settings=d("data-settings")}get settings(){return this._settings}updateSettings(e){this._settings=e}};window.cspAlerter=new i(new o);window.styleLoadingMonitor=new n;})();
