(function(){const d=document.location.search.match(/\bid=([\w-]+)/)[1],t=/platform=electron/.test(document.location.search),n=new class{constructor(){this.handlers=new Map,window.addEventListener("message",r=>{const o=r.data.channel,s=this.handlers.get(o);if(s)for(const a of s)a(r,r.data.args);else console.log("no handler for ",r)})}postMessage(r,o){window.parent.postMessage({target:d,channel:r,data:o},"*")}onMessage(r,o){let s=this.handlers.get(r);s||(s=[],this.handlers.set(r,s)),s.push(o)}};function c(e){console.error(`Webview fatal error: ${e}`),n.postMessage("fatal-error",{message:e})}const l=new Promise(async e=>{if(t)return e();if(!f())return c("Service Workers are not enabled in browser. Webviews will not work."),e();const r=1;navigator.serviceWorker.register("service-worker.js").then(async s=>{await navigator.serviceWorker.ready;const a=i=>{if(i.data.channel==="version")return navigator.serviceWorker.removeEventListener("message",a),i.data.version===r?e():s.update().then(()=>navigator.serviceWorker.ready).finally(e)};navigator.serviceWorker.addEventListener("message",a),s.active.postMessage({channel:"version"})},s=>{c(`Could not register service workers: ${s}.`),e()});const o=s=>{n.onMessage(s,a=>{navigator.serviceWorker.ready.then(i=>{i.active.postMessage({channel:s,data:a.data.args})})})};o("did-load-resource"),o("did-load-localhost"),navigator.serviceWorker.addEventListener("message",s=>{["load-resource","load-localhost"].includes(s.data.channel)&&n.postMessage(s.data.channel,s.data)})});function f(){try{return!!navigator.serviceWorker}catch(e){return!1}}const g=new class{constructor(){this.confirmBeforeClose="keyboardOnly",this.isModifierKeyDown=!1,n.onMessage("set-confirm-before-close",(e,r)=>{this.confirmBeforeClose=r}),n.onMessage("content",(e,r)=>{this.confirmBeforeClose=r.confirmBeforeClose}),window.addEventListener("beforeunload",e=>{if(!t)switch(this.confirmBeforeClose){case"always":return e.preventDefault(),e.returnValue="","";case"never":break;case"keyboardOnly":default:{if(this.isModifierKeyDown)return e.preventDefault(),e.returnValue="","";break}}})}onIframeLoaded(e){e.contentWindow.addEventListener("keydown",r=>{this.isModifierKeyDown=r.metaKey||r.ctrlKey||r.altKey}),e.contentWindow.addEventListener("keyup",()=>{this.isModifierKeyDown=!1})}},u={postMessage:n.postMessage.bind(n),onMessage:n.onMessage.bind(n),ready:l,fakeLoad:!t,onElectron:t,useParentPostMessage:!1,onIframeLoaded:e=>{g.onIframeLoaded(e)},rewriteCSP:t?e=>e.replace(/vscode-resource:(?=(\s|;|$))/g,"vscode-webview-resource:"):(e,r)=>{const o=new URL(r);return e.replace(/(vscode-webview-resource|vscode-resource):(?=(\s|;|$))/g,o.origin)}};window.createWebviewManager(u)})();

//# sourceMappingURL=https://ticino.blob.core.windows.net/sourcemaps/3c4e3df9e89829dce27b7b5c24508306b151f30d/core/vs\workbench\contrib\webview\browser\pre\host.js.map
