12 |
- "use strict";(self.webpackChunkmy_application=self.webpackChunkmy_application||[]).push([[1517],{912:(o,e,n)=>{n.r(e)},2534:(o,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getMonacoSetup=e.prodMonacoSetup=e.loadMonaco=e.waitForLoadedMonaco=e.getMonaco=e.getLoadedMonaco=void 0,e.getLoadedMonaco=function(){if(!monaco)throw new Error("monaco is not loaded yet");return monaco},e.getMonaco=function(){return window.monaco};let n,t,a=!1,i=new Promise(((o,e)=>{n=o,t=e}));function c(o){return{loaderUrl:`${o}/loader.js`,loaderConfigPaths:{vs:`${o}`},codiconUrl:`${o}/base/browser/ui/codicons/codicon/codicon.ttf`,monacoTypesUrl:void 0}}e.waitForLoadedMonaco=async function(){return i},e.loadMonaco=async function(o=e.prodMonacoSetup){return a||(a=!0,async function(o){const e=self;var n;e.require||await(n=o.loaderUrl,new Promise((o=>{const e=document.createElement("script");e.onload=()=>o(),e.async=!0,e.type="text/javascript",e.src=n,document.head.appendChild(e)}))),e.AMD=!0,e.getCodiconPath=()=>o.codiconUrl;const t=e.require;return t.config({paths:o.loaderConfigPaths}),new Promise((o=>{t(["vs/editor/editor.main"],(()=>{t(["vs/basic-languages/monaco.contribution","vs/language/css/monaco.contribution","vs/language/html/monaco.contribution","vs/language/json/monaco.contribution","vs/language/typescript/monaco.contribution"],(()=>{o(monaco)}))}))}))}(o).then(n,t)),i},e.prodMonacoSetup=c("node_modules/monaco-editor/min/vs"),e.getMonacoSetup=c},9492:(__unused_webpack_module,exports,__webpack_require__)=>{var __webpack_unused_export__;__webpack_unused_export__={value:!0};const monaco_loader_1=__webpack_require__(2534);let monacoPromise;async function initialize(state){if(monacoPromise)throw new Error("already initialized");const loadingContainerDiv=document.createElement("div");loadingContainerDiv.className="loader-container";const loadingDiv=document.createElement("div");loadingDiv.className="loader",loadingContainerDiv.appendChild(loadingDiv),document.body.appendChild(loadingContainerDiv),monacoPromise=(0,monaco_loader_1.loadMonaco)(state.monacoSetup),await monacoPromise,loadingContainerDiv.remove();const style=document.createElement("style");style.id="custom-style",style.innerHTML=state.css,document.body.appendChild(style),document.body.innerHTML+=state.html;const js=massageJs(state.js);try{eval(js)}catch(o){const e=document.createElement("pre");e.appendChild(document.createTextNode(`${o}: ${o.state}`)),document.body.insertBefore(e,document.body.firstChild)}}function sendMessageToParent(o){window.parent.postMessage(o,"*")}function massageJs(o){const e=/\/*\Wset from `(.*?)`:\W*\//g;for(const n of o.matchAll(e)){const e=n[1];o+=`\n try { globalThis.$bindModelToCodeStr(${e}, ${JSON.stringify("set from `"+e+"`")}); } catch (e) { console.error(e); }`}return o}__webpack_require__(912),window.addEventListener("message",(o=>{if("null"!==window.origin)return void console.error("not in sandbox");const e=o.data;"initialize"===e.kind?initialize(e.state):"update-css"===e.kind&&(document.getElementById("custom-style").innerHTML=e.css)})),globalThis.$sendMessageToParent=sendMessageToParent,globalThis.$bindModelToCodeStr=function(o,e){o.onDidChangeContent((()=>{const n=o.getValue();sendMessageToParent({kind:"update-code-string",codeStringName:e,value:n})}))}}},o=>{o(o.s=9492)}]);
- //# sourceMappingURL=playgroundRunner.js.map
|