export const __webpack_ids__=["5293"];export const __webpack_modules__={74580:function(e,t,i){i.r(t),i.d(t,{MDNPlayEditor:()=>MDNPlayEditor});var s=i(83582),n=i(129),a=i(81517),r=i(59155),o=i(93167),l=i(14339),d=i(73015),u=i(51651),h=i(59348),c=i(6742),m=i(11518),p=i(98001),f=i(14703),_=i(62637),v=i(58455);let MDNPlayEditor=class MDNPlayEditor extends f.oi{static properties={language:{type:String},minimal:{type:Boolean},value:{attribute:!1},delay:{type:Number}};static styles=v.Z;_editor;_updateTimer=-1;constructor(){super(),this.theme=new _.u(this),this.language="",this.minimal=!1,this._value="",this.delay=1e3}set value(e){if(this._value=e,this._editor){let t=h.yy.create({doc:e,extensions:this._extensions()});this._editor.setState(t)}this.dispatchEvent(new Event("update",{bubbles:!0,composed:!0}))}get value(){return this._editor?this._editor.state.doc.toString():this._value}focus(){this._editor?.focus()}_extensions(){let e=(()=>{switch(this.language){case"js":return[(0,o.eJ)()];case"html":return[(0,r.dy)()];case"css":return[(0,a.iv)()];case"wat":return[(0,l.p)()];default:return[]}})();return[p.w9,(0,d.n$)(),(0,s.vQ)(),...this.minimal?[]:[(0,m.Eu)(),(0,d.nY)(),(0,s.ys)(),(0,m.ZO)(),m.$f.of([...s.GA,...n.wQ,...s.B1,...u.Fv,n.oc]),m.tk.lineWrapping],..."dark"===this.theme.value?[c.vk]:[],...e,m.tk.focusChangeEffect.of((e,t)=>(this.dispatchEvent(new Event(t?"focus":"blur",{bubbles:!0,composed:!0})),null)),m.tk.updateListener.of(e=>{e.docChanged&&(-1!==this._updateTimer&&clearTimeout(this._updateTimer),this._updateTimer=globalThis?.setTimeout(()=>{this._updateTimer=-1,this.dispatchEvent(new Event("update",{bubbles:!0,composed:!0}))},this.delay))})]}async format(){let e=await i.e("7293").then(i.bind(i,87169)),t=(()=>{switch(this.language){case"js":return{parser:"babel",plugins:[i.e("9551").then(i.bind(i,15982)),i.e("7378").then(i.bind(i,62274))]};case"html":return{parser:"html",plugins:[i.e("1060").then(i.bind(i,98150)),i.e("9291").then(i.bind(i,84640)),i.e("9551").then(i.bind(i,15982)),i.e("7378").then(i.bind(i,62274))]};case"css":return{parser:"css",plugins:[i.e("9291").then(i.bind(i,84640))]};default:return}})();if(t){let i=await Promise.all(t.plugins),s=this.value,n=await e.format(s,{parser:t.parser,plugins:i});this.value===s&&s!==n&&(this.value=n)}}willUpdate(e){(e.has("language")||e.has("ThemeController.value"))&&this._editor?.dispatch({effects:h.Py.reconfigure.of(this._extensions())})}render(){return(0,f.dy)`<div
      class=${this.minimal?"editor minimal":"editor"}
    ></div>`}firstUpdated(){let e=h.yy.create({doc:this._value,extensions:this._extensions()});this._editor=new m.tk({state:e,parent:this.renderRoot.querySelector("div")||void 0})}};customElements.define("mdn-play-editor",MDNPlayEditor)},58455:function(e,t,i){i.d(t,{Z:()=>l});var s=i(14703),n=i(8081),a=i.n(n),r=i(23645),o=i.n(r)()(a());o.push([e.id,":host{display:block}.editor{height:100%}.editor.minimal{display:flex;flex-direction:column;justify-content:center}.editor.minimal .cm-content{align-self:center;min-height:auto}.editor.minimal .cm-focused{outline:none}.editor.minimal .cm-line{padding:0 12px}.editor .cm-editor{height:100%;width:100%}:is(.editor .cm-editor) *{font-family:var(--font-family-code)!important}",""]);let l=(0,s.iv)([o.toString()])}};
//# sourceMappingURL=5293.3a64fa8c75c41aa4.js.map