/**
 * Copyright 2019 The Pennsylvania State University
 * @license Apache-2.0, see License.md for full text.
 */
class HtmlBlock extends HTMLElement{get html(){return"\n<style>\n\n        </style>\n<slot></slot>"}static get haxProperties(){return{canScale:!0,canEditSource:!0,gizmo:{title:"Html block",description:"A basic HTML block that provides HAXschema wiring",icon:"hax:html-code",color:"red",tags:["Other","developer","html"],handles:[{type:"html",content:"slot"}],meta:{author:"HAXTheWeb",owner:"The Pennsylvania State University"}},settings:{configure:[{slot:"",title:"HTML",description:"HTML code you want to present in content",inputMethod:"code-editor"}],advanced:[]}}}static get tag(){return"html-block"}constructor(t=!1){super(),this.tag=HtmlBlock.tag}connectedCallback(){this.allowscript=!1,this.__ignoreChange=!1,this.style.display="block",this.__observer=new MutationObserver(this.render.bind(this)),this.__observer.observe(this,{attributes:!0,characterData:!0,childList:!0,subtree:!0})}render(){this.__ignoreChange?this.__ignoreChange=!1:null!=this.allowscript&&this.allowscript&&void 0!==this.allowscript||this.__sanitizeHTML()}static get observedAttributes(){return["allowscript"]}get allowscript(){return this.getAttribute("allowscript")}set allowscript(t){t?this.setAttribute("allowscript","allowscript"):this.removeAttribute("allowscript")}attributeChangedCallback(t,e,i){"allowscript"===t&&(null!=i&&i&&void 0!==i?this.__rawHTML&&(this.__ignoreChange=!0,this.innerHTML=this.__rawHTML):this.__sanitizeHTML())}__sanitizeHTML(){this.__pen||(this.__pen=globalThis.document.createElement("div")),this.__pen.innerHTML=this.innerHTML,this.__rawHTML=this.__pen.cloneNode(!0).innerHTML,"function"==typeof this.innerHTML&&(this.innerHTML=this.innerHTML.replace(/<script[\s\S]*?>/gi,"&lt;script&gt;"),this.innerHTML=this.innerHTML.replace(/<\/script>/gi,"&lt;/script&gt;"))}}customElements.define(HtmlBlock.tag,HtmlBlock);export{HtmlBlock};