export const __webpack_ids__=["8684"];export const __webpack_modules__={18103:function(e,t,s){s.r(t),s.d(t,{MDNPlayRunner:()=>MDNPlayRunner});var a=s(35470),n=s(14703),i=s(13566),r=s(51968),o=s(62637),l=s(8900),c=s(32533),h=s(32960);let MDNPlayRunner=class MDNPlayRunner extends n.oi{static ssr=!1;static properties={code:{type:Object},defaults:{type:String},srcPrefix:{type:String,attribute:"src-prefix"},allow:{type:String},sandbox:{type:String},src:{reflect:!0}};static styles=h.Z;constructor(){super(),this.theme=new o.u(this),this.code=void 0,this.defaults=void 0,this.srcPrefix=void 0,this.allow=void 0,this.sandbox=void 0,this._subdomain=crypto.randomUUID(),this.ready=new Promise(e=>{this._resolveReady=()=>e(!0)})}_iframe=(0,r.V)();_onMessage({data:{typ:e,prop:t,args:s,uuid:a},origin:n}){a||(a=new URL(n,"https://example.com").hostname.split(".")[0]),a===this._subdomain&&("console"===e?this.dispatchEvent(new CustomEvent("console",{bubbles:!0,composed:!0,detail:{prop:t,args:s}})):"ready"===e&&this._resolveReady())}_constructUrl(){let e=new URL(globalThis.location.hostname.endsWith("localhost")?globalThis.location.origin.replace("3000","3001"):`${globalThis.location.protocol}//${l.vP.startsWith("localhost")?"":`${this._subdomain}.`}${l.vP}`);return e.pathname="runner.html",e}_updateSrc=new a.iQ(this,{args:()=>[this.code,this.defaults,this.theme.value,this.srcPrefix],task:async([e,t,s,a],{signal:n})=>{if(e&&e.js&&e.wat){let t=await d(e.wat);e.js=e.js.replace("{%wasm-url%}",t)}let{state:i}=await (0,c.q)(JSON.stringify({html:e?.html||"",css:e?.css||"",js:e?.js||"",defaults:t,theme:s})),r=(a||"").replace(/\/$/,"");n.throwIfAborted();let o=this._constructUrl();o.searchParams.set("uuid",this._subdomain),o.searchParams.set("state",i),o.pathname=`${r}/runner.html`;let l=o.href;this._iframe.value?.contentWindow?.location.replace(l),this.src=l,this.dispatchEvent(new CustomEvent("mdn-play-runner-src",{bubbles:!0,composed:!0,detail:l}))}});connectedCallback(){super.connectedCallback(),this._onMessage=this._onMessage.bind(this),window.addEventListener("message",this._onMessage)}async postMessage(e){await this.ready,this._iframe.value?.contentWindow?.postMessage(e,"*")}render(){let e=this._constructUrl();return e.searchParams.set("blank",""),e.searchParams.set("theme",this.theme.initialValue),(0,n.dy)`
      <iframe
        ${(0,r.i)(this._iframe)}
        src=${e.href}
        title="runner"
        allow=${(0,i.o)(this.allow)}
        sandbox=${[...new Set(["allow-scripts","allow-same-origin","allow-forms",...this.sandbox?.split(" ")||[]])].join(" ")}
      ></iframe>
    `}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this._onMessage)}};async function d(e){let{default:t,watify:a}=await s.e("1485").then(s.bind(s,59993));await t();let n=a(e);return`data:application/wasm;base64,${btoa(Array.from(n,e=>String.fromCodePoint(e)).join(""))}`}customElements.define("mdn-play-runner",MDNPlayRunner)},32533:function(e,t,s){async function a(e){let t=new Blob([e]),s=new CompressionStream("deflate-raw"),a=new Response(t.stream().pipeThrough(s)).arrayBuffer(),n=await a,i=[...new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256",n))].slice(0,20).map(e=>e.toString(16).padStart(2,"0")).join("");return{state:btoa(Array.from(new Uint8Array(n),e=>String.fromCodePoint(e)).join("")),hash:i}}async function n(e){if(!e)return{state:null,hash:null};let t=function(e){let t=atob(e),s=t.length,a=new Uint8Array(s);for(let e=0;e<s;e++)a[e]=t.charCodeAt(e);return a.buffer}(e),s=[...new Uint8Array(await crypto.subtle.digest("SHA-256",t))].slice(0,20).map(e=>e.toString(16).padStart(2,"0")).join(""),a=new DecompressionStream("deflate-raw"),n=new Response(new Blob([t]).stream().pipeThrough(a)).arrayBuffer();return{state:new TextDecoder().decode(await n),hash:s}}s.d(t,{a:()=>n,q:()=>a})},32960:function(e,t,s){s.d(t,{Z:()=>l});var a=s(14703),n=s(8081),i=s.n(n),r=s(23645),o=s.n(r)()(i());o.push([e.id,"iframe{border:none;box-sizing:initial;height:100%;width:100%}",""]);let l=(0,a.iv)([o.toString()])}};
//# sourceMappingURL=8684.9d7a1ac15f75f143.js.map